Moved random_string() to helpers.php. Renamed password_reset_validation.php to ajax_passwordresetvalidation.php for consistency.
This commit is contained in:
parent
02d313cb73
commit
0f3185c9ea
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
function Set_Password_Reset($email) {
|
||||
$date = date("Y-m-d H:i:s");
|
||||
$reset_code = Random_String(20);
|
||||
$reset_code = random_string(20);
|
||||
$query = "UPDATE `users` SET `password_reset_code`=" . $reset_code . ", `password_reset_date`='" . $date . "' WHERE `email`='" . $email . ";";
|
||||
$reset = query($query);
|
||||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
require_once(SITE_LOCATION . '/php/helpers.php');
|
||||
require_once(SITE_LOCATION . '/php/plugins/easycrypt.php');
|
||||
require_once(SITE_LOCATION . '/php/random_string.php');
|
||||
require_once(SITE_LOCATION . '/php/validation.php');
|
||||
require_once(SITE_LOCATION . '/php/password_reset_validation.php');
|
||||
|
||||
|
|
|
@ -62,4 +62,15 @@ function time_elapsed($secs){
|
|||
|
||||
return join(' ', $ret);
|
||||
}
|
||||
|
||||
function random_string($length = 10) {
|
||||
// Retrieved from http://stackoverflow.com/a/4356295/3508346
|
||||
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
$charactersLength = strlen($characters);
|
||||
$randomString = '';
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$randomString .= $characters[rand(0, $charactersLength - 1)];
|
||||
}
|
||||
return $randomString;
|
||||
}
|
||||
?>
|
|
@ -1,12 +0,0 @@
|
|||
<?php
|
||||
// Retrieved from http://stackoverflow.com/a/4356295/3508346
|
||||
function Random_String($length = 10) {
|
||||
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
$charactersLength = strlen($characters);
|
||||
$randomString = '';
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$randomString .= $characters[rand(0, $charactersLength - 1)];
|
||||
}
|
||||
return $randomString;
|
||||
}
|
||||
?>
|
Loading…
Reference in New Issue