@@ -14,5 +14,9 @@ $user -> pass = implode ( | |||||
array_map (fn () => $chars[rand (0, strlen ($chars) - 1)], range (1, 8))); | array_map (fn () => $chars[rand (0, strlen ($chars) - 1)], range (1, 8))); | ||||
$user -> inheritance_code = implode (array_map (fn () => rand (0, 9), range (1, 12))); | $user -> inheritance_code = implode (array_map (fn () => rand (0, 9), range (1, 12))); | ||||
echo [$user -> insert () -> id]; | |||||
$user -> insert (); | |||||
echo [$user -> id, | |||||
$user -> pass, | |||||
$user -> inheritance_code]; | |||||
@@ -0,0 +1,21 @@ | |||||
<?php | |||||
require_once './db_connection.php'; | |||||
require_once './modules/user.mod.php'; | |||||
$id = $_GET['id']; | |||||
$code = $_GET['code']; | |||||
$user = User :: find ($id); | |||||
if ($user -> inheritance_code === $code) | |||||
{ | |||||
echo implode (',', [1, | |||||
$user -> name, | |||||
$user -> pass]); | |||||
} | |||||
else | |||||
echo 0; | |||||