Thread: PHP Login Class
View Single Post
Old 05-09-2009, 12:42 PM   #24 (permalink)
allworknoplay
The Gregarious
 
allworknoplay's Avatar
 
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
allworknoplay is on a distinguished road
Default

Quote:
Originally Posted by captainmerton View Post
Apologies for again being on asking stoopid questions on this one but I cant seem to get the verifyLogin method to work correctly i.e. I have set up my table

CREATE TABLE visionire
(username VARCHAR(30) NOT NULL,
password VARCHAR(30) NOT NULL,
IP VARCHAR(20) NOT NULL,
PRIMARY KEY (username));

and added a row however when I run the script and try and log in the following query always returns no rows:

$query = sprintf("SELECT * FROM user WHERE username = '%s' AND password = sha1('%s') LIMIT 0,1", $this->clean($username), $this->clean($password));

If i rewrite the query and hardcode the user details it works ok so I am assuming its something to do with the way i have defined the columns on the table or how the strings are handled i dunno any experts out there who can spot an error?

Cheers.

Well, I'm no OO expert but I don't see where

$this->clean() is defined anywhere?

So it would probably work if you just left that out and put username and password in there like this:


$query = sprintf("SELECT * FROM user WHERE username = '%s' AND password = sha1('%s') LIMIT 0,1", $username, $password);
allworknoplay is offline  
Reply With Quote