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