My way of letting the user retrieve his password when he forgot it is via answering his security question, and when he got it right, it will echo his password. Everything's working, except when I start to click the view password
button.
I know it isn't advisable to post much code, but I think you need to see everything in order to understand what is wrong because I too cannot figure it out. Thank you in advance for those who will help me :)
EDIT: So I will do it in a safest way, that's why I deleted my code. I have a new and maybe more "solvable" question. Sir Jay asked me to post it. This is my register page.
<form method="post" class="form-horizontal" action="signup.php">
<input type="text" class="form-control" name="username" id="username" placeholder= "username">
<input type="password" class="form-control" name="password" id="password" placeholder="password">
</from>
My sign_up.php
if(isset($_POST['submit']))
{
$username = $conn->real_escape_string(trim($_POST['username']));
$password = $conn->real_escape_string(trim($_POST['password']));
$new_password = password_hash($password, PASSWORD_DEFAULT);
$query = "INSERT INTO pending(username, password) VALUES('$username','$new_password')";
}
It's in the table pending
because it requires admin's confirmation. and when the admin confirmed his request, data will go to users
table. And in my login, different page will redirect depends on the position of the user whether he's member or batch-president.