Add: edit player enter_code
This commit is contained in:
@@ -79,6 +79,23 @@ DBConnectManager.prototype.requestPlayerEnterCode = function(maestroID, playerID
|
|||||||
xhr.send("maestro_id=" + maestroID + "&player_id=" + playerID);
|
xhr.send("maestro_id=" + maestroID + "&player_id=" + playerID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DBConnectManager.prototype.requestEditPlayerEnterCode = function(maestroID, playerID, enterCode, onSucceededListener, onFailedListener) {
|
||||||
|
var xhr = new XMLHttpRequest();
|
||||||
|
xhr.open("POST", this.phpPath + "server/player/edit_entercode.php", true);
|
||||||
|
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||||
|
xhr.onreadystatechange = function() {
|
||||||
|
if(xhr.readyState == 4 && xhr.status == 200) {
|
||||||
|
var replyJSON = JSON.parse(xhr.responseText);
|
||||||
|
|
||||||
|
if(replyJSON != null && replyJSON["result"] == "success")
|
||||||
|
onSucceededListener(replyJSON);
|
||||||
|
else
|
||||||
|
onFailedListener(replyJSON);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
xhr.send("maestro_id=" + maestroID + "&player_id=" + playerID + "&enter_code=" + enterCode);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
DBConnectManager.prototype.requestAppList = function(maestroID, onSucceededListener, onFailedListener) {
|
DBConnectManager.prototype.requestAppList = function(maestroID, onSucceededListener, onFailedListener) {
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
|
|||||||
+19
-4
@@ -154,13 +154,27 @@ var Setup = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var accountValidator = new AccountValidator();
|
var accountValidator = new AccountValidator();
|
||||||
if(accountValidator.isValidPlayerPW(newEnterCode)) {
|
if(!accountValidator.isValidPlayerPW(newEnterCode)) {
|
||||||
this.showInfoText("입장번호를 바꾸겠습니다.");
|
|
||||||
} else {
|
|
||||||
var errorMessage = accountValidator.messageForInvalidPlayerPW(newEnterCode);
|
var errorMessage = accountValidator.messageForInvalidPlayerPW(newEnterCode);
|
||||||
this.showInfoText(errorMessage);
|
this.showInfoText(errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.showInfoText("입장번호를 바꾸겠습니다.");
|
||||||
|
var dbConnectManager = new DBConnectManager();
|
||||||
|
dbConnectManager.requestEditPlayerEnterCode(
|
||||||
|
sessionStorageManager.getMaestroID(),
|
||||||
|
sessionStorageManager.getPlayerID(),
|
||||||
|
newEnterCode,
|
||||||
|
(function(jsonData) {
|
||||||
|
// this.loginSucceeded(jsonData);
|
||||||
|
this.showInfoText("새로 입력하신 [ " + jsonData["EnterCode"] + " ]로 입장번호가 변경되었습니다.")
|
||||||
|
this.loadPrevEnterCode();
|
||||||
|
}).bind(this),
|
||||||
|
(function(jsonData) {
|
||||||
|
// this.loginFailed(jsonData);
|
||||||
|
this.showInfoText("입장번호 변경에 실패하였습니다.")
|
||||||
|
}).bind(this)
|
||||||
|
);
|
||||||
/*
|
/*
|
||||||
var maestroName = this.inputTextMaestroName.canvasInput._value;
|
var maestroName = this.inputTextMaestroName.canvasInput._value;
|
||||||
sessionStorageManager.setPlayerName(this.inputTextName.canvasInput._value);
|
sessionStorageManager.setPlayerName(this.inputTextName.canvasInput._value);
|
||||||
@@ -204,7 +218,6 @@ var Setup = {
|
|||||||
sessionStorageManager.getPlayerID(),
|
sessionStorageManager.getPlayerID(),
|
||||||
(function(jsonData) {
|
(function(jsonData) {
|
||||||
this.prevEnterCode = jsonData['EnterCode'];
|
this.prevEnterCode = jsonData['EnterCode'];
|
||||||
console.log(this.prevEnterCode);
|
|
||||||
this.prevEnterCodeText.text = this.prevEnterCode;
|
this.prevEnterCodeText.text = this.prevEnterCode;
|
||||||
}).bind(this),
|
}).bind(this),
|
||||||
(function(jsonData) {
|
(function(jsonData) {
|
||||||
@@ -214,6 +227,7 @@ var Setup = {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/*
|
||||||
loginSucceeded: function(jsonData) {
|
loginSucceeded: function(jsonData) {
|
||||||
sessionStorageManager.setMaestroID(jsonData['MaestroID']);
|
sessionStorageManager.setMaestroID(jsonData['MaestroID']);
|
||||||
sessionStorageManager.setMaestroAccountType(jsonData['MaestroAccountType']);
|
sessionStorageManager.setMaestroAccountType(jsonData['MaestroAccountType']);
|
||||||
@@ -238,5 +252,6 @@ var Setup = {
|
|||||||
this.infoText.text = jsonData["error"];
|
this.infoText.text = jsonData["error"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
header("Content-Type: application/json");
|
||||||
|
|
||||||
|
include "./../lib/send_reply_json.php";
|
||||||
|
include "./../setup/connect_db.php";
|
||||||
|
|
||||||
|
$maestroID = $_POST["maestro_id"];
|
||||||
|
$playerID = $_POST["player_id"];
|
||||||
|
$enterCode = $_POST["enter_code"];
|
||||||
|
/*
|
||||||
|
if(!is_numeric($enterCode)) {
|
||||||
|
send_error_code("생년월일이 숫자가 아닙니다. : ".$enterCode);
|
||||||
|
exit;
|
||||||
|
} else if(strlen($enterCode) != 6) {
|
||||||
|
send_error_code("6자리 숫자값을 정확히 입력하세요 : YYMMDD (예 : 120131) : ".$enterCode);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
editPlayer($maestroID, $playerID, $enterCode);
|
||||||
|
|
||||||
|
set_data("EnterCode", $enterCode);
|
||||||
|
send_result_success();
|
||||||
|
exit;
|
||||||
|
|
||||||
|
|
||||||
|
function editPlayer($maestroID, $playerID, $enterCode) {
|
||||||
|
global $db_conn;
|
||||||
|
|
||||||
|
$query = "UPDATE player SET EnterCode=? WHERE MaestroID=? AND PlayerID=?";
|
||||||
|
$stmt = $db_conn->prepare($query);
|
||||||
|
$stmt->bind_param("sii", $enterCode, $maestroID, $playerID);
|
||||||
|
$stmt->execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
Reference in New Issue
Block a user