query("select username from ".$dbc_unver_accounts); $response2 = $dbc->query("select username from ".$dbc_ver_accounts); $uexist=false; if($response){ //cheak if exist while($row = $response->fetch(PDO::FETCH_ASSOC)){ if($row['username']==$_POST['usernameR']){ $uexist=true; break; } } while($row = $response2->fetch(PDO::FETCH_ASSOC)){ if($row['username']==$_POST['usernameR']){ $uexist=true; break; } } //creation if($uexist==true){ $_SESSION['message'] = "user allready exist"; } else { //send data $query="INSERT INTO ".$dbc_unver_accounts." (username, password, discord, email) VALUES (?,?,?,?)"; $stmt=$dbc->prepare($query); $password=password_hash($_POST['passwordR'], PASSWORD_DEFAULT); $stmt->execute([$_POST['usernameR'],$password,$_POST['discord'], $_POST['email']]); $_SESSION['message']="complete"; } } else { $_SESSION['message'] = "internal server error"; } } if(isset($_POST['manageconfirm'])){ if($_POST['action']=="deny"){ $stmt=$dbc->prepare("delete from ".$dbc_unver_accounts." where username=?"); $stmt->execute([$_POST['user']]); $action="denied"; } if($_POST['action']=="accept"){ $getinfo=$dbc->prepare("select * from ".$dbc_unver_accounts." where username=?"); $getinfo->execute([$_POST['user']]); $getinfoarr=array(); while($row=$getinfo->fetch()){ $getinfoarr=array($row['username'],$row['password'],$row['discord'],$row['email']); } $drop=$dbc->prepare("delete from ".$dbc_unver_accounts." where username=?"); $drop->execute([$_POST['user']]); $stmt=$dbc->prepare("INSERT INTO ".$dbc_ver_accounts." (username, password, discord, email, date_created, primary_key) VALUES (?,?,?,?,NOW(),NULL)"); $stmt->execute($getinfoarr); $file=fopen("../account_data/".$_POST['user'].".xml","w"); fwrite($file,''."\n\n #ffffff\n \n \n"); fclose($file); $action="confirmed"; } $xml=simplexml_load_file("log.xml"); $file = fopen("log.xml","w"); fwrite($file,''); fwrite($file,"\n"); fwrite($file,"\n".''.$_POST['reason'].''); for($i=0;$i<=4;$i++){ fwrite($file,"\n".''.$xml->user[$i].''); } fwrite($file,"\n"); fclose($file); } $dbc=null; ?>