Re: Resetting Password - PLEASE HELP!!!
Dear friend,
You have put exceptions on all three functions; And they are no rasing any exception messages in the functions. I think the passworld is getting changed but some othe error is getting. Try following,
Check your sql databse in phpadmin/or sqladmin to find out actully the password is changing. If so We have to find out from where the error is comming
May be you have declare Variable Globaly
Normally what I do I used to Echo the steps at devolepment times in the function to make sure the function is worked Examplle
<?php
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.');
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 $new_password;----------- Only at time of devlopent to make sure that the funtion is working.
__________________________________________________
----------------------------------------------------------------------------------
<?php
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);
____________________________________________________
echo $new_password;/// make sure that this function gets the variabale from the other function
____________________________________________________
if($new_password==false)
throw new Exception('Could not generate new password.');
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
}
}
--------------------------------
And While calling the function you are using $passworld. You ma have to change $new_password. And The $new_passworld should be Global
Subject
Written By
Posted
November 21, 2005 05:01PM
Re: Resetting Password - PLEASE HELP!!!
November 21, 2005 11:33PM
November 22, 2005 06:58PM
November 21, 2005 11:37PM
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.