Add: send mail - update maestro email / id
This commit is contained in:
@@ -3,18 +3,64 @@ header("Content-Type: application/json");
|
||||
|
||||
include "./../lib/send_reply_json.php";
|
||||
include "./../setup/connect_db.php";
|
||||
include "./../lib/maestro_account_info.php";
|
||||
include "./../lib/db_maestro.php";
|
||||
include "./../mail/mail_setting.php";
|
||||
include "./../mail/send_mail.php";
|
||||
|
||||
$maestroID = $_POST["maestro_id"];
|
||||
$maestroName = $_POST["maestro_name"];
|
||||
$email = $_POST["email"];
|
||||
|
||||
|
||||
$info = get_maestro_info($maestroID);
|
||||
if($info === null) {
|
||||
set_error_message("마에스트로 계정 정보를 가져올 수 없습니다.");
|
||||
send_result_fail();
|
||||
exit;
|
||||
}
|
||||
$maestro_name_prev = $info["name"];
|
||||
$email_prev = $info["email"];
|
||||
|
||||
|
||||
update_maestro_info($maestroID, $maestroName, $email);
|
||||
|
||||
if($maestroName != $maestro_name_prev)
|
||||
sendMailUpdateMaestroName($maestroName, $maestro_name_prev, $email);
|
||||
|
||||
if($email != $email_prev)
|
||||
sendMailUpdateMaestroEmail($maestroName, $email, $email_prev);
|
||||
|
||||
send_result_success();
|
||||
exit;
|
||||
|
||||
|
||||
|
||||
function get_maestro_info($maestroID) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "
|
||||
SELECT Name, Email, AccountType, AvailableActivateDateTime, PlayerCount
|
||||
FROM maestro
|
||||
WHERE MaestroID = ?
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param("s", $maestroID);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($name, $email, $accountType, $availableActivateDateTime, $playerCount);
|
||||
// while($stmt->fetch())
|
||||
$stmt->fetch();
|
||||
$stmt->close();
|
||||
|
||||
$info["name"] = $name;
|
||||
$info["email"] = $email;
|
||||
$info["accountType"] = $accountType;
|
||||
$info["availableActivateDateTime"] = $availableActivateDateTime;
|
||||
$info["playerCount"] = $playerCount;
|
||||
|
||||
return $info;
|
||||
}
|
||||
|
||||
function update_maestro_info($maestroID, $maestroName, $email) {
|
||||
global $db_conn;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user