Kod
Catchable fatal error: Object of class __PHP_Incomplete_Class could not be converted to string in C:\Program Files\WebServ\httpd-users\test\news\protect.php on line 6
Powiem jeszcze, że jak usunę wyświetlanie $_SESSION['user'] to wszystko i jest w porządku to samo gdy zamiast klasy to samo, tylko że w wyjątku to też działa. Proszę o pomoc bo mi zależy żeby to rozwiązać a nie mogę tego rozwiązać, szukałem wszędzie i nic o tym nie znalazłem.
Kod:
<?php class user { public $user; private $pass; public function checkuser() { $pdo = new pdo ('mysql:host=localhost;dbname=oop','root','mentormiszcz1e'); $row= $pdo-> query ("SELECT name,password FROM `trials` WHERE name= '".$_POST['user']."'"); while ($line= $row-> fetch()) { $this-> user= $line['name']; $this-> pass= $line['password']; $_SESSION['user']= $_POST['user']; } else { } } // end while $row-> closeCursor(); } // end function } $user= new user; $user-> checkuser(); ?>
<?php } else { } ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en-us"> <head> </head> <body> <form action="class.php" method="post"> <div id="form"> <input type="text" name="user" /> <input type="password" name="pass" /> <input type="submit" value="Sign in" /> </div> </form> </body> </html>