timmah1 Posted April 23, 2008 Share Posted April 23, 2008 I have a register page it encrypts the password with a * in the password field. It worked fine up until a few days ago. The code wasn't touched. Here's the script: $insert = mysql_query("insert into $table values ('NULL','".$_POST["username"]."',"."PASSWORD('".$_POST["password"]."'),'".$_POST["username"]."',NOW(),'".$_POST["name"]."','".$_POST["last"]."','".$_POST["address"]."','".$_POST["city"]."','".$_POST["state"]."','".$_POST["zip"]."','".$_POST["phone"]."','members','no')") The password looks like this *FF1E3D52BAA4D468BEA88AB15802206EC1C5BFFC Now, when someone registers, the password looks like this 4455e452290bad0b Can anybody tell me why it's doing this all of a sudden? Link to comment https://forums.phpfreaks.com/topic/102593-solved-code-not-working-anymore/ Share on other sites More sharing options...
PFMaBiSmAd Posted April 23, 2008 Share Posted April 23, 2008 It sounds like mysql was upgraded. The PASSWORD() function was never meant to be used by applications - http://dev.mysql.com/doc/refman/5.0/en/application-password-use.html Link to comment https://forums.phpfreaks.com/topic/102593-solved-code-not-working-anymore/#findComment-525396 Share on other sites More sharing options...
timmah1 Posted April 23, 2008 Author Share Posted April 23, 2008 What's the easiest way to fix this without screwing up everything, or re-writing everything? I don't really want to spend a lot of time on someone else's coding. The login script uses the same thing. Link to comment https://forums.phpfreaks.com/topic/102593-solved-code-not-working-anymore/#findComment-525401 Share on other sites More sharing options...
timmah1 Posted April 23, 2008 Author Share Posted April 23, 2008 I tried to do this with this logn $q = "SELECT * FROM `users` " ."WHERE `username`='".$_POST["username"]."' " ."AND `password`=MD5('".$_POST["password"]."') " ."AND `active`='yes' " ."LIMIT 1"; But it says incorrect username and or password. Link to comment https://forums.phpfreaks.com/topic/102593-solved-code-not-working-anymore/#findComment-525450 Share on other sites More sharing options...
PFMaBiSmAd Posted April 23, 2008 Share Posted April 23, 2008 For that to work, two things must be true - the length of the field in the database must be long enough to hold a MD5() hash string and there must be a MD5() value in the database that corresponds to the password. Link to comment https://forums.phpfreaks.com/topic/102593-solved-code-not-working-anymore/#findComment-525456 Share on other sites More sharing options...
timmah1 Posted April 23, 2008 Author Share Posted April 23, 2008 I got it to work. I should've clicked the link you provided before posting again. :-) Thank you for your help. Link to comment https://forums.phpfreaks.com/topic/102593-solved-code-not-working-anymore/#findComment-525459 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.