Fix: DB jisangs -> moty

This commit is contained in:
2018-08-22 17:25:07 +09:00
parent 5c0e823980
commit 6fcb459550
45 changed files with 141 additions and 183 deletions
-31
View File
@@ -1,31 +0,0 @@
<?php
// header('Content-Type: application/json');
$name = $_POST["name"];
$birthday = $_POST["birthday"];
if(!is_numeric($birthday)) {
echo '생년월일이 숫자가 아닙니다.';
return;
} else if(strlen($birthday) != 6) {
echo '6자리 숫자값을 정확히 입력하세요 : YYMMDD (예 : 120131)';
return;
}
include "./connect_db.php";
$query = "INSERT INTO afterschool_user(UserID, Name, Birthday) values (null,?,?)";
$stmt = $db_conn->prepare($query);
$stmt->bind_param('ss', $name, $birthday);
$stmt->execute();
if($stmt->affected_rows > 0) {
echo("succeed");
} else {
echo "fail";
}
$db_conn->close();
?>
@@ -1,11 +0,0 @@
<?php
// header('Content-Type: application/json');
include "./connect_db.php";
$query = "DELETE FROM afterschool_record WHERE UserID=31;";
$result = $db_conn->query($query);
$db_conn->close();
?>
+2 -2
View File
@@ -48,7 +48,7 @@ function get_admin_id($adminName) {
$query = "
SELECT AdminID
FROM moty_admin
FROM admin
WHERE Name = ?
";
$stmt = $db_conn->prepare($query);
@@ -69,7 +69,7 @@ function login($adminName, $password) {
$query = "
SELECT AdminID, AccountType, ActivateStatus
FROM moty_admin
FROM admin
WHERE Name = ? AND Password = PASSWORD(?)
";
$stmt = $db_conn->prepare($query);
@@ -30,7 +30,7 @@ function get_maestro_list() {
$query = "
SELECT MaestroID, Name, AccountType
FROM moty_maestro
FROM maestro
WHERE ActivateStatus=0
ORDER BY MaestroID DESC
";
@@ -56,7 +56,7 @@ function get_maestro_list_by_name($maestroName) {
$query = "
SELECT MaestroID, Name, AccountType
FROM moty_maestro
FROM maestro
WHERE Name LIKE CONCAT('%', ?, '%') AND ActivateStatus=0
ORDER BY MaestroID DESC
";
@@ -30,7 +30,7 @@ function get_maestro_upgrade_list() {
$query = "
SELECT U.MaestroUpgradeID, U.MaestroID, M.Name, U.RegisteredAccountType, U.RequestedAccountType, U.RequestedDateTime, U.Status
FROM moty_maestro_upgrade U, moty_maestro M
FROM maestro_upgrade U, maestro M
WHERE U.Status < 2 AND U.MaestroID = M.MaestroID
ORDER BY U.MaestroUpgradeID DESC
";
@@ -60,7 +60,7 @@ function get_maestro_update_list_by_name($searchMaestroName) {
$query = "
SELECT U.MaestroUpgradeID, U.MaestroID, M.Name, U.RegisteredAccountType, U.RequestedAccountType, U.RequestedDateTime, U.Status
FROM moty_maestro_upgrade U, moty_maestro M
FROM maestro_upgrade U, maestro M
WHERE M.Name LIKE CONCAT('%', ?, '%') AND U.MaestroID = M.MaestroID
ORDER BY U.MaestroUpgradeID DESC
";
+4 -4
View File
@@ -38,7 +38,7 @@ function register_maestro($maestroID) {
global $db_conn;
$query = "
UPDATE moty_maestro
UPDATE maestro
SET ActivateStatus = 1, AvailableActivateDateTime = DATE_ADD(NOW(), INTERVAL 1 YEAR)
WHERE MaestroID = ?
";
@@ -53,7 +53,7 @@ function add_maestro_test_player($maestroID) {
global $db_conn;
$query = "
INSERT INTO moty_player (MaestroID, Name, EnterCode, AccountType)
INSERT INTO player (MaestroID, Name, EnterCode, AccountType)
VALUES (?, '마에스트로', '', 1)
";
$stmt = $db_conn->prepare($query);
@@ -66,7 +66,7 @@ function get_maestro_test_player($maestroID) {
$query = "
SELECT PlayerID
FROM moty_player
FROM player
WHERE MaestroID = ? AND AccountType = 1
";
$stmt = $db_conn->prepare($query);
@@ -83,7 +83,7 @@ function set_maestro_test_player($maestroID, $playerID) {
global $db_conn;
$query = "
UPDATE moty_maestro
UPDATE maestro
SET MaestroTestID = ?
WHERE MaestroID = ?
";
+3 -3
View File
@@ -26,7 +26,7 @@ function upgrade_maestro($maestroID, $newAccountType) {
global $db_conn;
$query = "
UPDATE moty_maestro
UPDATE maestro
SET AccountType = ?, ActivateStatus = 1, AvailableActivateDateTime = DATE_ADD(NOW(), INTERVAL 1 YEAR)
WHERE MaestroID = ?;
";
@@ -39,7 +39,7 @@ function change_upgrade_request_status_to_close($maestroID) {
global $db_conn;
$query = "
UPDATE moty_maestro_upgrade
UPDATE maestro_upgrade
SET Status = 2
WHERE MaestroID = ? AND Status = 1;
";
@@ -52,7 +52,7 @@ function change_upgrade_request_status_to_applied($maestroUpgradeID) {
global $db_conn;
$query = "
UPDATE moty_maestro_upgrade
UPDATE maestro_upgrade
SET Status = 3
WHERE MaestroUpgradeID = ?
";
+2 -2
View File
@@ -21,7 +21,7 @@ function activate_app($maestroID, $appID) {
global $db_conn;
$query = "
INSERT INTO moty_active_app (MaestroID, AppID)
INSERT INTO active_app (MaestroID, AppID)
VALUES (?, ?);
";
$stmt = $db_conn->prepare($query);
@@ -35,7 +35,7 @@ function get_app_name($appID) {
$query = "
SELECT AppName, KoreanName
FROM moty_app
FROM app
WHERE AppID = ?
";
$stmt = $db_conn->prepare($query);
+2 -2
View File
@@ -21,7 +21,7 @@ function deactivate_app($maestroID, $appID) {
global $db_conn;
$query = "
DELETE FROM moty_active_app
DELETE FROM active_app
WHERE MaestroID = ? AND AppID = ?;
";
$stmt = $db_conn->prepare($query);
@@ -35,7 +35,7 @@ function get_app_name($appID) {
$query = "
SELECT AppName, KoreanName
FROM moty_app
FROM app
WHERE AppID = ?
";
$stmt = $db_conn->prepare($query);
+1 -1
View File
@@ -23,7 +23,7 @@ function get_how_to_play($app_id) {
$query = "
SELECT HowToPlay
FROM moty_app
FROM app
WHERE AppID = ?;
";
$stmt = $db_conn->prepare($query);
+8 -8
View File
@@ -28,8 +28,8 @@ function get_mouse_app_list($maestro_id) {
$query = "
SELECT A.AppID, A.AppName, A.KoreanName, A.AppType
FROM moty_app AS A
INNER JOIN moty_active_app AS AA ON A.AppID = AA.AppID AND A.AppType = 100 AND AA.MaestroID=?";
FROM app AS A
INNER JOIN active_app AS AA ON A.AppID = AA.AppID AND A.AppType = 100 AND AA.MaestroID=?";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("i", $maestro_id);
$stmt->execute();
@@ -53,8 +53,8 @@ function get_typing_practice_app_count($maestro_id) {
$query = "
SELECT COUNT(*)
FROM moty_app AS A
INNER JOIN moty_active_app AS AA ON A.AppID = AA.AppID AND A.AppType <= 2 AND AA.MaestroID=?";
FROM app AS A
INNER JOIN active_app AS AA ON A.AppID = AA.AppID AND A.AppType <= 2 AND AA.MaestroID=?";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("i", $maestro_id);
$stmt->execute();
@@ -70,8 +70,8 @@ function get_typing_test_app_count($maestro_id) {
$query = "
SELECT COUNT(*)
FROM moty_app AS A
INNER JOIN moty_active_app AS AA ON A.AppID = AA.AppID AND A.AppType > 10 AND A.AppType <= 12 AND AA.MaestroID=?";
FROM app AS A
INNER JOIN active_app AS AA ON A.AppID = AA.AppID AND A.AppType > 10 AND A.AppType <= 12 AND AA.MaestroID=?";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("i", $maestro_id);
$stmt->execute();
@@ -87,8 +87,8 @@ function get_typing_app_list($maestro_id) {
$query = "
SELECT A.AppID, A.AppName, A.KoreanName, A.AppType
FROM moty_app AS A
INNER JOIN moty_active_app AS AA ON A.AppID = AA.AppID AND A.AppType = 50 AND AA.MaestroID=?";
FROM app AS A
INNER JOIN active_app AS AA ON A.AppID = AA.AppID AND A.AppType = 50 AND AA.MaestroID=?";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("i", $maestro_id);
$stmt->execute();
@@ -26,8 +26,8 @@ function get_active_typing_practice_app_list($maestro_id, $type) {
$query = "
SELECT A.AppID, A.AppName, A.KoreanName
FROM moty_app AS A
INNER JOIN moty_active_app AS AA
FROM app AS A
INNER JOIN active_app AS AA
ON A.AppID = AA.AppID AND AA.MaestroID = ? AND A.AppType = ?
ORDER BY A.AppID ASC";
$stmt = $db_conn->prepare($query);
@@ -26,8 +26,8 @@ function get_active_typing_practice_app_list($maestro_id, $type) {
$query = "
SELECT A.AppID, A.AppName, A.KoreanName
FROM moty_app AS A
INNER JOIN moty_active_app AS AA
FROM app AS A
INNER JOIN active_app AS AA
ON A.AppID = AA.AppID AND AA.MaestroID = ? AND A.AppType = ?
ORDER BY A.AppID ASC";
$stmt = $db_conn->prepare($query);
+3 -3
View File
@@ -27,7 +27,7 @@ function get_mouse_app_list() {
global $db_conn;
$query = "
SELECT AppID, AppName, KoreanName FROM moty_app
SELECT AppID, AppName, KoreanName FROM app
WHERE AppType=100
ORDER BY AppID ASC
";
@@ -51,8 +51,8 @@ function get_activated_mouse_app_list($maestroID) {
$query = "
SELECT A.AppID
FROM moty_app AS A
INNER JOIN moty_active_app AS AA ON A.AppID = AA.AppID AND A.AppType = 100 AND AA.MaestroID=?"
FROM app AS A
INNER JOIN active_app AS AA ON A.AppID = AA.AppID AND A.AppType = 100 AND AA.MaestroID=?"
;
$stmt = $db_conn->prepare($query);
$stmt->bind_param("i", $maestroID);
+3 -3
View File
@@ -27,7 +27,7 @@ function get_typing_app_list() {
global $db_conn;
$query = "
SELECT AppID, AppName, KoreanName FROM moty_app
SELECT AppID, AppName, KoreanName FROM app
WHERE AppType < 100
ORDER BY AppID ASC
";
@@ -51,8 +51,8 @@ function get_activated_typing_app_list($maestroID) {
$query = "
SELECT A.AppID
FROM moty_app AS A
INNER JOIN moty_active_app AS AA ON A.AppID = AA.AppID AND A.AppType < 100 AND AA.MaestroID=?"
FROM app AS A
INNER JOIN active_app AS AA ON A.AppID = AA.AppID AND A.AppType < 100 AND AA.MaestroID=?"
;
$stmt = $db_conn->prepare($query);
$stmt->bind_param("i", $maestroID);
+2 -2
View File
@@ -46,7 +46,7 @@ function has_maestro_name($maestroName) {
$query = "
SELECT MaestroID
FROM moty_maestro
FROM maestro
WHERE Name = ?
";
$stmt = $db_conn->prepare($query);
@@ -64,7 +64,7 @@ function add_maestro($maestro_name, $password, $email, $account_type) {
global $db_conn;
$query = "
INSERT INTO moty_maestro (Name, Password, Email, AccountType, ActivateStatus, PlayerCount, AcceptClausesDateTime, MaestroTestID)
INSERT INTO maestro (Name, Password, Email, AccountType, ActivateStatus, PlayerCount, AcceptClausesDateTime, MaestroTestID)
VALUES (?, PASSWORD(?), ?, ?, 0, 0, NOW(), -1)";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("sssi", $maestro_name, $password, $email, $account_type);
+1 -1
View File
@@ -23,7 +23,7 @@ exit;
function get_maestro_id($maestro_name) {
global $db_conn;
$query = "SELECT MaestroID FROM moty_maestro WHERE Name=?";
$query = "SELECT MaestroID FROM maestro WHERE Name=?";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("s", $maestro_name);
$stmt->execute();
@@ -27,7 +27,7 @@ function get_maestro_test_player_id($maestro_id) {
$query = "
SELECT MaestroTestID
FROM moty_maestro
FROM maestro
WHERE MaestroID = ?
";
$stmt = $db_conn->prepare($query);
@@ -48,7 +48,7 @@ function delete_maestro_test_player_record($player_id) {
$query = "
DELETE
FROM moty_best_record
FROM best_record
WHERE PlayerID = ?
";
$stmt = $db_conn->prepare($query);
+2 -2
View File
@@ -57,7 +57,7 @@ function get_maestro_id($maestroName) {
$query = "
SELECT MaestroID
FROM moty_maestro
FROM maestro
WHERE Name = ?
";
$stmt = $db_conn->prepare($query);
@@ -78,7 +78,7 @@ function login($maestroName, $password) {
$query = "
SELECT MaestroID, AccountType, ActivateStatus, AvailableActivateDateTime
FROM moty_maestro
FROM maestro
WHERE Name = ? AND Password = PASSWORD(?)
";
$stmt = $db_conn->prepare($query);
@@ -38,7 +38,7 @@ function get_maestro_experience_id() {
$query = "
SELECT MaestroID
FROM moty_maestro
FROM maestro
WHERE AccountType = 101
";
$stmt = $db_conn->prepare($query);
@@ -59,7 +59,7 @@ function get_maestro_test_player_id($maestro_id) {
$query = "
SELECT MaestroTestID
FROM moty_maestro
FROM maestro
WHERE MaestroID = ?
";
$stmt = $db_conn->prepare($query);
@@ -80,7 +80,7 @@ function get_maestro_test_player_name($player_id) {
$query = "
SELECT Name
FROM moty_player
FROM player
WHERE PlayerID = ?
";
$stmt = $db_conn->prepare($query);
@@ -106,7 +106,7 @@ function remove_maestro_sample_player_data($maestro_id) {
$query = "
DELETE
FROM moty_player
FROM player
WHERE MaestroID = ? AND AccountType = 0
";
$stmt = $db_conn->prepare($query);
@@ -127,7 +127,7 @@ function insert_maestro_sample_player_data($i, $maestro_id, $player) {
global $db_conn;
$query = "
INSERT INTO moty_player (MaestroID, Name, EnterCode, AccountType)
INSERT INTO player (MaestroID, Name, EnterCode, AccountType)
VALUES (?, ?, ?, ?)
";
$stmt = $db_conn->prepare($query);
@@ -172,7 +172,7 @@ function count_registered_player($maestroID) {
$query = "
SELECT COUNT(PlayerID)
FROM moty_player
FROM player
WHERE MaestroID = ? AND AccountType = 0
";
$stmt = $db_conn->prepare($query);
@@ -190,7 +190,7 @@ function update_count_registered_player($maestroID, $countPlayer) {
global $db_conn;
$query = "
UPDATE moty_maestro
UPDATE maestro
SET PlayerCount = ?
WHERE MaestroID = ?
";
+1 -1
View File
@@ -27,7 +27,7 @@ function get_maestro_info($maestroID) {
$query = "
SELECT Name, Email, AccountType, PlayerCount
FROM moty_maestro
FROM maestro
WHERE MaestroID = ?
";
$stmt = $db_conn->prepare($query);
@@ -30,7 +30,7 @@ function get_maestro_test_player_id($maestro_id) {
$query = "
SELECT AccountType, MaestroTestID
FROM moty_maestro
FROM maestro
WHERE MaestroID = ?
";
$stmt = $db_conn->prepare($query);
@@ -53,7 +53,7 @@ function get_maestro_test_player_info($player_id) {
$query = "
SELECT Name, AccountType
FROM moty_player
FROM player
WHERE PlayerID = ?
";
$stmt = $db_conn->prepare($query);
@@ -35,7 +35,7 @@ function count_maestro_upgrade($maestroID) {
$query = "
SELECT COUNT(MaestroID)
FROM moty_maestro_upgrade
FROM maestro_upgrade
WHERE MaestroID = ?
";
$stmt = $db_conn->prepare($query);
@@ -53,7 +53,7 @@ function add_maestro_update($maestroID, $registeredAcountType, $newAccountType)
global $db_conn;
$query = "
INSERT INTO moty_maestro_upgrade (RegisteredAccountType, RequestedAccountType, RequestedDateTime, Status, MaestroID)
INSERT INTO maestro_upgrade (RegisteredAccountType, RequestedAccountType, RequestedDateTime, Status, MaestroID)
VALUES (?, ?, NOW(), 1, ?);
";
$stmt = $db_conn->prepare($query);
@@ -19,7 +19,7 @@ function update_maestro_info($maestroID, $maestroName, $email) {
global $db_conn;
$query = "
UPDATE moty_maestro
UPDATE maestro
SET Name = ?, Email = ?
WHERE MaestroID = ?
";
@@ -27,7 +27,7 @@ function maestro_registered_password($maestro_id, $registeredPW) {
$query = "
SELECT COUNT(MaestroID)
FROM moty_maestro
FROM maestro
WHERE MaestroID = ? AND Password = PASSWORD(?)
";
$stmt = $db_conn->prepare($query);
@@ -45,7 +45,7 @@ function update_maestro_password($maestroID, $newPW) {
global $db_conn;
$query = "
UPDATE moty_maestro
UPDATE maestro
SET Password = PASSWORD(?)
WHERE MaestroID = ?
";
+7 -7
View File
@@ -57,7 +57,7 @@ function has_player_name($maestroID, $playerName, $enterCode) {
$query = "
SELECT PlayerID
FROM moty_player
FROM player
WHERE MaestroID = ? AND Name = ? AND EnterCode = ?
";
$stmt = $db_conn->prepare($query);
@@ -76,7 +76,7 @@ function get_maestro_account_type($maestroID) {
$query = "
SELECT AccountType
FROM moty_maestro
FROM maestro
WHERE MaestroID = ?
";
$stmt = $db_conn->prepare($query);
@@ -95,7 +95,7 @@ function get_player_count($maestroID) {
$query = "
SELECT PlayerCount
FROM moty_maestro
FROM maestro
WHERE MaestroID = ?
";
$stmt = $db_conn->prepare($query);
@@ -113,7 +113,7 @@ function add_player($maestroID, $playerName, $enterCode) {
global $db_conn;
$query = "
INSERT INTO moty_player (MaestroID, Name, EnterCode)
INSERT INTO player (MaestroID, Name, EnterCode)
VALUES (?, ?, ?)
";
$stmt = $db_conn->prepare($query);
@@ -125,7 +125,7 @@ function increase_player_count($maestroID, $count) {
global $db_conn;
$query = "
UPDATE moty_maestro
UPDATE maestro
SET PlayerCount = PlayerCount + ?
WHERE MaestroID = ?
";
@@ -139,7 +139,7 @@ function count_registered_player($maestroID) {
$query = "
SELECT COUNT(PlayerID)
FROM moty_player
FROM player
WHERE MaestroID = ? AND AccountType = 0
";
$stmt = $db_conn->prepare($query);
@@ -157,7 +157,7 @@ function update_count_registered_player($maestroID, $countPlayer) {
global $db_conn;
$query = "
UPDATE moty_maestro
UPDATE maestro
SET PlayerCount = ?
WHERE MaestroID = ?
";
+7 -7
View File
@@ -37,7 +37,7 @@ function deletePlayer($maestroID, $playerID) {
global $db_conn;
$query = "
DELETE FROM moty_best_record
DELETE FROM best_record
WHERE MaestroID = ? AND PlayerID = ?
";
$stmt = $db_conn->prepare($query);
@@ -50,7 +50,7 @@ function deletePlayer($maestroID, $playerID) {
// }
$query = "
DELETE FROM moty_player
DELETE FROM player
WHERE MaestroID = ? AND PlayerID = ?
";
$stmt = $db_conn->prepare($query);
@@ -68,7 +68,7 @@ function countPlayerID($maestroID, $playerID) {
$query = "
SELECT COUNT(PlayerID)
FROM moty_player
FROM player
WHERE MaestroID = ? AND PlayerID = ?
";
$stmt = $db_conn->prepare($query);
@@ -87,7 +87,7 @@ function countPlayerRecord($maestroID, $playerID) {
$query = "
SELECT COUNT(PlayerID)
FROM moty_best_record
FROM best_record
WHERE MaestroID = ? AND PlayerID = ?
";
$stmt = $db_conn->prepare($query);
@@ -105,7 +105,7 @@ function decrease_player_count($maestroID, $count) {
global $db_conn;
$query = "
UPDATE moty_maestro
UPDATE maestro
SET PlayerCount = PlayerCount - ?
WHERE MaestroID = ?
";
@@ -119,7 +119,7 @@ function count_registered_player($maestroID) {
$query = "
SELECT COUNT(PlayerID)
FROM moty_player
FROM player
WHERE MaestroID = ? AND AccountType = 0
";
$stmt = $db_conn->prepare($query);
@@ -137,7 +137,7 @@ function update_count_registered_player($maestroID, $countPlayer) {
global $db_conn;
$query = "
UPDATE moty_maestro
UPDATE maestro
SET PlayerCount = ?
WHERE MaestroID = ?
";
+3 -3
View File
@@ -42,7 +42,7 @@ exit;
function hasSamePlayerData($maestroID, $playerID, $playerName, $enterCode) {
global $db_conn;
$query = "SELECT COUNT(PlayerID) FROM moty_player WHERE MaestroID=? AND PlayerID<>? AND Name=? AND EnterCode=?";
$query = "SELECT COUNT(PlayerID) FROM player WHERE MaestroID=? AND PlayerID<>? AND Name=? AND EnterCode=?";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("iiss", $maestroID, $playerID, $playerName, $enterCode);
$stmt->execute();
@@ -57,7 +57,7 @@ function hasSamePlayerData($maestroID, $playerID, $playerName, $enterCode) {
function editPlayer($maestroID, $playerID, $playerName, $enterCode) {
global $db_conn;
$query = "UPDATE moty_player SET Name=?, EnterCode=? WHERE MaestroID=? AND PlayerID=?";
$query = "UPDATE player SET Name=?, EnterCode=? WHERE MaestroID=? AND PlayerID=?";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("ssii", $playerName, $enterCode, $maestroID, $playerID);
$stmt->execute();
@@ -66,7 +66,7 @@ function editPlayer($maestroID, $playerID, $playerName, $enterCode) {
function hasPlayerName($maestroID, $playerName, $enterCode) {
global $db_conn;
$query = "SELECT PlayerID FROM moty_player WHERE MaestroID=? AND Name=? AND EnterCode=?";
$query = "SELECT PlayerID FROM player WHERE MaestroID=? AND Name=? AND EnterCode=?";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("iss", $maestroID, $playerName, $enterCode);
$stmt->execute();
+2 -2
View File
@@ -44,7 +44,7 @@ function get_maestro_id($maestroName) {
$query = "
SELECT MaestroID, AccountType
FROM moty_maestro
FROM maestro
WHERE Name = ?
";
$stmt = $db_conn->prepare($query);
@@ -67,7 +67,7 @@ function get_login_data($maestroID, $name, $enterCode) {
$query = "
SELECT PlayerID, AccountType
FROM moty_player
FROM player
WHERE MaestroID = ? AND Name = ? AND EnterCode = ?
";
$stmt = $db_conn->prepare($query);
@@ -30,7 +30,7 @@ function get_experience_maestro_info() {
$query = "
SELECT MaestroID, MaestroTestID
FROM moty_maestro
FROM maestro
WHERE AccountType = 100
";
$stmt = $db_conn->prepare($query);
@@ -53,7 +53,7 @@ function get_maestro_test_player_info($maestro_id) {
$query = "
SELECT PlayerID, Name, AccountType
FROM moty_player
FROM player
WHERE MaestroID = ?
";
$stmt = $db_conn->prepare($query);
@@ -24,7 +24,7 @@ function getPlayerCount($maestroID) {
$query = "
SELECT COUNT(PlayerID)
FROM moty_player
FROM player
WHERE MaestroID = ? AND AccountType <> 1
";
$stmt = $db_conn->prepare($query);
@@ -25,7 +25,7 @@ function get_player_list_page($maestroID, $startNo, $endNo) {
global $db_conn;
$query = "
SELECT PlayerID, Name, EnterCode FROM moty_player
SELECT PlayerID, Name, EnterCode FROM player
WHERE MaestroID = ? AND AccountType <> 1
ORDER BY PlayerID DESC
LIMIT ?, 10;
@@ -24,7 +24,7 @@ function getPlayerCount($maestroID, $playerName) {
$query = "
SELECT COUNT(PlayerID)
FROM moty_player
FROM player
WHERE MaestroID = ? AND AccountType <> 1 AND Name LIKE CONCAT('%', ?, '%')
";
$stmt = $db_conn->prepare($query);
+1 -1
View File
@@ -26,7 +26,7 @@ function get_player_list_page($maestroID, $playerName, $startNo, $endNo) {
global $db_conn;
$query = "
SELECT PlayerID, Name, EnterCode FROM moty_player
SELECT PlayerID, Name, EnterCode FROM player
WHERE MaestroID = ? AND AccountType <> 1 AND Name LIKE CONCAT('%', ?, '%')
ORDER BY PlayerID DESC
LIMIT ?, 10;
+2 -2
View File
@@ -25,8 +25,8 @@ function get_history_record($maestro_id, $app_id, $player_id, $date) {
$query = "
SELECT DATE(BR.RecordDateTime) AS Date, MAX(BR.BestRecord) AS HighScore, AA.AppName AS AppName
FROM moty_best_record BR
INNER JOIN moty_app AS AA
FROM best_record BR
INNER JOIN app AS AA
ON BR.MaestroID = ? AND BR.PlayerID = ? AND DATE(BR.RecordDateTime) <= ? AND BR.AppID = ? AND BR.AppID = AA.AppID
GROUP BY DATE(BR.RecordDateTime)
ORDER BY BR.RecordDateTime DESC
+1 -1
View File
@@ -25,7 +25,7 @@ function get_ranking_record_day($maestro_id, $date, $app_id) {
$query = "
SELECT BR.playerID As PlayerID, U.Name AS Name, MAX(BR.BestRecord) AS HighScore
FROM moty_best_record BR, moty_player U
FROM best_record BR, player U
WHERE BR.MaestroID = ? AND BR.playerID = U.playerID AND DATE(BR.RecordDateTime) = ? AND AppID = ?
GROUP BY BR.playerID
ORDER BY max(BR.BestRecord) DESC;
@@ -24,7 +24,7 @@ function get_ranking_record_hour($maestro_id, $date, $time, $app_id) {
$query = "
SELECT BR.playerID As PlayerID, U.Name AS Name, MAX(BR.BestRecord) AS HighScore
FROM moty_best_record BR, moty_player U
FROM best_record BR, player U
WHERE BR.MaestroID = ? AND BR.playerID = U.playerID AND DATE(BR.RecordDateTime) = ? AND HOUR(BR.RecordDateTime) = HOUR(?) AND AppID = ?
GROUP BY BR.playerID
ORDER BY max(BR.BestRecord) DESC;
@@ -25,7 +25,7 @@ function get_ranking_record_month($maestro_id, $date, $time, $app_id) {
$query = "
SELECT BR.playerID As PlayerID, U.Name AS Name, MAX(BR.BestRecord) AS HighScore
FROM moty_best_record BR, moty_player U
FROM best_record BR, player U
WHERE BR.MaestroID = ? AND BR.playerID = U.playerID AND MONTH(BR.RecordDateTime) = MONTH(?) AND AppID = ?
GROUP BY BR.playerID
ORDER BY max(BR.BestRecord) DESC;
@@ -25,7 +25,7 @@ function get_best_record($maestro_id, $app_id, $player_id) {
$query = "
SELECT BestRecord
FROM moty_best_record
FROM best_record
WHERE MaestroID = ? AND AppID = ? AND PlayerID = ? AND DATE(RecordDateTime) = DATE(NOW())
";
$stmt = $db_conn->prepare($query);
+3 -3
View File
@@ -35,7 +35,7 @@ function get_best_record($maestro_id, $app_id, $player_id) {
$query = "
SELECT BestRecordID, BestRecord
FROM moty_best_record
FROM best_record
WHERE MaestroID = ? AND AppID = ? AND PlayerID = ? AND DATE(RecordDateTime) = DATE(NOW())
/*AND HOUR(RecordDateTime) = HOUR(NOW())*/
";
@@ -57,7 +57,7 @@ function insert_best_record($maestro_id, $app_id, $player_id, $best_record) {
global $db_conn;
$query = "
INSERT INTO moty_best_record (MaestroID, PlayerID, AppID, BestRecord, RecordDateTime)
INSERT INTO best_record (MaestroID, PlayerID, AppID, BestRecord, RecordDateTime)
VALUES (?, ?, ?, ?, NOW());
";
$stmt = $db_conn->prepare($query);
@@ -69,7 +69,7 @@ function update_best_record($prev_best_record_id, $best_record) {
global $db_conn;
$query = "
UPDATE moty_best_record
UPDATE best_record
SET BestRecord = ?, RecordDateTime = NOW()
WHERE BestRecordID = ? AND DATE(RecordDateTime) = DATE(NOW())
/* AND HOUR(RecordDateTime) = HOUR(NOW()) */
+3 -3
View File
@@ -6,9 +6,9 @@ if($hasServiceDBSetting == true) {
include("./../setup/service_db_setting.php");
} else {
$db_host = "localhost";
$db_user = "afterschool";
$db_user = "moty";
$db_passwd = "sEobMPuJ2A8KTfwU";
$db_name = "jisangs";
$db_name = "moty";
}
@@ -19,7 +19,7 @@ if ($db_conn->connect_error) {
send_result_fail();
exit;
} else {
$query = "USE jisangs";
$query = "USE moty";
$result = mysqli_query($db_conn, $query);
}
+22 -22
View File
@@ -1,6 +1,6 @@
USE jisangs;
USE moty;
INSERT INTO `moty_active_app` (`ActiveAppID`, `MaestroID`, `AppID`) VALUES
INSERT INTO `active_app` (`ActiveAppID`, `MaestroID`, `AppID`) VALUES
(1, 1, 101),
(2, 1, 102),
(3, 1, 1),
@@ -21,23 +21,23 @@ INSERT INTO `moty_active_app` (`ActiveAppID`, `MaestroID`, `AppID`) VALUES
(18, 1, 30),
(19, 1, 39),
(20, 1, 40),
(21, 3, 101),
(22, 3, 102),
(23, 3, 1),
(24, 3, 2),
(25, 3, 3),
(26, 3, 4),
(27, 3, 5),
(28, 3, 6),
(29, 3, 7),
(30, 3, 8),
(31, 3, 11),
(32, 3, 12),
(33, 3, 13),
(34, 3, 14),
(35, 3, 15),
(36, 3, 16),
(37, 3, 29),
(38, 3, 30),
(39, 3, 39),
(40, 3, 40);
(21, 2, 101),
(22, 2, 102),
(23, 2, 1),
(24, 2, 2),
(25, 2, 3),
(26, 2, 4),
(27, 2, 5),
(28, 2, 6),
(29, 2, 7),
(30, 2, 8),
(31, 2, 11),
(32, 2, 12),
(33, 2, 13),
(34, 2, 14),
(35, 2, 15),
(36, 2, 16),
(37, 2, 29),
(38, 2, 30),
(39, 2, 39),
(40, 2, 40);
+2 -2
View File
@@ -1,6 +1,6 @@
USE jisangs;
USE moty;
INSERT INTO `moty_app` (`AppID`, `AppName`, `KoreanName`, `AppType`, `HowToPlay`) VALUES
INSERT INTO `app` (`AppID`, `AppName`, `KoreanName`, `AppType`, `HowToPlay`) VALUES
(1, 'practice_korean_basic', '기본 자리', 1, ''),
(2, 'practice_korean_left_upper', '왼손 윗글쇠', 1, ''),
(3, 'practice_korean_second_finger', '검지 글쇠', 1, ''),
+4 -4
View File
@@ -1,13 +1,13 @@
USE jisangs;
USE moty;
INSERT INTO `moty_maestro` (`MaestroID`, `Name`, `Password`, `Email`, `AccountType`, `ActivateStatus`, `AvailableActivateDateTime`, `PlayerCount`, `AcceptClausesDateTime`, `MaestroTestID`) VALUES
INSERT INTO `maestro` (`MaestroID`, `Name`, `Password`, `Email`, `AccountType`, `ActivateStatus`, `AvailableActivateDateTime`, `PlayerCount`, `AcceptClausesDateTime`, `MaestroTestID`) VALUES
(1, 'testplayer', '', 'test@jinaju.com', 100, 1, '2100-12-31 00:00:00', 0, '2018-05-27 17:13:35', 1),
(2, '마에스트로 체험', '', 'test@jinaju.com', 101, 1, '2100-12-31 00:00:00', 0, '2018-07-08 00:00:00', 2);
INSERT INTO `moty_player` (`PlayerID`, `MaestroID`, `Name`, `EnterCode`, `AccountType`) VALUES
INSERT INTO `player` (`PlayerID`, `MaestroID`, `Name`, `EnterCode`, `AccountType`) VALUES
(1, 1, '학생 체험', '', 0),
(2, 2, '마에스트로', '', 0);
INSERT INTO `moty_admin` (`AdminID`, `Name`, `Password`, `Email`, `AccountType`, `ActivateStatus`) VALUES
INSERT INTO `admin` (`AdminID`, `Name`, `Password`, `Email`, `AccountType`, `ActivateStatus`) VALUES
(1, 'jisangs', '*F2012B4E7A22EED437B79FB53DBF79C8AAC5034B', 'jisangs@gmail.com', 1, 1);
+18 -18
View File
@@ -1,4 +1,4 @@
CREATE TABLE moty_admin (
CREATE TABLE admin (
AdminID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
Name CHAR(50) NOT NULL,
Password CHAR(50) NOT NULL,
@@ -7,7 +7,7 @@ CREATE TABLE moty_admin (
ActivateStatus INT UNSIGNED NOT NULL
);
CREATE TABLE moty_maestro (
CREATE TABLE maestro (
MaestroID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
Name CHAR(50) NOT NULL,
Password CHAR(50) NOT NULL,
@@ -20,7 +20,7 @@ CREATE TABLE moty_maestro (
MaestroTestID INT UNSIGNED
);
CREATE TABLE moty_maestro_upgrade (
CREATE TABLE maestro_upgrade (
MaestroUpgradeID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
RegisteredAccountType INT UNSIGNED NOT NULL,
RequestedAccountType INT UNSIGNED NOT NULL,
@@ -28,22 +28,22 @@ CREATE TABLE moty_maestro_upgrade (
Status INT UNSIGNED NOT NULL,
MaestroID INT UNSIGNED NOT NULL,
FOREIGN KEY (MaestroID) REFERENCES moty_maestro(MaestroID)
FOREIGN KEY (MaestroID) REFERENCES maestro(MaestroID)
);
CREATE TABLE moty_player (
CREATE TABLE player (
PlayerID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
MaestroID INT UNSIGNED NOT NULL,
Name CHAR(50) NOT NULL,
EnterCode CHAR(6) NOT NULL,
AccountType INT UNSIGNED NOT NULL,
FOREIGN KEY (MaestroID) REFERENCES moty_maestro(MaestroID)
FOREIGN KEY (MaestroID) REFERENCES maestro(MaestroID)
);
CREATE TABLE moty_app (
CREATE TABLE app (
AppID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
AppName CHAR(40) NOT NULL,
KoreanName CHAR(40) NOT NULL,
@@ -51,18 +51,18 @@ CREATE TABLE moty_app (
HowToPlay TEXT NOT NULL
);
CREATE TABLE moty_active_app (
CREATE TABLE active_app (
ActiveAppID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
MaestroID INT UNSIGNED NOT NULL,
AppID INT UNSIGNED NOT NULL,
FOREIGN KEY (MaestroID) REFERENCES moty_maestro(MaestroID),
FOREIGN KEY (AppID) REFERENCES moty_app(AppID)
FOREIGN KEY (MaestroID) REFERENCES maestro(MaestroID),
FOREIGN KEY (AppID) REFERENCES app(AppID)
);
CREATE TABLE moty_best_record (
CREATE TABLE best_record (
BestRecordID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
MaestroID INT UNSIGNED NOT NULL,
AppID INT UNSIGNED NOT NULL,
@@ -70,12 +70,12 @@ CREATE TABLE moty_best_record (
BestRecord FLOAT NOT NULL,
RecordDateTime DATETIME NOT NULL,
FOREIGN KEY (MaestroID) REFERENCES moty_maestro(MaestroID),
FOREIGN KEY (AppID) REFERENCES moty_app(AppID),
FOREIGN KEY (PlayerID) REFERENCES moty_player(PlayerID)
FOREIGN KEY (MaestroID) REFERENCES maestro(MaestroID),
FOREIGN KEY (AppID) REFERENCES app(AppID),
FOREIGN KEY (PlayerID) REFERENCES player(PlayerID)
);
CREATE TABLE moty_ranking (
CREATE TABLE ranking (
RankingID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
MaestroID INT UNSIGNED NOT NULL,
AppID INT UNSIGNED NOT NULL,
@@ -83,7 +83,7 @@ CREATE TABLE moty_ranking (
Rank INT UNSIGNED NOT NULL,
PlayerID INT UNSIGNED NOT NULL,
FOREIGN KEY (MaestroID) REFERENCES moty_maestro(MaestroID),
FOREIGN KEY (AppID) REFERENCES moty_app(AppID),
FOREIGN KEY (PlayerID) REFERENCES moty_player(PlayerID)
FOREIGN KEY (MaestroID) REFERENCES maestro(MaestroID),
FOREIGN KEY (AppID) REFERENCES app(AppID),
FOREIGN KEY (PlayerID) REFERENCES player(PlayerID)
);