Fix: do not edit player enter code if player name and enter code are same
This commit is contained in:
@@ -162,7 +162,7 @@ var Setup = {
|
|||||||
}).bind(this),
|
}).bind(this),
|
||||||
(function(jsonData) {
|
(function(jsonData) {
|
||||||
// this.loginFailed(jsonData);
|
// this.loginFailed(jsonData);
|
||||||
this.showInfoText("입장번호 변경에 실패하였습니다.")
|
this.showInfoText(jsonData["error"]);
|
||||||
}).bind(this)
|
}).bind(this)
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -17,6 +17,15 @@ if(!is_numeric($enterCode)) {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$playerName = get_player_name($maestroID, $playerID);
|
||||||
|
if($playerName != null && $playerName != "") {
|
||||||
|
$sameNamePlayerID = get_same_name_player_id($maestroID, $playerName, $enterCode);
|
||||||
|
if($sameNamePlayerID != null && $sameNamePlayerID != 0) {
|
||||||
|
set_error_message("입력하신 입장번호를 다른 학생이 사용하고 있습니다.\n다른 입장번호를 입력해주세요.");
|
||||||
|
send_result_fail();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
editPlayer($maestroID, $playerID, $enterCode);
|
editPlayer($maestroID, $playerID, $enterCode);
|
||||||
|
|
||||||
@@ -25,6 +34,44 @@ send_result_success();
|
|||||||
exit;
|
exit;
|
||||||
|
|
||||||
|
|
||||||
|
function get_player_name($maestroID, $playerID) {
|
||||||
|
global $db_conn;
|
||||||
|
|
||||||
|
$query = "
|
||||||
|
SELECT Name
|
||||||
|
FROM player
|
||||||
|
WHERE MaestroID = ? AND PlayerID = ?
|
||||||
|
";
|
||||||
|
$stmt = $db_conn->prepare($query);
|
||||||
|
$stmt->bind_param("ii", $maestroID, $playerID);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->bind_result($playerName);
|
||||||
|
// while($stmt->fetch())
|
||||||
|
$stmt->fetch();
|
||||||
|
$stmt->close();
|
||||||
|
|
||||||
|
return $playerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_same_name_player_id($maestroID, $playerName, $enterCode) {
|
||||||
|
global $db_conn;
|
||||||
|
|
||||||
|
$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();
|
||||||
|
$stmt->bind_result($playerID);
|
||||||
|
// while($stmt->fetch())
|
||||||
|
$stmt->fetch();
|
||||||
|
$stmt->close();
|
||||||
|
|
||||||
|
return $playerID;
|
||||||
|
}
|
||||||
|
|
||||||
function editPlayer($maestroID, $playerID, $enterCode) {
|
function editPlayer($maestroID, $playerID, $enterCode) {
|
||||||
global $db_conn;
|
global $db_conn;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user