Refactor DB foreign keys to auto_incrementing id instead of onion

Allows moving domains into separate table at a later stage
This commit is contained in:
Daniel Winzen
2018-10-16 21:09:16 +02:00
parent 81c2364b7b
commit 6eb068222c
7 changed files with 38 additions and 20 deletions

View File

@ -23,9 +23,9 @@ if($_SERVER['REQUEST_METHOD']==='POST'){
$stmt->execute([$hash, $user['username']]);
$msg.='<p style="color:green;">Successfully changed account password.</p>';
}elseif($_REQUEST['type']==='sys'){
$stmt=$db->prepare('INSERT INTO pass_change (onion, password) VALUES (?, ?);');
$stmt=$db->prepare('INSERT INTO pass_change (user_id, password) VALUES (?, ?);');
$hash=get_system_hash($_POST['newpass']);
$stmt->execute([$user['onion'], $hash]);
$stmt->execute([$user['id'], $hash]);
$msg.='<p style="color:green;">Successfully changed system account password, change will take affect within the next minute.</p>';
}elseif($_REQUEST['type']==='sql'){
$stmt=$db->prepare("SET PASSWORD FOR '$user[onion].onion'@'%'=PASSWORD(?);");