PHP, mysql Password reset not initiating -
new here please go easy on me. have simple php page when use, enter username , password. problem cant seem reset it. basic background is, database called my_details , table called my_detailsdata. form itself:
<form action="reset.php" method="post"> <p align="center">type in below, username, password , new password reset login id.</p> <table id="form_pword_reset"> <tr><td>username</td><td>: <input type="text" name="username" /></td></tr> <tr><td>password</td><td>: <input type="password" name="password_hash" /></td></tr> <tr><td>new password</td><td>: <input type="password" name="password_reset" /></td></tr> <tr><td></td><td> <input type="submit" value="reset password" /></td></tr> </table> </form>
it links php page called reset.php on page, works fine, except when change password on html page, database table not affected @ all...
$db_select=mysql_select_db("my_details",$conn) or die(mysql_error()); //retrieving data html form $username = $_post['username']; $password = $_post['password_hash']; $password_reset = $_post['password_reset']; //for mysql injection (security reasons) $username = mysql_real_escape_string($username); $password = mysql_real_escape_string($password); $password_reset = mysql_real_escape_string($password_reset); $login = mysql_query("select*from my_detailsdata username='$username' , password_hash='$password'"); if(mysql_num_rows($login)== 1){ mysql_query($conn, "update my_detailsdata set password_hash=$password_reset username='$username' , password_hash='$password'"); echo "password changed successfully"; } else{ echo "incorrect username or password!"; } mysql_close($conn);
please add space:
from:
$login = mysql_query("select*from my_detailsdata username='$username' , password_hash='$password'");
to:
$login = mysql_query("select * my_detailsdata username='$username' , password_hash='$password'");
Comments
Post a Comment