From 2d4143fca3045e01d2fb89f81441321e1a02ad37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=A2=E1=84=91=E1=85=B3=E1=86=AF=20=E1=84=82?= =?UTF-8?q?=E1=85=A9=E1=84=90=E1=85=B3=E1=84=87=E1=85=AE=E1=86=A8?= Date: Mon, 9 Jul 2018 09:20:18 +0900 Subject: [PATCH] Add: add maestro --- src/web/module/maestro_section_register.html | 51 ++++++++++++--- src/web/server/maestro/add_maestro.php | 66 ++++++++++++++++++++ 2 files changed, 107 insertions(+), 10 deletions(-) create mode 100644 src/web/server/maestro/add_maestro.php diff --git a/src/web/module/maestro_section_register.html b/src/web/module/maestro_section_register.html index 10954d6..125dba0 100644 --- a/src/web/module/maestro_section_register.html +++ b/src/web/module/maestro_section_register.html @@ -25,7 +25,7 @@ - @@ -146,15 +177,15 @@ function register_account() {
- (필수) 마에스트로 아이디 : + (필수) 마에스트로 아이디 :
- (필수) 암호 :
- (필수) 이메일 :
+ (필수) 암호 :
+ (필수) 이메일 :
(필수) 학생 수 :

diff --git a/src/web/server/maestro/add_maestro.php b/src/web/server/maestro/add_maestro.php new file mode 100644 index 0000000..e88423f --- /dev/null +++ b/src/web/server/maestro/add_maestro.php @@ -0,0 +1,66 @@ +close(); + exit; +} + +addMaestro($maestro_name, $password, $email, $account_type); + +$maestroID = hasMaestroName($maestro_name); +if($maestroID === null) { + send_error_message($replyJSON, $maestro_name." : 알 수 없는 이유로 마에스트로 계정 등록이 취소되었습니다."); + exit; +} + +$replyJSON["RESULT"] = "success"; +echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE); +$db_conn->close(); + + +function hasMaestroName($maestroName) { + global $db_conn; + + $query = "SELECT MaestroID FROM moty_maestro WHERE Name=?"; + $stmt = $db_conn->prepare($query); + $stmt->bind_param('s', $maestroName); + $stmt->execute(); + $stmt->bind_result($maestroID); + // while($stmt->fetch()) + $stmt->fetch(); + $stmt->close(); + + return $maestroID; +} + +function addMaestro($maestro_name, $password, $email, $account_type) { + global $db_conn; + + $query = " + INSERT INTO moty_Maestro (Name, Password, Email, AccountType, ActivateStatus, UserCount, AcceptClausesDateTime, MaestroTestID) + VALUES (?, PASSWORD(?), ?, ?, 0, 0, NOW(), -1)"; + $stmt = $db_conn->prepare($query); + $stmt->bind_param('sssi', $maestro_name, $password, $email, $account_type); + $stmt->execute(); +} + +?> \ No newline at end of file