NLT Posted July 8, 2011 Author Share Posted July 8, 2011 Nvm fixed. Thanks all Link to comment https://forums.phpfreaks.com/topic/241408-password-reset-help/page/2/#findComment-1240124 Share on other sites More sharing options...
NLT Posted July 9, 2011 Author Share Posted July 9, 2011 I tried to make it so it counts the pass_reset table and if there is no confirm_code for the confirmation code it displays a certain error. I need it to display something else if it's valid also. I tried this: <? include('config.php'); $confirmation=$_GET['code']; $table1="pass_reset"; $selectkey="SELECT * FROM $table1 WHERE confirm_code ='$confirmation'"; $gotkey=mysql_query($selectkey); if($gotkey){ $count=mysql_num_rows($gotkey); } if($count==1){ $rows=mysql_fetch_array($gotkey); $email=$rows['email']; } $table2="users"; $query_user="SELECT username FROM $table2 WHERE mail='$email'"; $query=mysql_query($query_user); $row = mysql_fetch_array($query); $user = $row['username']; $plain_password = substr ( md5(uniqid(rand(),1)), 3, 10); $md_password = md5($plain_password); mysql_query("UPDATE users SET password='{$md_password}' WHERE mail='{$email}' LIMIT 1"); $to=$email; $subject="Your new password - $hotel_name"; $header="From: [email protected]\r\n"; $message="Your new passwordr\n"; $message.="You can now log in with this password: $plain_password\r\n"; $message.="Be sure to change it as soon as you log in!"; $sentmail = mail($to,$subject,$message,$header); $validateq1 = mysql_query("SELECT * FROM pass_reset WHERE confirmation='$confirmation'"); $validation1 = mysql_num_rows($validateq1); { if($validation1==0); echo "Your confirmation code is not valid."; } mysql_query("DELETE from `pass_reset` WHERE `confirm_code`='$confirmation'"); ?> Errors though Link to comment https://forums.phpfreaks.com/topic/241408-password-reset-help/page/2/#findComment-1240449 Share on other sites More sharing options...
NLT Posted July 9, 2011 Author Share Posted July 9, 2011 Nobody :S? Link to comment https://forums.phpfreaks.com/topic/241408-password-reset-help/page/2/#findComment-1240465 Share on other sites More sharing options...
gristoi Posted July 9, 2011 Share Posted July 9, 2011 What error? Link to comment https://forums.phpfreaks.com/topic/241408-password-reset-help/page/2/#findComment-1240506 Share on other sites More sharing options...
Andy11548 Posted July 9, 2011 Share Posted July 9, 2011 This: { if($validation1==0); echo "Your confirmation code is not valid."; } mysql_query("DELETE from `pass_reset` WHERE `confirm_code`='$confirmation'"); Should be: if($validation1==0) { echo "Your confirmation code is not valid."; } else { mysql_query("DELETE from `pass_reset` WHERE `confirm_code`='$confirmation'"); } Link to comment https://forums.phpfreaks.com/topic/241408-password-reset-help/page/2/#findComment-1240513 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.