Anxious Posted April 20, 2009 Share Posted April 20, 2009 I have a login form yesideez helped me do the activation. but, now.. as I set it so that you have ot enter a password.. you can enter anything, and it'll log you in. Here is the code for the password. <?php /* Verify that user is in database */ $q = "SELECT password FROM ".TBL_USERS." WHERE username = '$username'"; $result = mysql_query($q, $this->connection); if(!$result || (mysql_numrows($result) < 1)){ return 1; //Indicates username failure } /* Retrieve password from result, strip slashes */ $dbarray = mysql_fetch_array($result); $dbarray['password'] = stripslashes($dbarray['password']); $password = stripslashes($password); /* Validate that password is correct */ if(!$password == $dbarray['password']){ return 2; /* indicates password failure */ } ?> However, it use to be .. at the end.. <?php if($password == $dbarray['password']){ return 0; /* successfully logged in */ } else { return 2; /* Indicate password failure */ } ?> I removed the "return 0" and put it after when return 3 comes in. (account activation) So now, it don't check if the password is correct.. Link to comment https://forums.phpfreaks.com/topic/154852-solved-not-needing-the-right-password/ Share on other sites More sharing options...
jackpf Posted April 20, 2009 Share Posted April 20, 2009 That's some...interesting code. Try if($password != $dbarray['password']){ return 2; /* indicates password failure */ } Instead of if(!$password == $dbarray['password']){ return 2; /* indicates password failure */ } Link to comment https://forums.phpfreaks.com/topic/154852-solved-not-needing-the-right-password/#findComment-814419 Share on other sites More sharing options...
Anxious Posted April 20, 2009 Author Share Posted April 20, 2009 Yeah, that works. thanks Link to comment https://forums.phpfreaks.com/topic/154852-solved-not-needing-the-right-password/#findComment-814422 Share on other sites More sharing options...
jackpf Posted April 20, 2009 Share Posted April 20, 2009 Jolly good. Link to comment https://forums.phpfreaks.com/topic/154852-solved-not-needing-the-right-password/#findComment-814423 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.