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

@ -33,7 +33,7 @@ if($_SERVER['REQUEST_METHOD']==='POST'){
if($tmp){
$username=$tmp[0];
$password=$tmp[1];
$stmt=$db->prepare('SELECT approved FROM new_account WHERE onion=?;');
$stmt=$db->prepare('SELECT new_account.approved FROM new_account INNER JOIN users ON (users.id=new_account.user_id) WHERE users.onion=?;');
$stmt->execute([$tmp[2]]);
if($tmp=$stmt->fetch(PDO::FETCH_NUM)){
if(REQUIRE_APPROVAL && !$tmp[0]){