<?php
require('dblogin.php');
$code = $_POST['code'];
$data = $pdo->query("SELECT * FROM for_verification WHERE temporary_code='$code'")->fetch();
if(!$data) echo 'false';
else {
	$pdo->query("DELETE FROM for_verification WHERE temporary_code='$code'")->fetch();
	$prename = $data['prename'];
	$surname = $data['surname'];
	$password = $data['password'];
	$email = $data['email'];
	$function = $data['function'];
	$appid = uniqid();
	$pdo->query("INSERT INTO users (prename, surname, password, email, app_id, function) VALUES ('$prename','$surname','$password','$email','$appid','$function')")->exec();
	$data['app_id'] = $appid;
	echo json_encode($data);
}
?>