Add: maestro register

This commit is contained in:
2018-06-26 23:51:39 +09:00
parent 77afebbb3a
commit 6f4be3e81b
5 changed files with 186 additions and 37 deletions
+48
View File
@@ -0,0 +1,48 @@
<?php
header('Content-Type: application/json');
$maestro_name = $_POST["maestro_name"];
/*
if(!is_numeric($enterCode)) {
send_error_code('생년월일이 숫자가 아닙니다. : '.$enterCode);
exit;
} else if(strlen($enterCode) != 6) {
send_error_code('6자리 숫자값을 정확히 입력하세요 : YYMMDD (예 : 120131) : '.$enterCode);
exit;
}
*/
include "./../setup/connect_db.php";
$maestro_id = get_maestro_id($maestro_name);
if($maestro_id !== null) {
$replyJSON["ERROR"] = "등록된 마에스트로 아이디가 있습니다";
echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
$db_conn->close();
exit;
}
$replyJSON["Result"] = "ok";
echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
$db_conn->close();
exit;
function get_maestro_id($maestro_name) {
global $db_conn;
$query = "SELECT MaestroID FROM moty_maestro WHERE Name=?";
$stmt = $db_conn->prepare($query);
$stmt->bind_param('s', $maestro_name);
$stmt->execute();
$stmt->bind_result($maestro_id);
// while($stmt->fetch()) {
// ;
// }
$stmt->fetch();
$stmt->close();
return $maestro_id;
}
?>