MySQL Forums
Forum List  »  PHP

Re: Resetting Password - PLEASE HELP!!!
Posted by: sajithkumar kanangottu
Date: November 24, 2005 04:40AM

Looks like Only your last function is having problem
Notify password.

What I mean is You have to find out upto what stage Your script is working. For that only I have asked you to echo the word
try that and find out where is excat problem
see example

function reset_password($username)
// set password for username to a random value
// return the new password or false on failure
{
// get a random dictionary word b/w 6 and 13 characters in length
$new_password = get_random_word(6, 13);

if($new_password==false)
throw new Exception('Could not generate new password.');
echo "$new_password";-------------------------------------->>>>>>>>>>>>>>>change

srand ((double) microtime() * 1000000);
$rand_number = rand(0, 999);
$new_password .= $rand_number;

// set user's password to this in database or return false
$conn = db_connect();
$result = $conn->query( "update user
set password = sha1('$new_password')
where username = '$username'");
if (!$result)
throw new Exception('Could not change password.'); // not changed
else {------------------------------
return $new_password; // changed succesfully
echo "this function -reset password worked Ok";------------------>>>change
}

}



regards

Options: ReplyQuote


Subject
Written By
Posted
Re: Resetting Password - PLEASE HELP!!!
November 24, 2005 04:40AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.