This is my code, but I am getting an error called "Undefined function get_random_word". Help.
if(isset($_POST['submit'])){
$email = mysqli_real_escape_string($connect,trim($_POST['email']));
$new_password = get_random_word(6, 13);
if($new_passowrd==false){
throw new Exception('Oops! ');
}
$rand_number = rand(0,999);
$new_password .= $rand_number;
mysqli_select_db($connect,"membership");
$result = "update users set password = sha1('".$new_password."')
where email = '".$email."'";
$q = mysqli_query($connect,$result) or die(mysqli_error($connect));
if(!q){
throw new Exception('Oops!');
}
else
{
return $new_pass开发者_如何学运维word;
}
}
?>
Can someone help me create it. I want to generate a random password for the user. Thanks
get_random_word is not a standard php function. Apparently, get_random_word() is in the user_auth_fns.php5 library.
http://www.phpbuilder.com/board/archive/index.php/t-10331068.html
You need to define a function called get_random_word
. You can't call a function you haven't defined.
As mentioned, get_random_word()
is not a standard PHP function.
Somebody else with the same problem, and how to proceed.
And once you've solved the above, you have a typo that will prevent your code from proceeding...
if($new_passowrd==false){
throw new Exception('Oops! ');
}
That error tells you that get_random_word()
has not been declared. You either need to find out where it went, or create it. get_random_word()
is not a built-in function.
You declared the function
$new_password = get_random_word(6, 13);
but not defined the function
精彩评论