I currently use a script to register users on a site that generates a random password using MD5 eg...
function makeRandomPassword() {
$salt = "abcdefghjkmnpqrstuvwxyz0123456789";
srand((double)microtime()*1000000);
$i = 0;
while ($i <= 7) {
$num = rand() % 33;
$tmp = substr($salt, $num, 1);
$pass = $pass . $tmp;
$i++;
}
return $pass;
}
$random_password = makeRandomPassword();
$db_password = md5($random_password);
My script works fine and users can login successfully but I would like them to be able to change their password to one of their own choice by allowing them to enter their old password (that was randomly generated) and then entering a new password that will update MySQL database.
I have attempted to do this myself by querying the database and updating the field if the data is correct but it has not worked.
Can anyone give me a clue as to how I can do this??
Thankyou in advance....
function makeRandomPassword() {
$salt = "abcdefghjkmnpqrstuvwxyz0123456789";
srand((double)microtime()*1000000);
$i = 0;
while ($i <= 7) {
$num = rand() % 33;
$tmp = substr($salt, $num, 1);
$pass = $pass . $tmp;
$i++;
}
return $pass;
}
$random_password = makeRandomPassword();
$db_password = md5($random_password);
My script works fine and users can login successfully but I would like them to be able to change their password to one of their own choice by allowing them to enter their old password (that was randomly generated) and then entering a new password that will update MySQL database.
I have attempted to do this myself by querying the database and updating the field if the data is correct but it has not worked.
Can anyone give me a clue as to how I can do this??
Thankyou in advance....