diff --git a/src/web/main/index.html b/src/web/main/index.html index 7176f89..7c839ac 100644 --- a/src/web/main/index.html +++ b/src/web/main/index.html @@ -11,6 +11,9 @@ + + +
첫 화면 - 마에스트로
로그아웃
+ 마에스트로
로그아웃
diff --git a/src/web/module/maestro_section_login.html b/src/web/module/maestro_section_login.html index 54e4dcf..b9bddab 100644 --- a/src/web/module/maestro_section_login.html +++ b/src/web/module/maestro_section_login.html @@ -10,30 +10,58 @@ } +
@@ -41,7 +69,7 @@
    diff --git a/src/web/server/maestro/login.php b/src/web/server/maestro/login.php new file mode 100644 index 0000000..e2ae411 --- /dev/null +++ b/src/web/server/maestro/login.php @@ -0,0 +1,71 @@ +close(); + exit; +} + +$replyJSON = login($maestro_name, $password); +if($replyJSON === null || $replyJSON[MaestroID] === null) { + $replyJSON["ERROR"] = "비밀번호를 잘못 입력하셨습니다."; + echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE); + $db_conn->close(); + exit; +} + +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; +} + +function login($maestro_name, $password) { + global $db_conn; + + $query = "SELECT MaestroID FROM moty_maestro WHERE Name=? AND Password=?"; + $stmt = $db_conn->prepare($query); + $stmt->bind_param('ss', $maestro_name, $password); + $stmt->execute(); + $stmt->bind_result($maestro_id); + // while($stmt->fetch()) + $stmt->fetch(); + $stmt->close(); + + $replyJSON["MaestroID"] = $maestro_id; + return $replyJSON; +} + +?> \ No newline at end of file diff --git a/src/web/server/setup/connect_db.php b/src/web/server/setup/connect_db.php index b04c293..d4002d9 100644 --- a/src/web/server/setup/connect_db.php +++ b/src/web/server/setup/connect_db.php @@ -24,8 +24,8 @@ $result = mysqli_query($db_conn, $query); function send_error_message($replyJSON, $error_message) { $replyJSON["ERROR"] = $error_message; - $db_conn->close(); echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE); + $db_conn->close(); } ?> \ No newline at end of file diff --git a/src/web/sql/make_db.sql b/src/web/sql/make_db.sql index 65158b8..a8c63cf 100644 --- a/src/web/sql/make_db.sql +++ b/src/web/sql/make_db.sql @@ -1,7 +1,7 @@ CREATE TABLE moty_maestro ( MaestroID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, Name CHAR(50) NOT NULL, - EnterCode CHAR(10) NOT NULL, + Password CHAR(10) NOT NULL, Email CHAR(50) NOT NULL, AccountType INT UNSIGNED NOT NULL, AccountStatus INT UNSIGNED NOT NULL,