From 0bf3adb4ed36d62919ed3f64284e3492930d4cf3 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: Thu, 19 Jul 2018 07:15:49 +0900 Subject: [PATCH] Fix: experience maestro account, experience_player_account --- src/web/main/free_player_app_menu.html | 3 +- src/web/module/home_section.html | 9 ++-- ...unt.php => maestro_experience_account.php} | 36 ++++++++++------ .../player/player_experience_account.php | 43 +++++++++++++++++++ 4 files changed, 74 insertions(+), 17 deletions(-) rename src/web/server/maestro/{maestro_test_account.php => maestro_experience_account.php} (67%) create mode 100644 src/web/server/player/player_experience_account.php diff --git a/src/web/main/free_player_app_menu.html b/src/web/main/free_player_app_menu.html index d5e2491..7f87aea 100644 --- a/src/web/main/free_player_app_menu.html +++ b/src/web/main/free_player_app_menu.html @@ -19,7 +19,7 @@ function loadMaestroTestAccountInfo() { sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode); - "./../server/maestro/maestro_test_account.php", + "./../server/player/player_experience_account.php", "", (jsonData) => { @@ -34,6 +34,7 @@ sessionStorage.setItem("maestroID", maestroID); sessionStorage.setItem("playerID", playerID); sessionStorage.setItem("playerName", playerName); + location.href = "./../client/menu_app.html"; }, diff --git a/src/web/module/home_section.html b/src/web/module/home_section.html index ded7f0a..df04f7c 100644 --- a/src/web/module/home_section.html +++ b/src/web/module/home_section.html @@ -14,9 +14,9 @@ diff --git a/src/web/server/maestro/maestro_test_account.php b/src/web/server/maestro/maestro_experience_account.php similarity index 67% rename from src/web/server/maestro/maestro_test_account.php rename to src/web/server/maestro/maestro_experience_account.php index b880189..ce4648f 100644 --- a/src/web/server/maestro/maestro_test_account.php +++ b/src/web/server/maestro/maestro_experience_account.php @@ -5,50 +5,58 @@ include "./../lib/send_reply_json.php"; include "./../setup/connect_db.php"; -$maestro_test_account_id = get_maestro_test_account_id("test"); -if($maestro_test_account_id === null) { - set_error_message("등록된 마에스트로 관리자 계정이 없습니다. (".$maestro_test_account_id.")"); +$maestro_experience_id = get_maestro_experience_id("test"); +if($maestro_experience_id === null) { + set_error_message("등록된 마에스트로 관리자 계정이 없습니다. (".$maestro_experience_id.")"); send_result_fail(); exit; } -$maestro_test_player_id = get_maestro_test_player_id($maestro_test_account_id); +$maestro_test_player_id = get_maestro_test_player_id($maestro_experience_id); if($maestro_test_player_id === null) { - set_error_message("등록된 마에스트로 관리자 계정이 없습니다. (".$maestro_test_account_id.")"); + set_error_message("등록된 마에스트로 관리자 계정이 없습니다. (".$maestro_experience_id.")"); send_result_fail(); exit; } $maestro_test_player_name = get_maestro_test_player_name($maestro_test_player_id); -set_data("maestroID", $maestro_test_account_id); +set_data("maestroID", $maestro_experience_id); set_data("playerID", $maestro_test_player_id); set_data("playerName", $maestro_test_player_name); send_result_success(); exit; -function get_maestro_test_account_id($maestro_name) { +function get_maestro_experience_id($maestro_name) { global $db_conn; - $query = "SELECT MaestroID FROM moty_maestro WHERE Name=?"; + $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_test_account_id); + $stmt->bind_result($maestro_experience_id); // while($stmt->fetch()) { // ; // } $stmt->fetch(); $stmt->close(); - return $maestro_test_account_id; + return $maestro_experience_id; } function get_maestro_test_player_id($maestro_id) { global $db_conn; - $query = "SELECT MaestroTestID FROM moty_maestro WHERE MaestroID=?"; + $query = " + SELECT MaestroTestID + FROM moty_maestro + WHERE MaestroID = ? + "; $stmt = $db_conn->prepare($query); $stmt->bind_param("i", $maestro_id); $stmt->execute(); @@ -65,7 +73,11 @@ function get_maestro_test_player_id($maestro_id) { function get_maestro_test_player_name($player_id) { global $db_conn; - $query = "SELECT Name FROM moty_player WHERE PlayerID=?"; + $query = " + SELECT Name + FROM moty_player + WHERE PlayerID = ? + "; $stmt = $db_conn->prepare($query); $stmt->bind_param("i", $player_id); $stmt->execute(); diff --git a/src/web/server/player/player_experience_account.php b/src/web/server/player/player_experience_account.php new file mode 100644 index 0000000..886f9cd --- /dev/null +++ b/src/web/server/player/player_experience_account.php @@ -0,0 +1,43 @@ +prepare($query); + $stmt->bind_param("s", $maestro_name); + $stmt->execute(); + $stmt->bind_result($maestro_experience_id); + // while($stmt->fetch()) { + // ; + // } + $stmt->fetch(); + $stmt->close(); + + return $maestro_experience_id; +} + +?> \ No newline at end of file