Browse Source

引継ぎコード追加

main
みてるぞ 1 year ago
parent
commit
f5b5da6332
2 changed files with 26 additions and 1 deletions
  1. +5
    -1
      create_user.php
  2. +21
    -0
      inherit_user.php

+ 5
- 1
create_user.php View File

@@ -14,5 +14,9 @@ $user -> pass = implode (
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)));

echo [$user -> insert () -> id];
$user -> insert ();

echo [$user -> id,
$user -> pass,
$user -> inheritance_code];


+ 21
- 0
inherit_user.php View File

@@ -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;


Loading…
Cancel
Save