52 lines
1019 B
PHP
52 lines
1019 B
PHP
<?php
|
|
header('Content-Type: application/json');
|
|
|
|
include "./../lib/send_reply_json.php";
|
|
include "./../setup/connect_db.php";
|
|
|
|
$maestroID = $_POST["maestro_id"];
|
|
$appID = $_POST["app_id"];
|
|
|
|
|
|
deactivate_app($maestroID, $appID);
|
|
$appInfo = get_app_name($appID);
|
|
|
|
set_data("appName", $appInfo["AppName"]);
|
|
set_data("koreanName", $appInfo["KoreanName"]);
|
|
send_result_success();
|
|
exit;
|
|
|
|
|
|
function deactivate_app($maestroID, $appID) {
|
|
global $db_conn;
|
|
|
|
$query = "
|
|
DELETE FROM active_app
|
|
WHERE MaestroID = ? AND AppID = ?;
|
|
";
|
|
$stmt = $db_conn->prepare($query);
|
|
$stmt->bind_param('ii', $maestroID, $appID);
|
|
$stmt->execute();
|
|
$stmt->bind_result();
|
|
}
|
|
|
|
function get_app_name($appID) {
|
|
global $db_conn;
|
|
|
|
$query = "
|
|
SELECT AppName, KoreanName
|
|
FROM app
|
|
WHERE AppID = ?
|
|
";
|
|
$stmt = $db_conn->prepare($query);
|
|
$stmt->bind_param('i', $appID);
|
|
$stmt->execute();
|
|
$stmt->bind_result($appName, $koreanName);
|
|
$stmt->fetch();
|
|
|
|
$result["AppName"] = $appName;
|
|
$result["KoreanName"] = $koreanName;
|
|
return $result;
|
|
}
|
|
|
|
?>
|