Add: check player name, enterCode before add player
This commit is contained in:
@@ -24,6 +24,8 @@ if($result === true) {
|
||||
exit;
|
||||
}
|
||||
|
||||
decrease_player_count($maestroID, 1);
|
||||
|
||||
send_result_success();
|
||||
exit;
|
||||
|
||||
@@ -31,7 +33,10 @@ exit;
|
||||
function deletePlayer($maestroID, $playerID) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "DELETE FROM moty_best_record WHERE MaestroID = ? AND PlayerID = ?";
|
||||
$query = "
|
||||
DELETE FROM moty_best_record
|
||||
WHERE MaestroID = ? AND PlayerID = ?
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param("ii", $maestroID, $playerID);
|
||||
$result = $stmt->execute();
|
||||
@@ -41,7 +46,10 @@ function deletePlayer($maestroID, $playerID) {
|
||||
// echo "deleted row count : ".$stmt->affected_rows;
|
||||
// }
|
||||
|
||||
$query = "DELETE FROM moty_player WHERE MaestroID = ? AND PlayerID = ?";
|
||||
$query = "
|
||||
DELETE FROM moty_player
|
||||
WHERE MaestroID = ? AND PlayerID = ?
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param("ii", $maestroID, $playerID);
|
||||
$result = $stmt->execute();
|
||||
@@ -55,7 +63,11 @@ function deletePlayer($maestroID, $playerID) {
|
||||
function hasPlayerID($maestroID, $playerID) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "SELECT PlayerID FROM moty_player WHERE MaestroID=? AND PlayerID=?";
|
||||
$query = "
|
||||
SELECT PlayerID
|
||||
FROM moty_player
|
||||
WHERE MaestroID=? AND PlayerID=?
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param("ii", $maestroID, $playerID);
|
||||
$stmt->execute();
|
||||
@@ -73,7 +85,11 @@ function hasPlayerID($maestroID, $playerID) {
|
||||
function hasPlayerRecord($maestroID, $playerID) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "SELECT PlayerID FROM moty_best_record WHERE MaestroID=? AND PlayerID=?";
|
||||
$query = "
|
||||
SELECT PlayerID
|
||||
FROM moty_best_record
|
||||
WHERE MaestroID=? AND PlayerID=?
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param("ii", $maestroID, $playerID);
|
||||
$stmt->execute();
|
||||
@@ -88,4 +104,17 @@ function hasPlayerRecord($maestroID, $playerID) {
|
||||
return false;
|
||||
}
|
||||
|
||||
function decrease_player_count($maestroID, $count) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "
|
||||
UPDATE moty_maestro
|
||||
SET PlayerCount = PlayerCount - ?
|
||||
WHERE MaestroID = ?
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param("ii", $count, $maestroID);
|
||||
$stmt->execute();
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user