Fix: DB user column -> player

This commit is contained in:
2018-07-04 21:54:29 +09:00
parent 81860d6800
commit dc87390b8c
26 changed files with 132 additions and 132 deletions
+2 -2
View File
@@ -24,7 +24,7 @@ let sessionStorageManager = new SessionStorageManager();
{ {
// if(isDebugMode()) { // if(isDebugMode()) {
// sessionStorageManager.playerName = "부현율"; // sessionStorageManager.playerName = "부현율";
// sessionStorageManager.playerUserID = 8; // sessionStorageManager.playerID = 8;
// sessionStorageManager.playingAppID = 101; // sessionStorageManager.playingAppID = 101;
// sessionStorageManager.playingAppName = "space_invaders"; // sessionStorageManager.playingAppName = "space_invaders";
// sessionStorageManager.score = 1000; // sessionStorageManager.score = 1000;
@@ -33,7 +33,7 @@ let sessionStorageManager = new SessionStorageManager();
console.log("maestroID : " + sessionStorageManager.maestroID); console.log("maestroID : " + sessionStorageManager.maestroID);
console.log("playerName : " + sessionStorageManager.playerName); console.log("playerName : " + sessionStorageManager.playerName);
console.log("playerUserID : " + sessionStorageManager.playerUserID); console.log("playerID : " + sessionStorageManager.playerID);
console.log("playingAppID : " + sessionStorageManager.playingAppID); console.log("playingAppID : " + sessionStorageManager.playingAppID);
console.log("playingAppName : " + sessionStorageManager.playingAppName); console.log("playingAppName : " + sessionStorageManager.playingAppName);
console.log("playingAppKoreanName : " + sessionStorageManager.playingAppKoreanName); console.log("playingAppKoreanName : " + sessionStorageManager.playingAppKoreanName);
+14 -14
View File
@@ -6,7 +6,7 @@ class DBConnectManager {
this.phpPath = this.getPHPPath(this.directoryName); this.phpPath = this.getPHPPath(this.directoryName);
this.maestroID = 0; this.maestroID = 0;
this.playerUserID = 0; this.playerID = 0;
this.appName = ""; this.appName = "";
this.dateAndTime = null; this.dateAndTime = null;
} }
@@ -15,8 +15,8 @@ class DBConnectManager {
this.maestroID = maestroID; this.maestroID = maestroID;
} }
setPlayerID(userID) { setPlayerID(playerID) {
this.playerUserID = userID; this.playerID = playerID;
} }
setAppName(appName) { setAppName(appName) {
@@ -47,21 +47,21 @@ class DBConnectManager {
return "../"; return "../";
} }
requestCheckUserLogin(maestroName, userName, enterCode, onSucceededListener, onFailedListener) { requestCheckPlayerLogin(maestroName, playerName, enterCode, onSucceededListener, onFailedListener) {
let xhr = new XMLHttpRequest(); let xhr = new XMLHttpRequest();
xhr.open("POST", this.phpPath + "server/user/login.php", true); xhr.open("POST", this.phpPath + "server/player/login.php", true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() { xhr.onreadystatechange = function() {
if(xhr.readyState == 4 && xhr.status == 200) { if(xhr.readyState == 4 && xhr.status == 200) {
let replyJSON = JSON.parse(xhr.responseText); let replyJSON = JSON.parse(xhr.responseText);
if(replyJSON != null && replyJSON["UserID"] != null) if(replyJSON != null && replyJSON["PlayerID"] != null)
onSucceededListener(replyJSON); onSucceededListener(replyJSON);
else else
onFailedListener(replyJSON); onFailedListener(replyJSON);
} }
}; };
xhr.send("maestro_name=" + maestroName + "&name=" + userName + "&enter_code=" + enterCode); xhr.send("maestro_name=" + maestroName + "&name=" + playerName + "&enter_code=" + enterCode);
} }
/* /*
@@ -182,7 +182,7 @@ class DBConnectManager {
}; };
let params = "MaestroID=" + sessionStorageManager.maestroID let params = "MaestroID=" + sessionStorageManager.maestroID
+ "&AppID=" + sessionStorageManager.playingAppID + "&AppID=" + sessionStorageManager.playingAppID
+ "&UserID=" + sessionStorageManager.playerUserID + "&PlayerID=" + sessionStorageManager.playerID
+ "&Date=" + date; + "&Date=" + date;
xhr.send(params); xhr.send(params);
} }
@@ -321,7 +321,7 @@ class DBConnectManager {
for(let i = 0; i < count; i++) { for(let i = 0; i < count; i++) {
let record = new RankingRecord( let record = new RankingRecord(
i + 1, i + 1,
replyJSON[i]["UserID"], replyJSON[i]["PlayerID"],
replyJSON[i]["Name"], replyJSON[i]["Name"],
replyJSON[i]["HighScore"] replyJSON[i]["HighScore"]
); );
@@ -342,7 +342,7 @@ class DBConnectManager {
if(xhr.readyState == 4 && xhr.status == 200) { if(xhr.readyState == 4 && xhr.status == 200) {
let replyJSON = JSON.parse(xhr.responseText); let replyJSON = JSON.parse(xhr.responseText);
if(replyJSON != null && replyJSON["UserID"] != null) if(replyJSON != null && replyJSON["PlayerID"] != null)
onSucceededListener(replyJSON); onSucceededListener(replyJSON);
else else
onFailedListener(replyJSON); onFailedListener(replyJSON);
@@ -369,19 +369,19 @@ class DBConnectManager {
xhr.send("AppID=" + appID); xhr.send("AppID=" + appID);
} }
updateTodayBestRecord(maestroID, userID, appID, record) { updateTodayBestRecord(maestroID, playerID, appID, record) {
let xhr = new XMLHttpRequest(); let xhr = new XMLHttpRequest();
xhr.open("POST", this.phpPath + "server/record/update_best_record.php", true); xhr.open("POST", this.phpPath + "server/record/update_best_record.php", true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send( xhr.send(
"MaestroID=" + maestroID "MaestroID=" + maestroID
+ "&UserID=" + userID + "&PlayerID=" + playerID
+ "&AppID=" + appID + "&AppID=" + appID
+ "&BestRecord=" + record + "&BestRecord=" + record
); );
} }
requestTodayBestRecord(maestroID, userID, appID, onSucceededListener, onFailedListener) { requestTodayBestRecord(maestroID, playerID, appID, onSucceededListener, onFailedListener) {
let xhr = new XMLHttpRequest(); let xhr = new XMLHttpRequest();
xhr.open("POST", this.phpPath + "server/record/request_best_record.php", true); xhr.open("POST", this.phpPath + "server/record/request_best_record.php", true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
@@ -397,7 +397,7 @@ class DBConnectManager {
}; };
xhr.send( xhr.send(
"MaestroID=" + maestroID "MaestroID=" + maestroID
+ "&UserID=" + userID + "&PlayerID=" + playerID
+ "&AppID=" + appID + "&AppID=" + appID
); );
} }
+7 -7
View File
@@ -1,9 +1,9 @@
class RankingRecord { class RankingRecord {
constructor(rank, userID, userName, bestRecord) { constructor(rank, playerID, playerName, bestRecord) {
this.rank = rank; this.rank = rank;
this.userID = userID; this.playerID = playerID;
this.userName = userName; this.playerName = playerName;
this.bestRecord = bestRecord; this.bestRecord = bestRecord;
} }
} }
@@ -36,12 +36,12 @@ class RankingRecordManager {
return this.rankingRecords[index].rank; return this.rankingRecords[index].rank;
} }
getUserIDAt(index) { getPlayerIDAt(index) {
return this.rankingRecords[index].userID; return this.rankingRecords[index].playerID;
} }
getUserNameAt(index) { getPlayerNameAt(index) {
return this.rankingRecords[index].userName; return this.rankingRecords[index].playerName;
} }
getBestRecordAt(index) { getBestRecordAt(index) {
+6 -6
View File
@@ -11,7 +11,7 @@ class SessionStorageManager {
return sessionStorage.removeItem(key); return sessionStorage.removeItem(key);
} }
// maestro user ID // maestro ID
set maestroID(value) { set maestroID(value) {
sessionStorage.setItem("maestroID", value); sessionStorage.setItem("maestroID", value);
} }
@@ -27,12 +27,12 @@ class SessionStorageManager {
return sessionStorage.getItem("playerName"); return sessionStorage.getItem("playerName");
} }
// player user ID // player player ID
set playerUserID(value) { set playerID(value) {
sessionStorage.setItem("playerUserID", value); sessionStorage.setItem("playerID", value);
} }
get playerUserID() { get playerID() {
return sessionStorage.getItem("playerUserID"); return sessionStorage.getItem("playerID");
} }
// playing app id // playing app id
+5 -2
View File
@@ -90,7 +90,7 @@ class Login {
let enterCode = self.inputTextEnterCode.canvasInput._value; let enterCode = self.inputTextEnterCode.canvasInput._value;
let dbConnectManager = new DBConnectManager(); let dbConnectManager = new DBConnectManager();
dbConnectManager.requestCheckUserLogin( dbConnectManager.requestCheckPlayerLogin(
maestroName, maestroName,
sessionStorageManager.playerName, sessionStorageManager.playerName,
enterCode, enterCode,
@@ -101,10 +101,13 @@ class Login {
loginSucceeded(jsonData) { loginSucceeded(jsonData) {
sessionStorageManager.maestroID = jsonData['MaestroID']; sessionStorageManager.maestroID = jsonData['MaestroID'];
sessionStorageManager.playerUserID = jsonData['UserID']; sessionStorageManager.playerID = jsonData['PlayerID'];
sessionStorageManager.playingAppName = "menu"; sessionStorageManager.playingAppName = "menu";
location.href = '../../web/client/menu_app.html'; location.href = '../../web/client/menu_app.html';
// console.log("===== after login =====");
// console.log(sessionStorageManager.playerID);
} }
loginFailed(jsonData) { loginFailed(jsonData) {
+5 -5
View File
@@ -37,12 +37,12 @@ class RankingBoard {
} }
getMyRank(rankingRecordManager) { getMyRank(rankingRecordManager) {
let playerUserID = Number(sessionStorageManager.playerUserID); let playerID = Number(sessionStorageManager.playerID);
for(let i = 0; i < rankingRecordManager.count; i++) { for(let i = 0; i < rankingRecordManager.count; i++) {
let data = rankingRecordManager.getAt(i); let data = rankingRecordManager.getAt(i);
let userID = Number(data["userID"]); let playerIDNo = Number(data["playerID"]);
if(userID === playerUserID) if(playerIDNo === playerID)
return i + 1; return i + 1;
} }
@@ -109,8 +109,8 @@ class RankingBoard {
.setTextBounds(0, 0, 40, 40) .setTextBounds(0, 0, 40, 40)
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2); .setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
// user name // player name
game.add.text(this.getPosX(type) + 60, this.getPosY(index), data.userName, style) game.add.text(this.getPosX(type) + 60, this.getPosY(index), data.playerName, style)
.setTextBounds(0, 0, 60, 60) .setTextBounds(0, 0, 60, 60)
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2); .setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
+1 -1
View File
@@ -86,7 +86,7 @@ class Result {
uploadRecord() { uploadRecord() {
this.dbConnectManager.updateTodayBestRecord( this.dbConnectManager.updateTodayBestRecord(
sessionStorageManager.maestroID, sessionStorageManager.maestroID,
sessionStorageManager.playerUserID, sessionStorageManager.playerID,
sessionStorageManager.playingAppID, sessionStorageManager.playingAppID,
sessionStorageManager.record sessionStorageManager.record
); );
+1 -1
View File
@@ -73,7 +73,7 @@ class Start {
this.dbConnectManager.requestTodayBestRecord( this.dbConnectManager.requestTodayBestRecord(
sessionStorageManager.maestroID, sessionStorageManager.maestroID,
sessionStorageManager.playerUserID, sessionStorageManager.playerID,
sessionStorageManager.playingAppID, sessionStorageManager.playingAppID,
replyJSON => { replyJSON => {
sessionStorageManager.bestRecord = Number(replyJSON["BestRecord"]); sessionStorageManager.bestRecord = Number(replyJSON["BestRecord"]);
+1 -1
View File
@@ -69,7 +69,7 @@ class PlayerList {
$(this.listRows[i].playerID).empty(); $(this.listRows[i].playerID).empty();
if(i < jsonData.length) { if(i < jsonData.length) {
$(this.listRows[i].playerID).append(jsonData[i]["UserID"]); $(this.listRows[i].playerID).append(jsonData[i]["PlayerID"]);
$(this.listRows[i].playerName).val(jsonData[i]["Name"]); $(this.listRows[i].playerName).val(jsonData[i]["Name"]);
$(this.listRows[i].enterCode).val(jsonData[i]["EnterCode"]); $(this.listRows[i].enterCode).val(jsonData[i]["EnterCode"]);
+8 -8
View File
@@ -21,7 +21,7 @@
let self = this; let self = this;
let xhr = new XMLHttpRequest(); //new로 생성. let xhr = new XMLHttpRequest(); //new로 생성.
xhr.open('POST', './../server/user/registered_player_count.php', true); xhr.open('POST', './../server/player/registered_player_count.php', true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send("maestro_id=" + maestroID); xhr.send("maestro_id=" + maestroID);
xhr.onload = function() { xhr.onload = function() {
@@ -70,7 +70,7 @@
let endNo = pageIndex * 10 + 9; let endNo = pageIndex * 10 + 9;
let xhr = new XMLHttpRequest(); //new로 생성. let xhr = new XMLHttpRequest(); //new로 생성.
xhr.open('POST', './../server/user/registered_player_list.php', true); xhr.open('POST', './../server/player/registered_player_list.php', true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send("maestro_id=" + maestroID + "&start_no=" + startNo + "&end_no=" + endNo); xhr.send("maestro_id=" + maestroID + "&start_no=" + startNo + "&end_no=" + endNo);
xhr.onload = function() { xhr.onload = function() {
@@ -119,7 +119,7 @@
let endNo = pageIndex * 10 + 9; let endNo = pageIndex * 10 + 9;
let xhr = new XMLHttpRequest(); //new로 생성. let xhr = new XMLHttpRequest(); //new로 생성.
xhr.open('POST', './../server/user/registered_player_list.php', true); xhr.open('POST', './../server/player/registered_player_list.php', true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send("maestro_id=" + maestroID + "&start_no=" + startNo + "&end_no=" + endNo); xhr.send("maestro_id=" + maestroID + "&start_no=" + startNo + "&end_no=" + endNo);
xhr.onload = function() { xhr.onload = function() {
@@ -153,7 +153,7 @@
self.list.updatePlayerList(replyJSON["PlayerList"]); self.list.updatePlayerList(replyJSON["PlayerList"]);
self.playerCount = replyJSON["PlayerList"].length; self.playerCount = replyJSON["PlayerList"].length;
console.log(self.playerCount); // console.log(self.playerCount);
// self.lastPageNo = Math.ceil( (self.playerCount + 1) / 10 ); // self.lastPageNo = Math.ceil( (self.playerCount + 1) / 10 );
// self.activePageNo = 1; // self.activePageNo = 1;
@@ -168,7 +168,7 @@
let self = this; let self = this;
let xhr = new XMLHttpRequest(); //new로 생성. let xhr = new XMLHttpRequest(); //new로 생성.
xhr.open('POST', './../server/user/search_player_count.php', true); xhr.open('POST', './../server/player/search_player_count.php', true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send("maestro_id=" + maestroID + "&player_name=" + playerName); xhr.send("maestro_id=" + maestroID + "&player_name=" + playerName);
xhr.onload = function() { xhr.onload = function() {
@@ -216,7 +216,7 @@
let endNo = pageIndex * 10 + 9; let endNo = pageIndex * 10 + 9;
let xhr = new XMLHttpRequest(); //new로 생성. let xhr = new XMLHttpRequest(); //new로 생성.
xhr.open('POST', './../server/user/search_player_list.php', true); xhr.open('POST', './../server/player/search_player_list.php', true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send("maestro_id=" + maestroID + "&player_name=" + playerName + "&start_no=" + startNo + "&end_no=" + endNo); xhr.send("maestro_id=" + maestroID + "&player_name=" + playerName + "&start_no=" + startNo + "&end_no=" + endNo);
xhr.onload = function() { xhr.onload = function() {
@@ -306,7 +306,7 @@
// console.log(playerEnterCode); // console.log(playerEnterCode);
let xhr = new XMLHttpRequest(); //new로 생성. let xhr = new XMLHttpRequest(); //new로 생성.
xhr.open('POST', './../server/user/edit_player.php', true); xhr.open('POST', './../server/player/edit_player.php', true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send("maestro_id=" + maestroID + "&player_id=" + playerID + "&player_name=" + playerName + "&enter_code=" + playerEnterCode); xhr.send("maestro_id=" + maestroID + "&player_id=" + playerID + "&player_name=" + playerName + "&enter_code=" + playerEnterCode);
xhr.onload = function() { xhr.onload = function() {
@@ -359,7 +359,7 @@
return; return;
let xhr = new XMLHttpRequest(); //new로 생성. let xhr = new XMLHttpRequest(); //new로 생성.
xhr.open('POST', './../server/user/delete_player.php', true); xhr.open('POST', './../server/player/delete_player.php', true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send("maestro_id=" + maestroID + "&player_id=" + playerID); xhr.send("maestro_id=" + maestroID + "&player_id=" + playerID);
xhr.onload = function() { xhr.onload = function() {
@@ -25,7 +25,7 @@ function addPlayer() {
} }
let xhr = new XMLHttpRequest(); //new로 생성. let xhr = new XMLHttpRequest(); //new로 생성.
xhr.open('POST', './../server/user/add_player.php', true); xhr.open('POST', './../server/player/add_player.php', true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send("maestro_id=" + maestroID + "&player_name=" + playerName + "&enter_code=" + enterCode); xhr.send("maestro_id=" + maestroID + "&player_name=" + playerName + "&enter_code=" + enterCode);
xhr.onload = function() { xhr.onload = function() {
@@ -84,14 +84,14 @@ function addPlayer() {
<!-- <!--
<h3>단체 추가</h3> <h3>단체 추가</h3>
<form action="/action_page.php" method="get" id="add_users"> <form action="/action_page.php" method="get" id="add_players">
<textarea> <textarea>
엑셀에서 아래와 같이 셀에 입력한 후에 복사하고 붙여넣기 엑셀에서 아래와 같이 셀에 입력한 후에 복사하고 붙여넣기
학생 이름 | 입장 코드 학생 이름 | 입장 코드
학생 이름 | 입장 코드 학생 이름 | 입장 코드
... ...
</textarea> </textarea>
<button type="submit" form="add_users">추가</button> <button type="submit" form="add_players">추가</button>
</form> </form>
<textarea> <textarea>
@@ -41,23 +41,22 @@ if($result === null) {
function hasPlayerName($maestroID, $playerName, $enterCode) { function hasPlayerName($maestroID, $playerName, $enterCode) {
global $db_conn; global $db_conn;
$query = "SELECT UserID FROM moty_user WHERE MaestroID=? AND Name=? AND EnterCode=?"; $query = "SELECT PlayerID FROM moty_player WHERE MaestroID=? AND Name=? AND EnterCode=?";
$stmt = $db_conn->prepare($query); $stmt = $db_conn->prepare($query);
$stmt->bind_param('iss', $maestroID, $playerName, $enterCode); $stmt->bind_param('iss', $maestroID, $playerName, $enterCode);
$stmt->execute(); $stmt->execute();
$stmt->bind_result($userID); $stmt->bind_result($playerID);
// while($stmt->fetch()) // while($stmt->fetch())
$stmt->fetch(); $stmt->fetch();
$stmt->close(); $stmt->close();
// $replyJSON["UserID"] = $userID; return $playerID;
return $userID;
} }
function addPlayer($maestroID, $playerName, $enterCode) { function addPlayer($maestroID, $playerName, $enterCode) {
global $db_conn; global $db_conn;
$query = "INSERT INTO moty_user (MaestroID, Name, EnterCode) VALUES (?, ?, ?)"; $query = "INSERT INTO moty_player (MaestroID, Name, EnterCode) VALUES (?, ?, ?)";
$stmt = $db_conn->prepare($query); $stmt = $db_conn->prepare($query);
$stmt->bind_param('iss', $maestroID, $playerName, $enterCode); $stmt->bind_param('iss', $maestroID, $playerName, $enterCode);
$stmt->execute(); $stmt->execute();
@@ -37,7 +37,7 @@ $db_conn->close();
function deletePlayer($maestroID, $playerID) { function deletePlayer($maestroID, $playerID) {
global $db_conn; global $db_conn;
$query = "DELETE FROM moty_best_record WHERE MaestroID = ? AND UserID = ?"; $query = "DELETE FROM moty_best_record WHERE MaestroID = ? AND PlayerID = ?";
$stmt = $db_conn->prepare($query); $stmt = $db_conn->prepare($query);
$stmt->bind_param('ii', $maestroID, $playerID); $stmt->bind_param('ii', $maestroID, $playerID);
$result = $stmt->execute(); $result = $stmt->execute();
@@ -47,7 +47,7 @@ function deletePlayer($maestroID, $playerID) {
// echo "deleted row count : ".$stmt->affected_rows; // echo "deleted row count : ".$stmt->affected_rows;
// } // }
$query = "DELETE FROM moty_user WHERE MaestroID = ? AND UserID = ?"; $query = "DELETE FROM moty_player WHERE MaestroID = ? AND PlayerID = ?";
$stmt = $db_conn->prepare($query); $stmt = $db_conn->prepare($query);
$stmt->bind_param('ii', $maestroID, $playerID); $stmt->bind_param('ii', $maestroID, $playerID);
$result = $stmt->execute(); $result = $stmt->execute();
@@ -61,16 +61,16 @@ function deletePlayer($maestroID, $playerID) {
function hasPlayerID($maestroID, $playerID) { function hasPlayerID($maestroID, $playerID) {
global $db_conn; global $db_conn;
$query = "SELECT UserID FROM moty_user WHERE MaestroID=? AND UserID=?"; $query = "SELECT PlayerID FROM moty_player WHERE MaestroID=? AND PlayerID=?";
$stmt = $db_conn->prepare($query); $stmt = $db_conn->prepare($query);
$stmt->bind_param('ii', $maestroID, $playerID); $stmt->bind_param('ii', $maestroID, $playerID);
$stmt->execute(); $stmt->execute();
$stmt->bind_result($userID); $stmt->bind_result($playerID);
// while($stmt->fetch()) // while($stmt->fetch())
$stmt->fetch(); $stmt->fetch();
$stmt->close(); $stmt->close();
if($userID !== null) if($playerID !== null)
return true; return true;
return false; return false;
@@ -79,16 +79,16 @@ function hasPlayerID($maestroID, $playerID) {
function hasPlayerRecord($maestroID, $playerID) { function hasPlayerRecord($maestroID, $playerID) {
global $db_conn; global $db_conn;
$query = "SELECT UserID FROM moty_best_record WHERE MaestroID=? AND UserID=?"; $query = "SELECT PlayerID FROM moty_best_record WHERE MaestroID=? AND PlayerID=?";
$stmt = $db_conn->prepare($query); $stmt = $db_conn->prepare($query);
$stmt->bind_param('ii', $maestroID, $playerID); $stmt->bind_param('ii', $maestroID, $playerID);
$stmt->execute(); $stmt->execute();
$stmt->bind_result($userID); $stmt->bind_result($playerID);
// while($stmt->fetch()) // while($stmt->fetch())
$stmt->fetch(); $stmt->fetch();
$stmt->close(); $stmt->close();
if($userID !== null) if($playerID !== null)
return true; return true;
return false; return false;
@@ -39,23 +39,22 @@ $db_conn->close();
function hasSamePlayerData($maestroID, $playerID, $playerName, $enterCode) { function hasSamePlayerData($maestroID, $playerID, $playerName, $enterCode) {
global $db_conn; global $db_conn;
$query = "SELECT UserID FROM moty_user WHERE MaestroID=? AND UserID<>? AND Name=? AND EnterCode=?"; $query = "SELECT PlayerID FROM moty_player WHERE MaestroID=? AND PlayerID<>? AND Name=? AND EnterCode=?";
$stmt = $db_conn->prepare($query); $stmt = $db_conn->prepare($query);
$stmt->bind_param('iiss', $maestroID, $playerID, $playerName, $enterCode); $stmt->bind_param('iiss', $maestroID, $playerID, $playerName, $enterCode);
$stmt->execute(); $stmt->execute();
$stmt->bind_result($userID); $stmt->bind_result($playerID);
// while($stmt->fetch()) // while($stmt->fetch())
$stmt->fetch(); $stmt->fetch();
$stmt->close(); $stmt->close();
// $replyJSON["UserID"] = $userID; return $playerID;
return $userID;
} }
function editPlayer($maestroID, $playerID, $playerName, $enterCode) { function editPlayer($maestroID, $playerID, $playerName, $enterCode) {
global $db_conn; global $db_conn;
$query = "UPDATE moty_user SET Name=?, EnterCode=? WHERE MaestroID=? AND UserID=?"; $query = "UPDATE moty_player SET Name=?, EnterCode=? WHERE MaestroID=? AND PlayerID=?";
$stmt = $db_conn->prepare($query); $stmt = $db_conn->prepare($query);
$stmt->bind_param('ssii', $playerName, $enterCode, $maestroID, $playerID); $stmt->bind_param('ssii', $playerName, $enterCode, $maestroID, $playerID);
$stmt->execute(); $stmt->execute();
@@ -64,17 +63,16 @@ function editPlayer($maestroID, $playerID, $playerName, $enterCode) {
function hasPlayerName($maestroID, $playerName, $enterCode) { function hasPlayerName($maestroID, $playerName, $enterCode) {
global $db_conn; global $db_conn;
$query = "SELECT UserID FROM moty_user WHERE MaestroID=? AND Name=? AND EnterCode=?"; $query = "SELECT PlayerID FROM moty_player WHERE MaestroID=? AND Name=? AND EnterCode=?";
$stmt = $db_conn->prepare($query); $stmt = $db_conn->prepare($query);
$stmt->bind_param('iss', $maestroID, $playerName, $enterCode); $stmt->bind_param('iss', $maestroID, $playerName, $enterCode);
$stmt->execute(); $stmt->execute();
$stmt->bind_result($userID); $stmt->bind_result($playerID);
// while($stmt->fetch()) // while($stmt->fetch())
$stmt->fetch(); $stmt->fetch();
$stmt->close(); $stmt->close();
// $replyJSON["UserID"] = $userID; return $playerID;
return $userID;
} }
?> ?>
@@ -24,7 +24,7 @@ if($maestroID === null) {
} }
$replyJSON = get_login_data($maestroID, $name, $enterCode); $replyJSON = get_login_data($maestroID, $name, $enterCode);
if($replyJSON["UserID"] === null) { if($replyJSON["PlayerID"] === null) {
send_error_message($replyJSON, "입력한 이름/입장번호와 일치하는 계정이 없습니다"); send_error_message($replyJSON, "입력한 이름/입장번호와 일치하는 계정이 없습니다");
$db_conn->close(); $db_conn->close();
exit; exit;
@@ -54,17 +54,17 @@ function get_maestro_id($maestroName) {
function get_login_data($maestroID, $name, $enterCode) { function get_login_data($maestroID, $name, $enterCode) {
global $db_conn; global $db_conn;
$query = "SELECT UserID FROM moty_user WHERE MaestroID=? AND Name=? AND EnterCode=?"; $query = "SELECT PlayerID FROM moty_player WHERE MaestroID=? AND Name=? AND EnterCode=?";
$stmt = $db_conn->prepare($query); $stmt = $db_conn->prepare($query);
$stmt->bind_param('iss', $maestroID, $name, $enterCode); $stmt->bind_param('iss', $maestroID, $name, $enterCode);
$stmt->execute(); $stmt->execute();
$stmt->bind_result($user_id); $stmt->bind_result($player_id);
// while($stmt->fetch()) // while($stmt->fetch())
$stmt->fetch(); $stmt->fetch();
$stmt->close(); $stmt->close();
$replyJSON["MaestroID"] = $maestroID; $replyJSON["MaestroID"] = $maestroID;
$replyJSON["UserID"] = $user_id; $replyJSON["PlayerID"] = $player_id;
return $replyJSON; return $replyJSON;
} }
@@ -30,15 +30,15 @@ $db_conn->close();
function getPlayerCount($maestroID) { function getPlayerCount($maestroID) {
global $db_conn; global $db_conn;
$query = "SELECT COUNT(UserID) FROM moty_user WHERE MaestroID=?"; $query = "SELECT COUNT(PlayerID) FROM moty_player WHERE MaestroID=?";
$stmt = $db_conn->prepare($query); $stmt = $db_conn->prepare($query);
$stmt->bind_param('i', $maestroID); $stmt->bind_param('i', $maestroID);
$stmt->execute(); $stmt->execute();
$stmt->bind_result($userCount); $stmt->bind_result($playerCount);
$stmt->fetch(); $stmt->fetch();
$stmt->close(); $stmt->close();
return $userCount; return $playerCount;
} }
?> ?>
@@ -24,20 +24,20 @@ function get_player_list_page($maestroID, $startNo, $endNo) {
global $db_conn; global $db_conn;
$query = " $query = "
SELECT UserID, Name, EnterCode FROM moty_user SELECT PlayerID, Name, EnterCode FROM moty_player
WHERE MaestroID=? WHERE MaestroID=?
ORDER BY UserID DESC ORDER BY PlayerID DESC
LIMIT ?, 10; LIMIT ?, 10;
"; ";
$stmt = $db_conn->prepare($query); $stmt = $db_conn->prepare($query);
// $stmt->bind_param('iii', $maestroID, $startNo, $endNo); // $stmt->bind_param('iii', $maestroID, $startNo, $endNo);
$stmt->bind_param('ii', $maestroID, $startNo); $stmt->bind_param('ii', $maestroID, $startNo);
$stmt->execute(); $stmt->execute();
$stmt->bind_result($userID, $name, $enterCode); $stmt->bind_result($playerID, $name, $enterCode);
$playerList = array(); $playerList = array();
while($stmt->fetch()) { while($stmt->fetch()) {
$player['UserID'] = $userID; $player['PlayerID'] = $playerID;
$player['Name'] = $name; $player['Name'] = $name;
$player['EnterCode'] = $enterCode; $player['EnterCode'] = $enterCode;
array_push($playerList, $player); array_push($playerList, $player);
@@ -31,15 +31,15 @@ $db_conn->close();
function getPlayerCount($maestroID, $playerName) { function getPlayerCount($maestroID, $playerName) {
global $db_conn; global $db_conn;
$query = "SELECT COUNT(UserID) FROM moty_user WHERE MaestroID = ? AND Name = ?"; $query = "SELECT COUNT(PlayerID) FROM moty_player WHERE MaestroID = ? AND Name = ?";
$stmt = $db_conn->prepare($query); $stmt = $db_conn->prepare($query);
$stmt->bind_param('is', $maestroID, $playerName); $stmt->bind_param('is', $maestroID, $playerName);
$stmt->execute(); $stmt->execute();
$stmt->bind_result($userCount); $stmt->bind_result($playerCount);
$stmt->fetch(); $stmt->fetch();
$stmt->close(); $stmt->close();
return $userCount; return $playerCount;
} }
?> ?>
@@ -25,20 +25,20 @@ function get_player_list_page($maestroID, $playerName, $startNo, $endNo) {
global $db_conn; global $db_conn;
$query = " $query = "
SELECT UserID, Name, EnterCode FROM moty_user SELECT PlayerID, Name, EnterCode FROM moty_player
WHERE MaestroID=? AND Name=? WHERE MaestroID=? AND Name=?
ORDER BY UserID DESC ORDER BY PlayerID DESC
LIMIT ?, 10; LIMIT ?, 10;
"; ";
$stmt = $db_conn->prepare($query); $stmt = $db_conn->prepare($query);
// $stmt->bind_param('iii', $maestroID, $startNo, $endNo); // $stmt->bind_param('iii', $maestroID, $startNo, $endNo);
$stmt->bind_param('isi', $maestroID, $playerName, $startNo); $stmt->bind_param('isi', $maestroID, $playerName, $startNo);
$stmt->execute(); $stmt->execute();
$stmt->bind_result($userID, $name, $enterCode); $stmt->bind_result($playerID, $name, $enterCode);
$playerList = array(); $playerList = array();
while($stmt->fetch()) { while($stmt->fetch()) {
$player['UserID'] = $userID; $player['PlayerID'] = $playerID;
$player['Name'] = $name; $player['Name'] = $name;
$player['EnterCode'] = $enterCode; $player['EnterCode'] = $enterCode;
array_push($playerList, $player); array_push($playerList, $player);
+5 -5
View File
@@ -3,13 +3,13 @@ header('Content-Type: application/json');
$maestro_id = $_POST["MaestroID"]; $maestro_id = $_POST["MaestroID"];
$app_id = $_POST["AppID"]; $app_id = $_POST["AppID"];
$user_id = $_POST["UserID"]; $player_id = $_POST["PlayerID"];
$date = $_POST["Date"]; $date = $_POST["Date"];
include "./../setup/connect_db.php"; include "./../setup/connect_db.php";
$replyJSON = get_history_record($maestro_id, $app_id, $user_id, $date); $replyJSON = get_history_record($maestro_id, $app_id, $player_id, $date);
if($replyJSON.length === 0) { if($replyJSON.length === 0) {
send_error_message($replyJSON, "히스토리 기록 없음"); send_error_message($replyJSON, "히스토리 기록 없음");
$db_conn->close(); $db_conn->close();
@@ -20,20 +20,20 @@ echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
$db_conn->close(); $db_conn->close();
function get_history_record($maestro_id, $app_id, $user_id, $date) { function get_history_record($maestro_id, $app_id, $player_id, $date) {
global $db_conn; global $db_conn;
$query = " $query = "
SELECT DATE(BR.RecordDateTime) AS Date, MAX(BR.BestRecord) AS HighScore, AA.AppName AS AppName SELECT DATE(BR.RecordDateTime) AS Date, MAX(BR.BestRecord) AS HighScore, AA.AppName AS AppName
FROM moty_best_record BR FROM moty_best_record BR
INNER JOIN moty_app AS AA INNER JOIN moty_app AS AA
ON BR.MaestroID = ? AND BR.UserID = ? AND DATE(BR.RecordDateTime) <= ? AND BR.AppID = ? AND BR.AppID = AA.AppID ON BR.MaestroID = ? AND BR.PlayerID = ? AND DATE(BR.RecordDateTime) <= ? AND BR.AppID = ? AND BR.AppID = AA.AppID
GROUP BY DATE(BR.RecordDateTime) GROUP BY DATE(BR.RecordDateTime)
ORDER BY BR.RecordDateTime DESC ORDER BY BR.RecordDateTime DESC
LIMIT 7 LIMIT 7
"; ";
$stmt = $db_conn->prepare($query); $stmt = $db_conn->prepare($query);
$stmt->bind_param('iisi', $maestro_id, $user_id, $date, $app_id); $stmt->bind_param('iisi', $maestro_id, $player_id, $date, $app_id);
$stmt->execute(); $stmt->execute();
$stmt->bind_result($date, $score, $app_name); $stmt->bind_result($date, $score, $app_name);
+6 -6
View File
@@ -24,20 +24,20 @@ function get_ranking_record_day($maestro_id, $date, $app_id) {
global $db_conn; global $db_conn;
$query = " $query = "
SELECT BR.userID As UserID, U.Name AS Name, MAX(BR.BestRecord) AS HighScore SELECT BR.playerID As PlayerID, U.Name AS Name, MAX(BR.BestRecord) AS HighScore
FROM moty_best_record BR, moty_user U FROM moty_best_record BR, moty_player U
WHERE BR.MaestroID = ? AND BR.userID = U.userID AND DATE(BR.RecordDateTime) = ? AND AppID = ? WHERE BR.MaestroID = ? AND BR.playerID = U.playerID AND DATE(BR.RecordDateTime) = ? AND AppID = ?
GROUP BY BR.userID GROUP BY BR.playerID
ORDER BY max(BR.BestRecord) DESC; ORDER BY max(BR.BestRecord) DESC;
"; ";
$stmt = $db_conn->prepare($query); $stmt = $db_conn->prepare($query);
$stmt->bind_param('isi', $maestro_id, $date, $app_id); $stmt->bind_param('isi', $maestro_id, $date, $app_id);
$stmt->execute(); $stmt->execute();
$stmt->bind_result($userID, $name, $high_score); $stmt->bind_result($playerID, $name, $high_score);
$ranking_record_array = array(); $ranking_record_array = array();
while($stmt->fetch()) { while($stmt->fetch()) {
$ranking_record['UserID'] = $userID; $ranking_record['PlayerID'] = $playerID;
$ranking_record['Name'] = $name; $ranking_record['Name'] = $name;
$ranking_record['HighScore'] = $high_score; $ranking_record['HighScore'] = $high_score;
array_push($ranking_record_array, $ranking_record); array_push($ranking_record_array, $ranking_record);
@@ -23,20 +23,20 @@ function get_ranking_record_hour($maestro_id, $date, $time, $app_id) {
global $db_conn; global $db_conn;
$query = " $query = "
SELECT BR.userID As UserID, U.Name AS Name, MAX(BR.BestRecord) AS HighScore SELECT BR.playerID As PlayerID, U.Name AS Name, MAX(BR.BestRecord) AS HighScore
FROM moty_best_record BR, moty_user U FROM moty_best_record BR, moty_player U
WHERE BR.MaestroID = ? AND BR.userID = U.userID AND DATE(BR.RecordDateTime) = ? AND HOUR(BR.RecordDateTime) = HOUR(?) AND AppID = ? WHERE BR.MaestroID = ? AND BR.playerID = U.playerID AND DATE(BR.RecordDateTime) = ? AND HOUR(BR.RecordDateTime) = HOUR(?) AND AppID = ?
GROUP BY BR.userID GROUP BY BR.playerID
ORDER BY max(BR.BestRecord) DESC; ORDER BY max(BR.BestRecord) DESC;
"; ";
$stmt = $db_conn->prepare($query); $stmt = $db_conn->prepare($query);
$stmt->bind_param('issi', $maestro_id, $date, $time, $app_id); $stmt->bind_param('issi', $maestro_id, $date, $time, $app_id);
$stmt->execute(); $stmt->execute();
$stmt->bind_result($userID, $name, $high_score); $stmt->bind_result($playerID, $name, $high_score);
$ranking_record_array = array(); $ranking_record_array = array();
while($stmt->fetch()) { while($stmt->fetch()) {
$ranking_record['UserID'] = $userID; $ranking_record['PlayerID'] = $playerID;
$ranking_record['Name'] = $name; $ranking_record['Name'] = $name;
$ranking_record['HighScore'] = $high_score; $ranking_record['HighScore'] = $high_score;
array_push($ranking_record_array, $ranking_record); array_push($ranking_record_array, $ranking_record);
@@ -24,20 +24,20 @@ function get_ranking_record_month($maestro_id, $date, $time, $app_id) {
global $db_conn; global $db_conn;
$query = " $query = "
SELECT BR.userID As UserID, U.Name AS Name, MAX(BR.BestRecord) AS HighScore SELECT BR.playerID As PlayerID, U.Name AS Name, MAX(BR.BestRecord) AS HighScore
FROM moty_best_record BR, moty_user U FROM moty_best_record BR, moty_player U
WHERE BR.MaestroID = ? AND BR.userID = U.userID AND MONTH(BR.RecordDateTime) = MONTH(?) AND AppID = ? WHERE BR.MaestroID = ? AND BR.playerID = U.playerID AND MONTH(BR.RecordDateTime) = MONTH(?) AND AppID = ?
GROUP BY BR.userID GROUP BY BR.playerID
ORDER BY max(BR.BestRecord) DESC; ORDER BY max(BR.BestRecord) DESC;
"; ";
$stmt = $db_conn->prepare($query); $stmt = $db_conn->prepare($query);
$stmt->bind_param('isi', $maestro_id, $date, $app_id); $stmt->bind_param('isi', $maestro_id, $date, $app_id);
$stmt->execute(); $stmt->execute();
$stmt->bind_result($userID, $name, $high_score); $stmt->bind_result($playerID, $name, $high_score);
$ranking_record_array = array(); $ranking_record_array = array();
while($stmt->fetch()) { while($stmt->fetch()) {
$ranking_record['UserID'] = $userID; $ranking_record['PlayerID'] = $playerID;
$ranking_record['Name'] = $name; $ranking_record['Name'] = $name;
$ranking_record['HighScore'] = $high_score; $ranking_record['HighScore'] = $high_score;
array_push($ranking_record_array, $ranking_record); array_push($ranking_record_array, $ranking_record);
@@ -2,14 +2,14 @@
header('Content-Type: application/json'); header('Content-Type: application/json');
$maestro_id = $_POST["MaestroID"]; $maestro_id = $_POST["MaestroID"];
$user_id = $_POST["UserID"]; $player_id = $_POST["PlayerID"];
$app_id = $_POST["AppID"]; $app_id = $_POST["AppID"];
include "./../setup/connect_db.php"; include "./../setup/connect_db.php";
$replyJSON = array(); $replyJSON = array();
$replyJSON["BestRecord"] = get_best_record($maestro_id, $app_id, $user_id); $replyJSON["BestRecord"] = get_best_record($maestro_id, $app_id, $player_id);
if($replyJSON.length === 0) { if($replyJSON.length === 0) {
send_error_message($replyJSON, "히스토리 기록 없음"); send_error_message($replyJSON, "히스토리 기록 없음");
$db_conn->close(); $db_conn->close();
@@ -20,16 +20,16 @@ echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
$db_conn->close(); $db_conn->close();
function get_best_record($maestro_id, $app_id, $user_id) { function get_best_record($maestro_id, $app_id, $player_id) {
global $db_conn; global $db_conn;
$query = " $query = "
SELECT BestRecord SELECT BestRecord
FROM moty_best_record FROM moty_best_record
WHERE MaestroID = ? AND AppID = ? AND UserID = ? AND DATE(RecordDateTime) = DATE(NOW()) WHERE MaestroID = ? AND AppID = ? AND PlayerID = ? AND DATE(RecordDateTime) = DATE(NOW())
"; ";
$stmt = $db_conn->prepare($query); $stmt = $db_conn->prepare($query);
$stmt->bind_param("iii", $maestro_id, $app_id, $user_id); $stmt->bind_param("iii", $maestro_id, $app_id, $player_id);
$stmt->execute(); $stmt->execute();
$stmt->bind_result($best_record); $stmt->bind_result($best_record);
$stmt->fetch(); $stmt->fetch();
+10 -10
View File
@@ -2,7 +2,7 @@
header('Content-Type: application/json'); header('Content-Type: application/json');
$maestro_id = $_POST["MaestroID"]; $maestro_id = $_POST["MaestroID"];
$user_id = $_POST["UserID"]; $player_id = $_POST["PlayerID"];
$app_id = $_POST["AppID"]; $app_id = $_POST["AppID"];
$best_record = $_POST["BestRecord"]; $best_record = $_POST["BestRecord"];
// echo $best_record." / "; // echo $best_record." / ";
@@ -12,12 +12,12 @@ include "./../setup/connect_db.php";
$prev_best_record_id = -1; $prev_best_record_id = -1;
$prev_best_record = 0; $prev_best_record = 0;
$prev_best_record_id = get_best_record($maestro_id, $app_id, $user_id); $prev_best_record_id = get_best_record($maestro_id, $app_id, $player_id);
// echo "id : ".$prev_best_record_id." ".$prev_best_record; // echo "id : ".$prev_best_record_id." ".$prev_best_record;
if($prev_best_record_id < 0) { if($prev_best_record_id === null || $prev_best_record_id < 0) {
// echo "insert"; // echo "insert";
insert_best_record($maestro_id, $app_id, $user_id, $best_record); insert_best_record($maestro_id, $app_id, $player_id, $best_record);
} else { } else {
// echo $best_record." ".$prev_best_record; // echo $best_record." ".$prev_best_record;
if($best_record > $prev_best_record) { if($best_record > $prev_best_record) {
@@ -29,17 +29,17 @@ if($prev_best_record_id < 0) {
$db_conn->close(); $db_conn->close();
function get_best_record($maestro_id, $app_id, $user_id) { function get_best_record($maestro_id, $app_id, $player_id) {
global $db_conn; global $db_conn;
global $prev_best_record_id, $prev_best_record; global $prev_best_record_id, $prev_best_record;
$query = " $query = "
SELECT BestRecordID, BestRecord SELECT BestRecordID, BestRecord
FROM moty_best_record FROM moty_best_record
WHERE MaestroID = ? AND AppID = ? AND UserID = ? AND DATE(RecordDateTime) = DATE(NOW()) AND HOUR(RecordDateTime) = HOUR(NOW()) WHERE MaestroID = ? AND AppID = ? AND PlayerID = ? AND DATE(RecordDateTime) = DATE(NOW()) AND HOUR(RecordDateTime) = HOUR(NOW())
"; ";
$stmt = $db_conn->prepare($query); $stmt = $db_conn->prepare($query);
$stmt->bind_param("iii", $maestro_id, $app_id, $user_id); $stmt->bind_param("iii", $maestro_id, $app_id, $player_id);
$stmt->execute(); $stmt->execute();
$stmt->bind_result($prev_best_record_id, $prev_best_record); $stmt->bind_result($prev_best_record_id, $prev_best_record);
$stmt->fetch(); $stmt->fetch();
@@ -52,15 +52,15 @@ function get_best_record($maestro_id, $app_id, $user_id) {
} }
function insert_best_record($maestro_id, $app_id, $user_id, $best_record) { function insert_best_record($maestro_id, $app_id, $player_id, $best_record) {
global $db_conn; global $db_conn;
$query = " $query = "
INSERT INTO moty_best_record (MaestroID, UserID, AppID, BestRecord, RecordDateTime) INSERT INTO moty_best_record (MaestroID, PlayerID, AppID, BestRecord, RecordDateTime)
VALUES (?, ?, ?, ?, NOW()); VALUES (?, ?, ?, ?, NOW());
"; ";
$stmt = $db_conn->prepare($query); $stmt = $db_conn->prepare($query);
$stmt->bind_param('iiid', $maestro_id, $user_id, $app_id, $best_record); $stmt->bind_param('iiid', $maestro_id, $player_id, $app_id, $best_record);
$stmt->execute(); $stmt->execute();
} }
+4 -4
View File
@@ -10,8 +10,8 @@ CREATE TABLE moty_maestro (
MaestroTestID INT UNSIGNED MaestroTestID INT UNSIGNED
); );
CREATE TABLE moty_user ( CREATE TABLE moty_player (
UserID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, PlayerID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
MaestroID INT UNSIGNED NOT NULL, MaestroID INT UNSIGNED NOT NULL,
Name CHAR(50) NOT NULL, Name CHAR(50) NOT NULL,
EnterCode CHAR(6) NOT NULL, EnterCode CHAR(6) NOT NULL,
@@ -44,7 +44,7 @@ CREATE TABLE moty_best_record (
BestRecordID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, BestRecordID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
MaestroID INT UNSIGNED NOT NULL, MaestroID INT UNSIGNED NOT NULL,
AppID INT UNSIGNED NOT NULL, AppID INT UNSIGNED NOT NULL,
UserID INT UNSIGNED NOT NULL, PlayerID INT UNSIGNED NOT NULL,
BestRecord FLOAT NOT NULL, BestRecord FLOAT NOT NULL,
RecordDateTime DATETIME NOT NULL, RecordDateTime DATETIME NOT NULL,
@@ -59,7 +59,7 @@ CREATE TABLE moty_ranking (
AppID INT UNSIGNED NOT NULL, AppID INT UNSIGNED NOT NULL,
RankingType INT UNSIGNED NOT NULL, RankingType INT UNSIGNED NOT NULL,
Rank INT UNSIGNED NOT NULL, Rank INT UNSIGNED NOT NULL,
UserID INT UNSIGNED NOT NULL, PlayerID INT UNSIGNED NOT NULL,
FOREIGN KEY (MaestroID) REFERENCES moty_maestro(MaestroID), FOREIGN KEY (MaestroID) REFERENCES moty_maestro(MaestroID),
FOREIGN KEY (AppID) REFERENCES moty_app(AppID), FOREIGN KEY (AppID) REFERENCES moty_app(AppID),