Add: maestro, add player page - player allow edit entercode option (checkbox)

This commit is contained in:
2019-03-16 23:08:56 +09:00
parent a03eb243e1
commit 275efabdfb
4 changed files with 164 additions and 1 deletions
@@ -0,0 +1,43 @@
<?php
header("Content-Type: application/json");
include "./../lib/send_reply_json.php";
include "./../setup/connect_db.php";
$maestro_id = $_POST["maestro_id"];
$allow_edit_entercode = get_allow_edit_entercode($maestro_id);
/*
if($allow_edit_entercode !== null) {
set_error_code("no_data");
set_error_message("해당 정보가 없습니다.");
send_result_fail();
exit;
}
*/
set_data("AllowEditEnterCode", $allow_edit_entercode);
send_result_success();
exit;
function get_allow_edit_entercode($maestro_id) {
global $db_conn;
$query = "SELECT AllowEditEnterCode FROM maestro WHERE MaestroID=?";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("i", $maestro_id);
$stmt->execute();
$stmt->bind_result($allow_edit_entercode);
// while($stmt->fetch()) {
// ;
// }
$stmt->fetch();
$stmt->close();
return $allow_edit_entercode;
}
?>
@@ -0,0 +1,31 @@
<?php
header('Content-Type: application/json');
include "./../lib/send_reply_json.php";
include "./../setup/connect_db.php";
$maestroID = $_POST["maestro_id"];
$flagAllowEditEnterCode = $_POST["allowEditEnterCode"];
change_allow_edit_entercode($maestroID, $flagAllowEditEnterCode);
set_data("isActivated", $flagAllowEditEnterCode);
send_result_success();
exit;
function change_allow_edit_entercode($maestroID, $flagAllowEditEnterCode) {
global $db_conn;
$query = "
UPDATE maestro
SET AllowEditEnterCode = ?
WHERE MaestroID = ?
";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("ii", $flagAllowEditEnterCode, $maestroID);
$stmt->execute();
}
?>