82 lines
2.0 KiB
PHP
82 lines
2.0 KiB
PHP
<?php
|
|
header("Content-Type: application/json");
|
|
|
|
include "./../lib/send_reply_json.php";
|
|
include "./../setup/connect_db.php";
|
|
|
|
|
|
$maestro_test_account_id = get_maestro_test_account_id("test");
|
|
if($maestro_test_account_id === null) {
|
|
set_error_message("등록된 마에스트로 관리자 계정이 없습니다. (".$maestro_test_account_id.")");
|
|
send_result_fail();
|
|
exit;
|
|
}
|
|
|
|
$maestro_test_player_id = get_maestro_test_player_id($maestro_test_account_id);
|
|
if($maestro_test_player_id === null) {
|
|
set_error_message("등록된 마에스트로 관리자 계정이 없습니다. (".$maestro_test_account_id.")");
|
|
send_result_fail();
|
|
exit;
|
|
}
|
|
|
|
$maestro_test_player_name = get_maestro_test_player_name($maestro_test_player_id);
|
|
|
|
set_data("maestroID", $maestro_test_account_id);
|
|
set_data("playerID", $maestro_test_player_id);
|
|
set_data("playerName", $maestro_test_player_name);
|
|
send_result_success();
|
|
exit;
|
|
|
|
|
|
function get_maestro_test_account_id($maestro_name) {
|
|
global $db_conn;
|
|
|
|
$query = "SELECT MaestroID FROM moty_maestro WHERE Name=?";
|
|
$stmt = $db_conn->prepare($query);
|
|
$stmt->bind_param("s", $maestro_name);
|
|
$stmt->execute();
|
|
$stmt->bind_result($maestro_test_account_id);
|
|
// while($stmt->fetch()) {
|
|
// ;
|
|
// }
|
|
$stmt->fetch();
|
|
$stmt->close();
|
|
|
|
return $maestro_test_account_id;
|
|
}
|
|
|
|
function get_maestro_test_player_id($maestro_id) {
|
|
global $db_conn;
|
|
|
|
$query = "SELECT MaestroTestID FROM moty_maestro WHERE MaestroID=?";
|
|
$stmt = $db_conn->prepare($query);
|
|
$stmt->bind_param("i", $maestro_id);
|
|
$stmt->execute();
|
|
$stmt->bind_result($maestro_test_player_id);
|
|
// while($stmt->fetch()) {
|
|
// ;
|
|
// }
|
|
$stmt->fetch();
|
|
$stmt->close();
|
|
|
|
return $maestro_test_player_id;
|
|
}
|
|
|
|
function get_maestro_test_player_name($player_id) {
|
|
global $db_conn;
|
|
|
|
$query = "SELECT Name FROM moty_player WHERE PlayerID=?";
|
|
$stmt = $db_conn->prepare($query);
|
|
$stmt->bind_param("i", $player_id);
|
|
$stmt->execute();
|
|
$stmt->bind_result($maestro_test_player_name);
|
|
// while($stmt->fetch()) {
|
|
// ;
|
|
// }
|
|
$stmt->fetch();
|
|
$stmt->close();
|
|
|
|
return $maestro_test_player_name;
|
|
}
|
|
|
|
?>
|