MadnessRed Posted August 4, 2008 Share Posted August 4, 2008 ok, here is my if function. The bit where it tells you the password won't be shown when I finish the script but atm it is proving useful. if ($_GET['password'] != $row['password']){ die("Incorrect Password<br />You said: ".$_GET[password]."<br />Actual :".$row['password']); } I would expect that code above to say. if the (get password) and the password in the database base are different, then die. And when it dies I would expect he to md5 hashes that are displayed to be different. however here the error. Incorrect Password You said: 5f4dcc3b5aa765d61d8327deb882cf99 Actual :5f4dcc3b5aa765d61d8327deb882cf99 Link to comment https://forums.phpfreaks.com/topic/118103-if-function-is-failing/ Share on other sites More sharing options...
.josh Posted August 4, 2008 Share Posted August 4, 2008 er...maybe one of them somehow got a \n added onto the end, depending on where they came from? Or maybe the $row is on a column type that forces spaces concated to the end to make the full var type (like if it's supposed to be 40 chars but only 32 it will add 8 spaces)? Try trimming them. Link to comment https://forums.phpfreaks.com/topic/118103-if-function-is-failing/#findComment-607622 Share on other sites More sharing options...
MatthewJ Posted August 4, 2008 Share Posted August 4, 2008 I know this might sound strange, but it has happened to me once... If you are pasting in the md5 to a form field etc. to do the check, make sure you do not have any spaces at the beginning or end... Hope it helps Link to comment https://forums.phpfreaks.com/topic/118103-if-function-is-failing/#findComment-607623 Share on other sites More sharing options...
The Little Guy Posted August 4, 2008 Share Posted August 4, 2008 Why are you passing a password through a get? Link to comment https://forums.phpfreaks.com/topic/118103-if-function-is-failing/#findComment-607625 Share on other sites More sharing options...
.josh Posted August 4, 2008 Share Posted August 4, 2008 Why are you passing a password through a get? lol yeah I was kind of wondering that too but I mean I guess technically that's not really the issue at hand. Link to comment https://forums.phpfreaks.com/topic/118103-if-function-is-failing/#findComment-607629 Share on other sites More sharing options...
MadnessRed Posted August 4, 2008 Author Share Posted August 4, 2008 how would I end up with spaces at the beginning/end? also the database is "Varchar" with 40 characters. Link to comment https://forums.phpfreaks.com/topic/118103-if-function-is-failing/#findComment-608042 Share on other sites More sharing options...
DarkWater Posted August 4, 2008 Share Posted August 4, 2008 Try trim($row['password']). MD5 fields should be exactly 32 characters in length. Link to comment https://forums.phpfreaks.com/topic/118103-if-function-is-failing/#findComment-608047 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.