forked from ferchang/reg8log
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode_change_password.php
More file actions
29 lines (17 loc) · 938 Bytes
/
Copy pathcode_change_password.php
File metadata and controls
29 lines (17 loc) · 938 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
if(ini_get('register_globals')) exit("<center><h3>Error: Turn that damned register globals off!</h3></center>");
if(!isset($parent_page)) exit("<center><h3>Error: Direct access denied!</h3></center>");
$parent_page=true;
if($change_autologin_key_upon_new_password) {
$new_autologin_key=random_string(43);
$query='update `accounts` set `password_hash`='.$reg8log_db->quote_smart(create_secure_hash($_POST['newpass'])).", `autologin_key`='$new_autologin_key'".' where `username`='.$reg8log_db->quote_smart($_username).' limit 1';
$reg8log_db->query($query);
if(!isset($user)) return;
$user->user_info['autologin_key']=$new_autologin_key;
$user->save_identity($user->autologin_durability);
}
else {
$query='update `accounts` set `password_hash`='.$reg8log_db->quote_smart(create_secure_hash($_POST['newpass'])).' where `username`='.$reg8log_db->quote_smart($_username).' limit 1';
$reg8log_db->query($query);
}
?>