Add: MaestroID for login

This commit is contained in:
2018-05-27 22:16:57 +09:00
parent 4863a8d3f1
commit ef2218bfa6
3 changed files with 60 additions and 38 deletions
+18 -2
View File
@@ -3,6 +3,7 @@ header('Content-Type: application/json');
include "./../send_error_code.php";
$maestro_name = $_POST["maestro_name"];
$name = $_POST["name"];
$enterCode = $_POST["enter_code"];
/*
@@ -19,14 +20,29 @@ include "./../setup/connect_db.php";
$return_array = array();
$query = "SELECT UserID FROM moty_user WHERE Name=? AND enterCode=?";
$query = "SELECT MaestroID FROM moty_maestro WHERE Name=?";
$stmt = $db_conn->prepare($query);
$stmt->bind_param('ss', $name, $enterCode);
$stmt->bind_param('s', $maestro_name);
$stmt->execute();
$stmt->bind_result($maestro_id);
// while($stmt->fetch()) {
// ;
// }
$stmt->fetch();
$stmt->close();
// $maestro_id = 1;
$query = "SELECT UserID FROM moty_user WHERE MaestroID=? AND Name=? AND enterCode=?";
$stmt = $db_conn->prepare($query);
$stmt->bind_param('iss', $maestro_id, $name, $enterCode);
$stmt->execute();
$stmt->bind_result($user_id);
// while($stmt->fetch())
$stmt->fetch();
$stmt->close();
$db_conn->close();
$jsonUserData["MaestroID"] = $maestro_id;
$jsonUserData["UserID"] = $user_id;
echo json_encode($jsonUserData, JSON_UNESCAPED_UNICODE);