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);
}