Re: Problem with a class... any help will be appreciated.

From: Date: Thu, 29 Apr 2004 10:04:07 +0000
Subject: Re: Problem with a class... any help will be appreciated.
Groups: php.general 
Request: Send a blank email to php-general+get-184934@lists.php.net to get a copy of this message
Hi, You wrote: ------ I have a class class security { function blank($user,$pass) { if((empty($user)) || (empty($pass))) return 1; else $this -> revisa(); } function revisa () { $this -> login(); } function login() { $_SESSION['User']=$user; $_SESSION['Nivel']=$nivel; $this -> registra_entrada(); } function registra_entrada() { header("location:../includes/login.php"); } } ?> and it works great ... but this wont work at all, all it wont go from one part tot he other, any ideas what am I doing wrong? class security { function blank($user,$pass) { if((empty($user)) || (empty($pass))) return 1; else $this -> revisa(); } function revisa () { $query_revisa = $this->dbQuery("SELECT User, Password, Nivel FROM Admon WHERE User = '$user'"); $row_revisa = $this->dbFetchArray($query_revisa); if(md5($pass)==$row_revisa['Password']) { $this -> login(); } else { return 1; } function login() { $_SESSION['User']=$user; $_SESSION['Nivel']=$nivel; $this -> registra_entrada(); } function registra_entrada() { $query_registra=$this->dbQuery("INSERT INTO admon_log (User) VALUES ('$user')"); header("location:../includes/login.php"); } } ?> ----- I think the error is in line: $query_revisa = $this->dbQuery("SELECT User, Password, Nivel FROM Admon WHERE User = '$user'"); PHP doesn't expand variables in single quoted expressions. Try this line instead: $query_revisa = $this->dbQuery("SELECT User, Password, Nivel FROM Admon WHERE User = $user"); Regards, Marius __________________________________ Do you Yahoo!? Win a $20,000 Career Makeover at Yahoo! HotJobs http://hotjobs.sweepstakes.yahoo.com/careermakeover

« previous php.general (#184934) next »