Add: player_list.js
This commit is contained in:
@@ -16,15 +16,9 @@ if(!is_numeric($enterCode)) {
|
||||
|
||||
include "./../setup/connect_db.php";
|
||||
|
||||
function send_error_message2($replyJSON, $error_message) {
|
||||
$replyJSON["ERROR"] = $error_message;
|
||||
echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
|
||||
// $db_conn->close();
|
||||
}
|
||||
|
||||
$result = hasPlayerName($maestroID, $playerName, $enterCode);
|
||||
if($result !== null) {
|
||||
send_error_message2($replyJSON, "이미 등록된 학생과 입장 코드 정보입니다.");
|
||||
send_error_message($replyJSON, "이미 등록된 학생과 입장 코드 정보입니다.");
|
||||
// $db_conn->close();
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$maestroID = $_POST["maestro_id"];
|
||||
$playerID = $_POST["player_id"];
|
||||
/*
|
||||
if(!is_numeric($enterCode)) {
|
||||
send_error_code('생년월일이 숫자가 아닙니다. : '.$enterCode);
|
||||
exit;
|
||||
} else if(strlen($enterCode) != 6) {
|
||||
send_error_code('6자리 숫자값을 정확히 입력하세요 : YYMMDD (예 : 120131) : '.$enterCode);
|
||||
exit;
|
||||
}
|
||||
*/
|
||||
|
||||
include "./../setup/connect_db.php";
|
||||
|
||||
deletePlayer($maestroID, $playerID);
|
||||
|
||||
$result = hasPlayerID($maestroID, $playerID);
|
||||
if($result === true) {
|
||||
send_result_message($replyJSON, "학생 계정 삭제 실패");
|
||||
exit;
|
||||
}
|
||||
|
||||
$result = hasPlayerRecord($maestroID, $playerID);
|
||||
if($result === true) {
|
||||
send_result_message($replyJSON, "학생 플레이 기록 삭제 실패");
|
||||
exit;
|
||||
}
|
||||
|
||||
$replyJSON["RESULT"] = "success";
|
||||
echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
|
||||
$db_conn->close();
|
||||
|
||||
|
||||
function deletePlayer($maestroID, $playerID) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "DELETE FROM moty_best_record WHERE MaestroID = ? AND UserID = ?";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('ii', $maestroID, $playerID);
|
||||
$result = $stmt->execute();
|
||||
$stmt->close();
|
||||
|
||||
// if($result) {
|
||||
// echo "deleted row count : ".$stmt->affected_rows;
|
||||
// }
|
||||
|
||||
$query = "DELETE FROM moty_user WHERE MaestroID = ? AND UserID = ?";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('ii', $maestroID, $playerID);
|
||||
$result = $stmt->execute();
|
||||
$stmt->close();
|
||||
|
||||
// if($result) {
|
||||
// echo "deleted row count : ".$stmt->affected_rows;
|
||||
// }
|
||||
}
|
||||
|
||||
function hasPlayerID($maestroID, $playerID) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "SELECT UserID FROM moty_user WHERE MaestroID=? AND UserID=?";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('ii', $maestroID, $playerID);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($userID);
|
||||
// while($stmt->fetch())
|
||||
$stmt->fetch();
|
||||
$stmt->close();
|
||||
|
||||
if($userID !== null)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function hasPlayerRecord($maestroID, $playerID) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "SELECT UserID FROM moty_best_record WHERE MaestroID=? AND UserID=?";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('ii', $maestroID, $playerID);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($userID);
|
||||
// while($stmt->fetch())
|
||||
$stmt->fetch();
|
||||
$stmt->close();
|
||||
|
||||
if($userID !== null)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user