Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Rejestracja
Zmyslak
post
Post #1





Grupa: Zarejestrowani
Postów: 4
Pomógł: 0
Dołączył: 16.02.2009

Ostrzeżenie: (0%)
-----


Witam!

W tej linijce
Kod
$this->c=@mysql_query("select username from users where username='$susername'");

Jest następujący błąd:
Kod
Fatal error:  Using $this when not in object context in /home/fotozrzut/domains/fotozrzut.pl/public_html/rejestracja.php on line 38



Bardzo proszę o pomoc (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)

Ten post edytował Zmyslak 16.02.2009, 22:57:32
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 7)
webdevil
post
Post #2





Grupa: Zarejestrowani
Postów: 82
Pomógł: 18
Dołączył: 2.02.2009

Ostrzeżenie: (0%)
-----


a jest to część jakiejś klasy? bo jeśli nie to po co $this?
Go to the top of the page
+Quote Post
Zmyslak
post
Post #3





Grupa: Zarejestrowani
Postów: 4
Pomógł: 0
Dołączył: 16.02.2009

Ostrzeżenie: (0%)
-----


O co chodzi z tą klasą?

Przepraszam ale jestem początkujący nawet bardzo.

Skrypt nie jest mój (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)

Chodzi o to że jest to rejestracja.

Od tej linijki której podałem skrypt nie działa.
Go to the top of the page
+Quote Post
webdevil
post
Post #4





Grupa: Zarejestrowani
Postów: 82
Pomógł: 18
Dołączył: 2.02.2009

Ostrzeżenie: (0%)
-----


pokaż cały kod to wtedy coś może poradzimy
Go to the top of the page
+Quote Post
Zmyslak
post
Post #5





Grupa: Zarejestrowani
Postów: 4
Pomógł: 0
Dołączył: 16.02.2009

Ostrzeżenie: (0%)
-----


Od tego momentu nie działa. Nie cały bo za długi. Jest mniej więcej ten błędny kod.

Kod
    } else if($submit3) {
        if(!ereg("^[A-Za-z0-9_]{1,16}$",$susername)) {
            $serror="Błędna nazwa! Możesz użyć malsymalnie 15 znaków. Możesz używać liter, cyfer i kropek.<br>";
        }
        $this->c=@mysql_query("select username from users where username='$susername'");
        $this->d=mysql_fetch_object($this->c);
        if(is_object($this->d)) { $serror="Podany login jest już zajęty.<br>"; }
        $this->c=@mysql_query("select username from users where username='$susername'");
        $this->d=mysql_fetch_object($this->c);
        if(is_object($this->d)) { $serror="Podany login jest już zajęty.<br>"; }
        if (!$serror) {
            mt_srand((double)microtime()*1000000^getmypid());
            $pass_length = mt_rand($this->min_pass_length,$this->max_pass_length);
            while(strlen($spassword)<$pass_length) {
                $spassword.=substr($this->chars,(mt_rand()%strlen($this->chars)),1);
            }
            include("include/email.php");
            $signupmessage=str_replace("<username>","$susername",$signupmessage);
            $signupmessage=str_replace("<password>","$spass",$signupmessage);
            $signupmessage=str_replace("<bupass>","$bupass",$signupmessage);
            $adminsignupmessage = str_replace("<member_email>","$semail",$adminsignupmessage);
            $subject = "$signupsubject";
            $message = "$signupmessage";
            mail($semail,$subject,$message,"From: $adminemail");
                        $adminsignupsubject=str_replace("<username>","$susername",$adminsignupsubject);
            $adminsignupmessage = str_replace("<username>","$susername",$adminsignupmessage);
            $adminsignupmessage = str_replace("<password>","$spass",$adminsignupmessage);
            $adminsignupmessage = str_replace("<bupass>","$bupass",$adminsignupmessage);
            $adminsignupmessage = str_replace("<member_email>","$semail",$adminsignupmessage);
            $subject = "$adminsignupsubject";
            $message = "$adminsignupmessage";
            mail($adminemail,$subject,$message,"From: $adminemail");
            $nowdate = date("M d, Y");

            mysql_query("insert into users (uid, username, password, email, last_paid, signup_date) values ('','$susername', '$spass', '$semail', 'free', '$nowdate')");
            echo "<h3>Zakładanie nowego konta Krok 3 - Zakończone</h3> $table2
            <tr><td align=center>Dziękujemy za doł±czenie do grona użytkowników $sitename. Na podany przez Ciebie email (<b>$semail</b>) została wysłana wiadomo¶ć z danymi konta. </table>";
}
Go to the top of the page
+Quote Post
Nekro
post
Post #6





Grupa: Zarejestrowani
Postów: 36
Pomógł: 2
Dołączył: 3.01.2007
Skąd: Żory

Ostrzeżenie: (0%)
-----


Z komunikatu bledu wynioskowac da sie, że używasz $this pozasa klasa.
Skoro jestes poczatkujacy radze poczytac sobie troche o php a szczegolnie o zmiennych, klasach, obiektach.
Wtedy sie dowiesz kiedy uzywa sie $this->zmienna, a kiedy $zmienna.
Go to the top of the page
+Quote Post
Zmyslak
post
Post #7





Grupa: Zarejestrowani
Postów: 4
Pomógł: 0
Dołączył: 16.02.2009

Ostrzeżenie: (0%)
-----


Naprawdę nikt nie wie co jest źle?

Jest mi to bardzo potrzebne (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post
jezoo
post
Post #8





Grupa: Zarejestrowani
Postów: 92
Pomógł: 3
Dołączył: 4.04.2006

Ostrzeżenie: (0%)
-----


Cytat(Zmyslak @ 17.02.2009, 09:48:24 ) *
Naprawdę nikt nie wie co jest źle?

Jest mi to bardzo potrzebne (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)

wyzej bylo powiedziane, zebys pokazal CALY skrypt a ty pokazales jego czesc, my nie jestesmy jasnowidzamy czy to jest klasa czy funkcja

btw, ten blad powturzy Ci sie jeszcze tu
  1. <?php
  2. $this->d=mysql_fetch_object($this->c);
  3. ?>

i tu
  1. <?php
  2. if(is_object($this->d)) { $serror="Podany login jest już zajęty.<br>"; }
  3.        $this->c=@mysql_query("select username from users where username='$susername'");
  4.        $this->d=mysql_fetch_object($this->c);
  5.        if(is_object($this->d))
  6. ?>


reasumujac
wywal $this i zostaw sama zmienna $c lub $d czy jak tam masz.

Ten post edytował jezoo 24.02.2009, 11:44:19
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 16.10.2025 - 23:50