Files
chocomae/src/web/server/player/player_experience_account.php
T

75 lines
1.7 KiB
PHP

<?php
header("Content-Type: application/json");
include "./../lib/send_reply_json.php";
include "./../setup/connect_db.php";
$maestroAccountType = 100;
$experienceMaestroInfo = get_experience_maestro_info();
if($experienceMaestroInfo === null) {
set_error_message("등록된 마에스트로 관리자 계정이 없습니다.");
send_result_fail();
exit;
}
$maestroTestPlayerInfo = get_maestro_test_player_info($experienceMaestroInfo["MaestroID"]);
set_data("maestroID", $experienceMaestroInfo["MaestroID"]);
set_data("maestroAccountType", $maestroAccountType);
set_data("playerID", $maestroTestPlayerInfo["PlayerID"]);
set_data("playerName", $maestroTestPlayerInfo["Name"]);
set_data("playerAccountType", $maestroTestPlayerInfo["AccountType"]);
send_result_success();
exit;
function get_experience_maestro_info() {
global $db_conn;
$query = "
SELECT MaestroID, MaestroTestID
FROM moty_maestro
WHERE AccountType = 100
";
$stmt = $db_conn->prepare($query);
// $stmt->bind_param("s", $maestro_name);
$stmt->execute();
$stmt->bind_result($maestroID, $maestroTestID);
// while($stmt->fetch()) {
// ;
// }
$stmt->fetch();
$stmt->close();
$result["MaestroID"] = $maestroID;
$result["MaestroTestID"] = $maestroTestID;
return $result;
}
function get_maestro_test_player_info($maestro_id) {
global $db_conn;
$query = "
SELECT PlayerID, Name, AccountType
FROM moty_player
WHERE MaestroID = ?
";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("i", $maestro_id);
$stmt->execute();
$stmt->bind_result($playerID, $name, $accountType);
// while($stmt->fetch()) {
// ;
// }
$stmt->fetch();
$stmt->close();
$result["PlayerID"] = $playerID;
$result["Name"] = $name;
$result["AccountType"] = $accountType;
return $result;
}
?>