Compare commits

..
8 Commits
Author SHA1 Message Date
jisangs d6d56e7938 PHP8.3 버전 warning 수정 2026-11-03 15:00:37 +09:00
jisangsandClaude Sonnet 5.5 ca078887a3 사용하지 않는 메일 발송 시험·구형 파일 삭제
관리자 기능 삭제로 호출처가 사라졌거나 서비스 코드가 참조하지 않는
메일 파일을 제거한다. 가입/정보 수정/연장·업그레이드 안내 메일과
배치 메일은 send_jinaju_mail.php를 계속 사용한다.

- send_mail_test.php, send_mail.php 삭제
- send_naver_mail.php, test_naver_mail.php 삭제
- send_gmail.php, test_gmail.php 삭제
- cloudOutboundMailerSample_20180928161712.php 삭제

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-02 18:20:27 +09:00
jisangsandClaude Sonnet 5.5 50aee3bb4e 초코어드민으로 분리된 관리자 기능 삭제
관리자 기능이 초코어드민 프로젝트로 분리되어 운영 중이므로
chocomae에 남아있던 관련 코드를 제거한다.

- src/web/admin (관리자 HTML 8개) 삭제
- src/web/server/admin (관리자 PHP 엔드포인트 9개) 삭제
- src/web/css/admin.css 삭제
- AGENTS.md, README.md에서 관리자 관련 안내 정리

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-02 18:13:43 +09:00
jisangs c268f0bb25 html.zip 파일 유출에 대응하기 위해서 DB 암호 변경 2026-11-01 21:33:55 +09:00
jisangs 5ee497bd4c 마에스트로 로그인 화면 암호 내용 토글 버튼 기능 추가 2026-10-26 14:57:23 +09:00
jisangs e9e3bcda50 mysqli 함수 안에서 "p:" 옵션 제거 (커넥션 풀이 아니었음. 영구 연결 기능임) 2026-10-25 16:51:40 +09:00
jisangs c1f9d9d127 XSS 공격 방지 2026-10-22 22:57:52 +09:00
jisangs 2fdf5aa9c7 TDD에서만 사용하는 변수가 운영 서버에서 경고 로그를 출력하는 오류 수정 2026-10-22 22:55:32 +09:00
39 changed files with 40 additions and 3561 deletions

No files matched your search

+1 -3
View File
@@ -45,7 +45,6 @@ src/
│ ├── js/ # 프론트엔드 JavaScript
│ ├── css/ # 스타일시트
│ ├── server/ # PHP 백엔드 엔드포인트
│ ├── admin/ # 관리자 패널 HTML
│ ├── popup/ # 팝업/모달 HTML
│ └── sql/ # 데이터베이스 스키마 및 시드 파일
├── php-cli/ # PHP 배치 스크립트 (cron으로 실행)
@@ -67,7 +66,6 @@ test/ # 수동 테스트용 HTML/JS 파일 (자동화된 테스트
- `player/` — 플레이어 계정 CRUD
- `record/` — 게임 결과 및 랭킹 저장/조회
- `maestro/` — 교사 학급 관리 (17개 엔드포인트)
- `admin/` — 관리자 운영 (11개 엔드포인트)
- `license_timer/` — 구독/라이선스 관리
- `mail/` — PHPMailer + Gmail SMTP를 통한 이메일 발송
- `lib/` — 공용 PHP 라이브러리 (`send_reply_json.php`, `db_maestro.php` 등)
@@ -86,7 +84,7 @@ test/ # 수동 테스트용 HTML/JS 파일 (자동화된 테스트
|------|-------------|
| Player | 게임을 플레이하는 최종 사용자 (무료 또는 유료) |
| Maestro | 학생 플레이어 그룹을 관리하는 교사 |
| Admin | 전체 권한을 가진 시스템 관리자 |
| Admin | 전체 권한을 가진 시스템 관리자 (별도 프로젝트인 초코어드민에서 운영) |
### Python 배치 스크립트
+1 -5
View File
@@ -7,7 +7,6 @@
- 초코마에 어드민
- https://chocoadmin.jinaju.com/
- 계정 정보: jisangs / friends
- (구) http://chocomae.jinaju.com/mouse_typing/src/web/admin/login.html
## 스테이지 서버
@@ -127,10 +126,7 @@ DB 운영, 관리 작업
- URL: chocomae.jinaju.com
- port: 3306
- DB 계정
- root / sEobMPuJ2A8KTfwU
- chocomae / sEobMPuJ2A8KTfwU
- backup / sEobMPuJ2A8KTfwU
- DB 계정: 계정 로그인 정보는 노션에서 확인
### 시놀로지 도커 DB
-188
View File
@@ -1,188 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta charset="UTF-8">
<title>마우스 타자 관리자 페이지</title>
<link rel="icon" href="/mouse_typing/resources/image/icon/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="/mouse_typing/resources/image/icon/favicon.ico" type="image/x-icon" />
<link href="../../../resources/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<script type="text/javascript" src="./../../../resources/jquery/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="./../js/main.js"></script>
<script type="text/javascript" src="./../js/request_server.js"></script>
<script type="text/javascript" src="./../../game/lib/util/number_util.js"></script>
<script type="text/javascript" src="./../js/lib/account_info.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#search_name").keydown(function(key) {
if(key.keyCode == 13) {
searchMaestro();
}
});
$("#header").load("admin_header.html");
loadMaestroList("");
});
function searchMaestro() {
var maestroName = $("#search_name").val();
console.log("searchMaestro : " + maestroName);
if(maestroName.length === 0) {
showErrorMessage("검색할 마에스트로 아이디를 입력하세요.", "error");
$("#search_name").focus();
}
loadMaestroList(maestroName);
}
function loadMaestroList(maestroName) {
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
"./../server/admin/maestro_all_list.php",
"maestro_name=" + maestroName,
function(jsonData) {
updateMaestroList(jsonData["maestroList"]);
},
function(errorMessage, errorCode) {
showErrorMessage(errorMessag, "error");
}
);
}
function updateMaestroList(jsonList) {
$("#maestro_list_result_contents").empty();
printContents(jsonList);
}
function printContents(jsonList) {
if(jsonList === undefined || jsonList.length === 0) {
$("#maestro_list_result_contents").append(
"<div class='alert alert-danger text-center' role='alert'>"
+ "마에스트로 계정 정보가 없습니다."
+ "</div>"
);
return;
}
for(var i = 0; i < jsonList.length; i++) {
var maestroInfo = jsonList[i];
var status = accountStatus(jsonList[i].accountType, jsonList[i].activateStatus);
var statusColorClass = accountStatusColorClass(status);
var type = accountType(jsonList[i].accountType);
var registerDate = jsonList[i].acceptClausesDateTime.substring(0, 10);
var availableDate = jsonList[i].availableActivateDateTime.substring(0, 10);
if(availableDate.charAt(0) == '0')
availableDate = "";
$("#maestro_list_result_contents").append(
"<div class='form-group player-list row mx-2 mb-1'>"
+ " <input type='text' class='maestro_id d-none' value='" + jsonList[i].maestroID + "'>"
+ " <input type='text' class='col-sm-1 text-right" + statusColorClass + "' value='" + status + "'>"
+ " <input type='text' class='col-sm text-left' value='" + jsonList[i].maestroName + "'>"
+ " <input type='text' class='col-sm text-right' value='" + type + "'>"
+ " <input type='text' class='col-sm text-right' value='" + registerDate + "'>"
+ " <input type='text' class='col-sm text-right' value='" + availableDate + "'>"
+ " <input type='text' class='col-sm-1 text-right' value='" + jsonList[i].playerCount + "'>"
+ " <input type='button' class='col-sm-1' disabled value='-' onClick=';'>"
+ "</div>"
);
}
}
function register(inputButton) {
// var id = $(inputButton).siblings(".maestro_id d-none");
// var maestroID = id.text();
var children = inputButton.parentElement.childNodes;
var maestroID = "";
for (var i=0; i < children.length; i++) {
// console.log(children);
if (children[i].className == "maestro_id d-none") {
maestroID = children[i].value;
break;
}
}
// console.log(maestroID);
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
"./../server/admin/register_maestro.php",
"maestro_id=" + maestroID,
function(jsonData) {
showErrorMessage("마에스트로 계정이 정상적으로 등록되었습니다.", "success");
loadMaestroList("");
},
function(errorMessage, errorCode) {
showErrorMessage(errorMessage, "error");
}
);
}
</script>
</head>
<body style="background-color: white">
<header id="header"></header>
<div class="container mt-3">
<div class="row mx-1">
<h3 class="my-3">마에스트로 전체 목록</h3>
</div>
<div id="message_box"></div>
<div class="row mx-1">
<div class="col">
<h5 class="my-3">마에스트로 검색</h5>
<div class="input-group mb-3">
<div class="input-group-prepend">
<label class="input-group-text" for="search_name">마에스트로 아이디</label>
</div>
<input type="text" class="form-control" id="search_name" placeholder="Input maestro ID here" aria-label="Recipient's username" aria-describedby="basic-addon2">
<div class="input-group-append">
<button type="button" class="btn btn-primary" onClick="searchMaestro()">검색 실행</button>
</div>
</div>
</div>
</div>
<div class="row mx-1">
<div class="col border border-warning rounded" style="background-color: #ffeab6">
<h5 class="my-3">검색 결과</h5>
<form id="search_player_list">
<div class="form-group row mx-2 mb-0 font-weight-bold">
<label class="col-form-label col-sm-1 text-center">타입</label>
<label class="col-form-label d-none">ID</label>
<label class="col-form-label col-sm text-left">마에스트로 아이디</label>
<label class="col-form-label col-sm text-right">요금제</label>
<label class="col-form-label col-sm text-right">등록일</label>
<label class="col-form-label col-sm text-right">유효기간</label>
<label class="col-form-label col-sm-1 text-right">학생수</label>
<label class="col-form-label col-sm-1 text-center">비활성화</label>
</div>
<div id="maestro_list_result_contents"></div>
</form>
</div> <!-- 학생 목록 -->
</div>
</div> <!-- container -->
</body>
</html>
-76
View File
@@ -1,76 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta charset="UTF-8">
<title>마우스 타자 관리자 페이지</title>
<link rel="icon" href="/mouse_typing/resources/image/icon/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="/mouse_typing/resources/image/icon/favicon.ico" type="image/x-icon" />
<link href="../../../resources/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<script type="text/javascript" src="./../../../resources/jquery/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="./../js/main.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#header").load("admin_header.html");
});
</script>
</head>
<body style="background-color: white">
<header id="header"></header>
<div class="container mt-3">
<div class="row mx-1">
<h3 class="my-3">계정 유효기간 만료 목록</h3>
</div>
<div id="message_box"></div>
<div class="row mx-1">
<div class="col">
<h5 class="my-3">마에스트로 검색</h5>
<div class="input-group mb-3">
<div class="input-group-prepend">
<label class="input-group-text" for="search_name">마에스트로 아이디</label>
</div>
<input type="text" class="form-control" id="search_name" placeholder="Input maestro ID here" aria-label="Recipient's username" aria-describedby="basic-addon2">
<div class="input-group-append">
<button type="button" class="btn btn-primary">검색 실행</button>
</div>
</div>
</div>
</div>
<div class="row mx-1">
<div class="col border border-warning rounded" style="background-color: #ffeab6">
<h5 class="my-3">검색 결과</h5>
<form id="search_player_list">
<div class="form-group row mx-2 mb-0 font-weight-bold">
<label class="col-form-label d-none">Upgrade ID</label>
<label class="col-form-label col-sm text-center">아이디</label>
<label class="col-form-label col-sm text-center">현재 계정</label>
<label class="col-form-label col-sm text-center">업그레이드</label>
<label class="col-form-label col-sm text-center">추가 금액</label>
<label class="col-form-label col-sm text-center">요청 날짜</label>
<label class="col-form-label col-sm-1 text-center"></label>
</div>
<div id="maestro_list_result_contents"></div>
</form>
</div> <!-- 학생 목록 -->
</div>
</div> <!-- container -->
</body>
</html>
-248
View File
@@ -1,248 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta charset="UTF-8">
<title>마우스 타자 관리자 페이지</title>
<link rel="icon" href="/mouse_typing/resources/image/icon/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="/mouse_typing/resources/image/icon/favicon.ico" type="image/x-icon" />
<link href="../../../resources/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<script type="text/javascript" src="./../../../resources/jquery/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="./../../game/lib/util/number_util.js"></script>
<script type="text/javascript" src="./../js/main.js"></script>
<script type="text/javascript" src="./../js/maestro_available_date.js"></script>
<script type="text/javascript" src="./../js/request_server.js"></script>
<script type="text/javascript" src="./../js/lib/account_info.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#search_name").keydown(function(key) {
if(key.keyCode == 13) {
searchMaestroExtension();
}
});
$("#header").load("admin_header.html");
loadMaestroExtensionList("");
});
function loadMaestroExtensionList(maestroName) {
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
"./../server/admin/maestro_extension_list.php",
"maestro_name=" + maestroName,
function(jsonData) {
updateMaestroExtensionList(jsonData["maestroExtensionList"]);
},
function(errorMessage, errorCode) {
console.log(errorMessage);
if($("#error_message").length) {
$("#error_message").text(errorMessage);
}
}
);
}
function updateMaestroExtensionList(jsonList) {
$("#maestro_list_result_contents").empty();
printContents(jsonList);
}
function printContents(jsonList) {
if(jsonList === undefined || jsonList.length === 0) {
$("#maestro_list_result_contents").append(
"<div class='alert alert-danger text-center' role='alert'>"
+ "마에스트로 계정 정보가 없습니다."
+ "</div>"
);
return;
}
for(var i = 0; i < jsonList.length; i++) {
if(jsonList[i].status == 1) {
$("#maestro_list_result_contents").append(
"<div class='form-group player-list row mx-2 mb-1'>"
+ " <input type='text' class='maestro_extension_id d-none' disabled value='" + jsonList[i].maestroExtensionID + "'>"
+ " <input type='text' class='maestro_id d-none' disabled value='" + jsonList[i].maestroID + "'>"
+ " <input type='text' class='maestro_name col-sm' disabled value='" + jsonList[i].maestroName + "'>"
+ " <input type='text' class='registered_account_type col-sm text-right' disabled value='" + accountType(jsonList[i].registeredAccountType) + "'>"
+ " <input type='text' class='availableDate col-sm text-right' disabled value='" + jsonList[i].availableActivateDateTime.substring(0, 10) + "'>"
// + " <input type='text' class='new_account_type col-sm text-right' disabled value='" + accountType(jsonList[i].requestedAccountType) + "'>"
+ " <input type='text' class='col-sm text-right' disabled value='" + jsonList[i].requestedDateTime.substring(0, 10) + "'>"
// + " <input type='text' class='col-sm text-right' disabled value='" + NumberUtil.numberWithCommas(price(jsonList[i].requestedAccountType, jsonList[i].registeredAccountType)) + "'>"
+ " <input type='text' class='col-sm' disabled value='" + status(jsonList[i].status) + "'>"
+ " <input type='button' class='col-sm-1' value='↑' onClick='extend(this)'>"
+ "</div>"
);
} else {
$("#maestro_list_result_contents").append(
"<div class='form-group player-list row mx-2 mb-1'>"
+ " <input type='text' class='maestro_extension_id d-none' disabled value='" + jsonList[i].maestroExtensionID + "'>"
+ " <input type='text' class='maestro_id d-none' disabled value='" + jsonList[i].maestroID + "'>"
+ " <input type='text' class='maestro_name col-sm text-success' disabled value='" + jsonList[i].maestroName + "'>"
+ " <input type='text' class='registered_account_type col-sm text-right text-success' disabled value='" + accountType(jsonList[i].registeredAccountType) + "'>"
+ " <input type='text' class='availableDate col-sm text-right' disabled value='" + jsonList[i].availableActivateDateTime.substring(0, 10) + "'>"
// + " <input type='text' class='new_account_type col-sm text-right text-success' disabled value='" + accountType(jsonList[i].requestedAccountType) + "'>"
+ " <input type='text' class='col-sm text-success text-right' disabled value='" + jsonList[i].requestedDateTime.substring(0, 10) + "'>"
// + " <input type='text' class='col-sm text-success' disabled value='" + NumberUtil.numberWithCommas(price(jsonList[i].requestedAccountType, jsonList[i].registeredAccountType)) + "'>"
+ " <input type='text' class='col-sm text-success' disabled value='" + status(jsonList[i].status) + "'>"
+ " <input type='button' class='col-sm-1' disabled value='Ω' onClick='extend(this)'>"
+ "</div>"
);
}
}
}
function searchMaestroExtension() {
var maestroName = $("#search_name").val();
if(maestroName.length === 0) {
$("#error_message").text("마에스트로 아이디를 입력하세요.");
$("#search_name").focus();
}
loadMaestroExtensionList(maestroName);
}
function extend(inputButton) {
// var extensionID = $(inputButton).siblings(".maestro_extension_id");
// var maestroExtensionID = extensionID.text();
// var maestroID = $(inputButton).siblings(".maestro_id");
// var id = maestroID.text();
// var accountType = $(inputButton).siblings(".requested_account_type");
var children = inputButton.parentElement.childNodes;
var maestroExtensionID;
var maestroID;
var maestroName;
var availableDate;
var registeredAccountType;
for (var i=0; i < children.length; i++) {
// console.log(children);
if (children[i].className == "maestro_extension_id d-none") {
maestroExtensionID = children[i].value;
continue;
} else if (children[i].className == "maestro_id d-none") {
maestroID = children[i].value;
continue;
} else if (children[i].className == "maestro_name col-sm") {
maestroName = children[i].value;
continue;
} else if (children[i].className == "maestro_name col-sm text-success") {
maestroName = children[i].value;
continue;
} else if (children[i].className == "availableDate col-sm text-right") {
availableDate = children[i].value;
continue;
} else if (children[i].className == "registered_account_type col-sm text-right") {
registeredAccountType = accountTypeValue(children[i].value);
continue;
}
}
var availableDateArray = availableDate.split("-");
// console.log("year : " + availableDateArray[0]);
// console.log("month : " + availableDateArray[1]);
// console.log("day : " + availableDateArray[2]);
var endDate = new Date(availableDateArray[0], availableDateArray[1] - 1, availableDateArray[2]);
// console.log("endDate : " + endDate);
var maestroAvailableDate = new MaestroAvailableDate();
maestroAvailableDate.setEndDate(endDate);
newAvailableDate = maestroAvailableDate.getNewAvailableDate();
// console.log("newAvailableDate : " + newAvailableDate);
// console.log(maestroExtensionID);
// console.log(maestroID);
// console.log(maestroName);
// // console.log(availableDate);
// console.log(newAvailableDate);
// console.log(registeredAccountType);
// return;
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
"./../server/admin/extension_maestro.php",
// $maestro_name, $new_available_date, $maestro_email
"maestro_extension_id=" + maestroExtensionID
+ "&maestro_id=" + maestroID
+ "&maestro_name=" + maestroName
+ "&new_available_date=" + newAvailableDate
+ "&registered_account_type=" + registeredAccountType,
function(jsonData) {
loadMaestroExtensionList("");
$("#error_message").text(jsonData.maestroName + " 계정의 유효 기간이 1년 연장되었습니다.");
},
function(errorMessage, errorCode) {
if($("#error_message").length) {
$("#error_message").text(errorMessage);
}
}
);
}
</script>
</head>
<body style="background-color: white">
<header id="header"></header>
<div class="container mt-3">
<div class="row mx-1">
<h3 class="my-3">마에스트로 유효 기간 연장 목록</h3>
</div>
<div id="message_box"></div>
<div class="row mx-1">
<div class="col">
<h5 class="my-3">마에스트로 검색</h5>
<div class="input-group mb-3">
<div class="input-group-prepend">
<label class="input-group-text" for="search_name">마에스트로 아이디</label>
</div>
<input type="text" class="form-control" id="search_name" placeholder="Input maestro ID here" aria-label="Recipient's username" aria-describedby="basic-addon2">
<div class="input-group-append">
<button type="button" class="btn btn-primary" onClick="searchMaestroExtension()">검색 실행</button>
</div>
</div>
</div>
</div>
<div class="row mx-1">
<div class="col border border-warning rounded" style="background-color: #ffeab6">
<h5 class="my-3">검색 결과</h5>
<form id="search_player_list">
<div class="form-group row mx-2 mb-0 font-weight-bold">
<label class="col-form-label d-none">Extension ID</label>
<label class="col-form-label col-sm text-left">아이디</label>
<label class="col-form-label col-sm text-right">요금제</label>
<label class="col-form-label col-sm text-right">유효기간</label>
<label class="col-form-label col-sm text-right">연장 신청일</label>
<label class="col-form-label col-sm text-left">상태</label>
<label class="col-form-label col-sm-1 text-center">승인</label>
</div>
<div id="maestro_list_result_contents"></div>
</form>
</div> <!-- 학생 목록 -->
</div>
</div> <!-- container -->
</body>
</html>
-47
View File
@@ -1,47 +0,0 @@
<!DOCTYPE html>
<style>
.home {
display: inline-block;
float: left;
padding: 0px;
margin: 0px;
}
.header_menu {
float: right;
padding: 0px;
margin: 0px;
}
.header_menu li {
float: left;
list-style: none;
}
</style>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark py-3">
<div class="container">
<div class="navbar-header">
<a class="btn btn-warning btn-lg vertical-align: middle; align-items-center" href="./../main/index.html">
<img src="./../../../resources/image/icon/icon_chocomae.png" style="position: relative; bottom: 2px; width: 24px; height: auto;">
&nbsp;초코마에
</a>
</div>
<div class="eyebrow ml-auto mt-0 d-md-flex align-items-center">
<a class="btn btn-outline-warning btn-lg mr-2" href="./../admin/admin_all_list.html">전체</a>
<a class="btn btn-outline-warning btn-lg mr-2" href="./../admin/admin_register_list.html">신규 등록</a>
<a class="btn btn-outline-warning btn-lg mr-2" href="./../admin/admin_extension_list.html">연장</a>
<a class="btn btn-outline-warning btn-lg mr-2" href="./../admin/admin_upgrade_list.html">업그레이드</a>
<a class="btn btn-outline-warning btn-lg mr-2" href="./../admin/admin_expiration_list.html">계정 만료</a>
<a class="btn btn-primary btn-lg" href="./../admin/admin_send_email.html">이메일 발송</a>
</div>
</div> <!-- container -->
</nav>
-175
View File
@@ -1,175 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta charset="UTF-8">
<title>마우스 타자 관리자 페이지</title>
<link rel="icon" href="/mouse_typing/resources/image/icon/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="/mouse_typing/resources/image/icon/favicon.ico" type="image/x-icon" />
<link href="../../../resources/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<script type="text/javascript" src="./../../../resources/jquery/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="./../js/main.js"></script>
<script type="text/javascript" src="./../js/request_server.js"></script>
<script type="text/javascript" src="./../../game/lib/util/number_util.js"></script>
<script type="text/javascript" src="./../js/lib/account_info.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#search_name").keydown(function(key) {
if(key.keyCode == 13) {
searchMaestro();
}
});
$("#header").load("admin_header.html");
loadMaestroList("");
});
function searchMaestro() {
var maestroName = $("#search_name").val();
console.log("searchMaestro : " + maestroName);
if(maestroName.length === 0) {
showErrorMessage("검색할 마에스트로 아이디를 입력하세요.", "error");
$("#search_name").focus();
}
loadMaestroList(maestroName);
}
function loadMaestroList(maestroName) {
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
"./../server/admin/maestro_registered_list.php",
"maestro_name=" + maestroName,
function(jsonData) {
updateMaestroList(jsonData["maestroList"]);
},
function(errorMessage, errorCode) {
showErrorMessage(errorMessag, "error");
}
);
}
function updateMaestroList(jsonList) {
$("#maestro_list_result_contents").empty();
printContents(jsonList);
}
function printContents(jsonList) {
if(jsonList === undefined || jsonList.length === 0) {
$("#maestro_list_result_contents").append(
"<div class='alert alert-danger text-center' role='alert'>"
+ "마에스트로 계정 정보가 없습니다."
+ "</div>"
);
return;
}
for(var i = 0; i < jsonList.length; i++) {
$("#maestro_list_result_contents").append(
"<div class='form-group player-list row mx-2 mb-1'>"
+ " <input type='text' class='maestro_id d-none' value='" + jsonList[i].maestroID + "'>"
+ " <input type='text' class='col-sm' value='" + jsonList[i].maestroName + "'>"
+ " <input type='text' class='col-sm text-right' value='" + accountType(jsonList[i].accountType) + "'>"
+ " <input type='text' class='col-sm text-right' value='" + jsonList[i].acceptClausesDateTime.substring(0, 10) + "'>"
+ " <input type='button' class='col-sm-1' value='+' onClick='register(this)'>"
+ " <input type='button' class='col-sm-1' disabled value='-'>"
+ "</div>"
);
}
}
function register(inputButton) {
// var id = $(inputButton).siblings(".maestro_id d-none");
// var maestroID = id.text();
var children = inputButton.parentElement.childNodes;
var maestroID = "";
for (var i=0; i < children.length; i++) {
// console.log(children);
if (children[i].className == "maestro_id d-none") {
maestroID = children[i].value;
break;
}
}
// console.log(maestroID);
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
"./../server/admin/register_maestro.php",
"maestro_id=" + maestroID,
function(jsonData) {
showErrorMessage("마에스트로 계정이 정상적으로 등록되었습니다.", "success");
loadMaestroList("");
},
function(errorMessage, errorCode) {
showErrorMessage(errorMessage, "error");
}
);
}
</script>
</head>
<body style="background-color: white">
<header id="header"></header>
<div class="container mt-3">
<div class="row mx-1">
<h3 class="my-3">신규 마에스트로 등록 목록</h3>
</div>
<div id="message_box"></div>
<div class="row mx-1">
<div class="col">
<h5 class="my-3">마에스트로 검색</h5>
<div class="input-group mb-3">
<div class="input-group-prepend">
<label class="input-group-text" for="search_name">마에스트로 아이디</label>
</div>
<input type="text" class="form-control" id="search_name" placeholder="Input maestro ID here" aria-label="Recipient's username" aria-describedby="basic-addon2">
<div class="input-group-append">
<button type="button" class="btn btn-primary" onClick="searchMaestro()">검색 실행</button>
</div>
</div>
</div>
</div>
<div class="row mx-1">
<div class="col border border-warning rounded" style="background-color: #ffeab6">
<h5 class="my-3">검색 결과</h5>
<form id="search_player_list">
<div class="form-group row mx-2 mb-0 font-weight-bold">
<label class="col-form-label d-none">ID</label>
<label class="col-form-label col-sm text-left">마에스트로 아이디</label>
<label class="col-form-label col-sm text-right">요금제</label>
<label class="col-form-label col-sm text-right">등록일</label>
<label class="col-form-label col-sm-1 text-center">승인</label>
<label class="col-form-label col-sm-1 text-center">삭제</label>
</div>
<div id="maestro_list_result_contents"></div>
</form>
</div> <!-- 학생 목록 -->
</div>
</div> <!-- container -->
</body>
</html>
-320
View File
@@ -1,320 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta charset="UTF-8">
<title>마우스 타자 관리자 페이지</title>
<link rel="icon" href="/mouse_typing/resources/image/icon/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="/mouse_typing/resources/image/icon/favicon.ico" type="image/x-icon" />
<link href="../../../resources/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<script type="text/javascript" src="./../../../resources/jquery/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="./../js/main.js"></script>
<script type="text/javascript" src="./../js/request_server.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#header").load("admin_header.html");
});
function sendNaverMail() {
var maestroName = "삼화초";
var email = "jisangs@daum.net";
var accountType = 1;
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
"./../server/mail/send_mail_test.php",
"",
function(jsonData) {
console.log(jsonData);
// showErrorMessage("마에스트로 계정이 정상적으로 등록되었습니다.", "success");
// loadMaestroList("");
},
function(errorMessage, errorCode) {
showErrorMessage(errorMessage, "error");
}
);
}
function sendMailRegisterBankInfo() {
var maestroName = "삼화초";
var email = "jisangs@daum.net";
var accountType = 1;
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
// "./../server/mail/send_mail_bank_info.php",
"./../server/mail/send_mail_test.php",
"type=sendMailRegisterBankInfo" + "&maestro_name=" + maestroName + "&email=" + email + "&account_type=" + accountType,
function(jsonData) {
console.log(jsonData);
// showErrorMessage("마에스트로 계정이 정상적으로 등록되었습니다.", "success");
// loadMaestroList("");
},
function(errorMessage, errorCode) {
showErrorMessage(errorMessage, "error");
}
);
}
function sendMailRegisterDone() {
var maestroName = "삼화초";
var email = "jisangs@daum.net";
var accountType = 1;
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
// "./../server/mail/send_mail_bank_info.php",
"./../server/mail/send_mail_test.php",
"type=sendMailRegistered" + "&maestro_name=" + maestroName + "&email=" + email + "&account_type=" + accountType,
function(jsonData) {
console.log(jsonData);
// showErrorMessage("마에스트로 계정이 정상적으로 등록되었습니다.", "success");
// loadMaestroList("");
},
function(errorMessage, errorCode) {
showErrorMessage(errorMessage, "error");
}
);
}
function sendMailUpgradeBankInfo() {
var maestroName = "삼화초";
var email = "jisangs@daum.net";
var accountType = 1;
var upgradeAccountType = 3;
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
// "./../server/mail/send_mail_bank_info.php",
"./../server/mail/send_mail_test.php",
"type=sendMailUpgradeBankInfo" + "&maestro_name=" + maestroName + "&email=" + email + "&account_type=" + accountType + "&upgrade_account_type=" + upgradeAccountType,
function(jsonData) {
console.log(jsonData);
// showErrorMessage("마에스트로 계정이 정상적으로 등록되었습니다.", "success");
// loadMaestroList("");
},
function(errorMessage, errorCode) {
showErrorMessage(errorMessage, "error");
}
);
}
function sendMailUpgradeDone() {
var maestroName = "삼화초";
var email = "jisangs@daum.net";
var accountType = 1;
var upgradeAccountType = 3;
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
// "./../server/mail/send_mail_bank_info.php",
"./../server/mail/send_mail_test.php",
"type=sendMailUpgradeDone" + "&maestro_name=" + maestroName + "&email=" + email + "&account_type=" + accountType + "&upgrade_account_type=" + upgradeAccountType,
function(jsonData) {
console.log(jsonData);
// showErrorMessage("마에스트로 계정이 정상적으로 등록되었습니다.", "success");
// loadMaestroList("");
},
function(errorMessage, errorCode) {
showErrorMessage(errorMessage, "error");
}
);
}
function sendMailUpdateMaestroName() {
var maestroNamePrev = "삼화초전전전";
var maestroName = "삼화초후후후";
var email = "jisangs@daum.net";
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
// "./../server/mail/send_mail_bank_info.php",
"./../server/mail/send_mail_test.php",
"type=sendMailUpdateMaestroName" + "&maestro_name=" + maestroName + "&maestro_name_prev=" + maestroNamePrev + "&email=" + email,
function(jsonData) {
console.log(jsonData);
// showErrorMessage("마에스트로 계정이 정상적으로 등록되었습니다.", "success");
// loadMaestroList("");
},
function(errorMessage, errorCode) {
showErrorMessage(errorMessage, "error");
}
);
}
function sendMailUpdateMaestroEmail() {
var maestroName = "삼화초";
var emailPrev = "jisangs@daum.net";
var email = encodeURIComponent("support+chocomae.automail@jinaju.com"); // "jisangs@gmail.com";
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
// "./../server/mail/send_mail_bank_info.php",
"./../server/mail/send_mail_test.php",
"type=sendMailUpdateMaestroEmail" + "&maestro_name=" + maestroName + "&email=" + email + "&email_prev=" + emailPrev,
function(jsonData) {
console.log(jsonData);
// showErrorMessage("마에스트로 계정이 정상적으로 등록되었습니다.", "success");
// loadMaestroList("");
},
function(errorMessage, errorCode) {
showErrorMessage(errorMessage, "error");
}
);
}
function sendMailExtensionBankInfo() {
var maestroName = "삼화초";
var maestroEmail = "jisangs@daum.net";
var availableDate = "2019-11-16";
var newAvailableDate = "2020-11-16";
var registeredAccountType = 3;
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
"./../server/mail/send_mail_test.php",
"type=sendMailExtensionBankInfo"
// $maestro_name, $available_date, $new_available_date, $maestro_email, $registered_account_type
+ "&maestro_name=" + maestroName
+ "&available_date=" + availableDate
+ "&new_available_date=" + newAvailableDate
+ "&email=" + maestroEmail
+ "&registered_account_type=" + registeredAccountType,
function(jsonData) {
console.log(jsonData);
// showErrorMessage("마에스트로 계정이 정상적으로 등록되었습니다.", "success");
// loadMaestroList("");
},
function(errorMessage, errorCode) {
showErrorMessage(errorMessage, "error");
}
);
}
function sendMailExtensionDone() {
var maestroName = "삼화초";
var maestroEmail = "jisangs@daum.net";
var newAvailableDate = "2020-11-16";
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
// "./../server/mail/send_mail_bank_info.php",
"./../server/mail/send_mail_test.php",
"type=sendMailExtensionDone"
// $maestro_name, $new_available_date, $maestro_email
+ "&maestro_name=" + maestroName
+ "&email=" + maestroEmail
+ "&new_available_date=" + newAvailableDate,
function(jsonData) {
console.log(jsonData);
// showErrorMessage("마에스트로 계정이 정상적으로 등록되었습니다.", "success");
// loadMaestroList("");
},
function(errorMessage, errorCode) {
showErrorMessage(errorMessage, "error");
}
);
}
function getMaestroData() {
var maestroID = 1;
var maestroName = "삼화초";
var email = "jisangs@daum.net";
var accountType = 1;
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
// "./../server/mail/send_mail_bank_info.php",
"./../server/mail/send_mail_test.php",
// "type=get_maestro_data" + "&maestro_id=" + maestroID,
"type=get_maestro_data" + "&maestro_id=" + maestroID + "&maestro_name=" + maestroName + "&email=" + email + "&account_type=" + accountType,
function(jsonData) {
console.log(jsonData);
// showErrorMessage("마에스트로 계정이 정상적으로 등록되었습니다.", "success");
// loadMaestroList("");
},
function(errorMessage, errorCode) {
showErrorMessage(errorMessage, "error");
}
);
}
</script>
</head>
<body style="background-color: white">
<header id="header"></header>
<div class="container mt-3">
<div class="row mx-1">
<h3 class="my-3">이메일 발송</h3>
</div>
<div id="message_box"></div>
<button type="button" class="btn btn-primary" onClick="sendNaverMail()">네이버 메일 발송</button>
<br/>
<br/>
<button type="button" class="btn btn-primary" onClick="sendMailRegisterBankInfo()">[ 마에 ] 입금 계좌 안내 메일 발송</button>
<button type="button" class="btn btn-primary" onClick="sendMailRegisterDone()">[ 마에 ] 등록 완료 메일 발송</button>
<br/>
<br/>
<button type="button" class="btn btn-primary" onClick="sendMailUpgradeBankInfo()">[ 마에 ] 업그레이드 - 입금 계좌 안내 메일 발송</button>
<button type="button" class="btn btn-primary" onClick="sendMailUpgradeDone()">[ 마에 ] 업그레이드 완료 메일 발송</button>
<br/>
<br/>
<button type="button" class="btn btn-primary" onClick="sendMailUpdateMaestroName()">[ 마에 ] 정보 변경 - 아이디</button>
<button type="button" class="btn btn-primary" onClick="sendMailUpdateMaestroEmail()">[ 마에 ] 정보 변경 - 이메일</button>
<br/>
<br/>
<button type="button" class="btn btn-primary" onClick="sendMailExtensionBankInfo()">[ 마에 ] 연장 신청</button>
<button type="button" class="btn btn-primary" onClick="sendMailExtensionDone()">[ 마에 ] 연장 승인</button>
<br/>
<br/>
<button type="button" class="btn btn-secondary" onClick="getMaestroData()">마에스트로 데이터 테스트</button>
</div> <!-- container -->
</body>
</html>
-256
View File
@@ -1,256 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta charset="UTF-8">
<title>마우스 타자 관리자 페이지</title>
<link rel="icon" href="/mouse_typing/resources/image/icon/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="/mouse_typing/resources/image/icon/favicon.ico" type="image/x-icon" />
<link href="../../../resources/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<script type="text/javascript" src="./../../../resources/jquery/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="./../../game/lib/util/number_util.js"></script>
<script type="text/javascript" src="./../js/main.js"></script>
<script type="text/javascript" src="./../js/request_server.js"></script>
<script type="text/javascript" src="./../js/lib/account_info.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#search_name").keydown(function(key) {
if(key.keyCode == 13) {
searchMaestroUpgrade();
}
});
$("#header").load("admin_header.html");
loadMaestroUpgradeList("");
});
function loadMaestroUpgradeList(maestroName) {
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
"./../server/admin/maestro_upgrade_list.php",
"maestro_name=" + maestroName,
function(jsonData) {
updateMaestroUpgradeList(jsonData["maestroUpgradeList"]);
},
function(errorMessage, errorCode) {
console.log(errorMessage);
if($("#error_message").length) {
$("#error_message").text(errorMessage);
}
}
);
}
function updateMaestroUpgradeList(jsonList) {
$("#maestro_list_result_contents").empty();
printContents(jsonList);
}
function printContents(jsonList) {
if(jsonList === undefined || jsonList.length === 0) {
$("#maestro_list_result_contents").append(
"<div class='alert alert-danger text-center' role='alert'>"
+ "마에스트로 계정 정보가 없습니다."
+ "</div>"
);
return;
}
for(var i = 0; i < jsonList.length; i++) {
if(jsonList[i].status == 1) { // 요청
var tableRowString =
"<div class='form-group player-list row mx-2 mb-1'>"
+ " <input type='text' class='maestro_upgrade_id d-none' disabled value='" + jsonList[i].maestroUpgradeID + "'>"
+ " <input type='text' class='maestro_id d-none' disabled value='" + jsonList[i].maestroID + "'>"
+ " <input type='text' class='col-sm' disabled value='" + jsonList[i].maestroName + "'>"
+ " <input type='text' class='registered_activate_status col-sm text-right' disabled value='" + activateStatus(jsonList[i].registeredActivateStatus) + "'>";
if(jsonList[i].registeredActivateStatus == 1) { // 체험
tableRowString +=
" <input type='text' class='registered_account_type col-sm text-right' disabled value='" + trialAccountType(jsonList[i].registeredAccountType) + "'>";
} else { // 0: 미승인, 2: 활성화, 100: 환불
tableRowString +=
" <input type='text' class='registered_account_type col-sm text-right' disabled value='" + accountType(jsonList[i].registeredAccountType) + "'>"
}
tableRowString +=
" <input type='text' class='col-sm text-right' disabled value='" + jsonList[i].availableActivateDateTime.substring(0, 10) + "'>"
+ " <input type='text' class='new_account_type col-sm text-right' disabled value='" + accountType(jsonList[i].requestedAccountType) + "'>"
+ " <input type='text' class='col-sm text-right' disabled value='" + jsonList[i].requestedDateTime.substring(0, 10) + "'>";
if(jsonList[i].registeredActivateStatus == 1) { // 체험
tableRowString +=
" <input type='text' class='col-sm text-right' disabled value='" + NumberUtil.numberWithCommas(accountTypePrice(jsonList[i].requestedAccountType)) + "'>";
} else { // 0: 미승인, 2: 활성화, 100: 환불
tableRowString +=
" <input type='text' class='col-sm text-right' disabled value='" + NumberUtil.numberWithCommas(price(jsonList[i].requestedAccountType, jsonList[i].registeredAccountType)) + "'>";
}
tableRowString +=
" <input type='text' class='col-sm' disabled value='" + status(jsonList[i].status) + "'>"
+ " <input type='button' class='col-sm-1' value='↑' onClick='upgrade(this)'>"
+ "</div>";
$("#maestro_list_result_contents").append(tableRowString);
}
/*
else { // status == 2: 취소, 3: 업그레이드 적용
$("#maestro_list_result_contents").append(
"<div class='form-group player-list row mx-2 mb-1'>"
+ " <input type='text' class='maestro_upgrade_id d-none' disabled value='" + jsonList[i].maestroUpgradeID + "'>"
+ " <input type='text' class='maestro_id d-none' disabled value='" + jsonList[i].maestroID + "'>"
+ " <input type='text' class='col-sm text-success' disabled value='" + jsonList[i].maestroName + "'>"
+ " <input type='text' class='registered_account_type col-sm text-right text-success' disabled value='" + activateStatus(jsonList[i].registeredActivateStatus) + "'>"
+ " <input type='text' class='registered_account_type col-sm text-right text-success' disabled value='" + accountType(jsonList[i].registeredAccountType) + "'>"
+ " <input type='text' class='col-sm text-right' disabled value='" + jsonList[i].availableActivateDateTime.substring(0, 10) + "'>"
+ " <input type='text' class='new_account_type col-sm text-right text-success' disabled value='" + accountType(jsonList[i].requestedAccountType) + "'>"
+ " <input type='text' class='col-sm text-success text-right' disabled value='" + jsonList[i].requestedDateTime.substring(0, 10) + "'>"
+ " <input type='text' class='col-sm text-success' disabled value='" + NumberUtil.numberWithCommas(price(jsonList[i].requestedAccountType, jsonList[i].registeredAccountType)) + "'>"
+ " <input type='text' class='col-sm text-success' disabled value='" + status(jsonList[i].status) + "'>"
+ " <input type='button' class='col-sm-1' disabled value='Ω' onClick='upgrade(this)'>"
+ "</div>"
);
}
*/
}
}
function searchMaestroUpgrade() {
var maestroName = $("#search_name").val();
if(maestroName.length === 0) {
$("#error_message").text("마에스트로 아이디를 입력하세요.");
$("#search_name").focus();
}
loadMaestroUpgradeList(maestroName);
}
function upgrade(inputButton) {
// var upgradeID = $(inputButton).siblings(".maestro_upgrade_id");
// var maestroUpgradeID = upgradeID.text();
// var maestroID = $(inputButton).siblings(".maestro_id");
// var id = maestroID.text();
// var accountType = $(inputButton).siblings(".requested_account_type");
// var upgradeAccountType = accountTypeValue(accountType.val());
var children = inputButton.parentElement.childNodes;
var maestroUpgradeID;
var maestroID;
var registeredActiveStatus;
var registeredAccountType;
var upgradeAccountType;
for (var i=0; i < children.length; i++) {
// console.log(children);
if (children[i].className == "maestro_upgrade_id d-none") {
maestroUpgradeID = children[i].value;
continue;
} else if (children[i].className == "maestro_id d-none") {
maestroID = children[i].value;
continue;
} else if (children[i].className == "registered_activate_status col-sm text-right") {
// upgradeAccountType = children[i].value;
registeredActiveStatus = activateStatusValue(children[i].value);
continue;
} else if (children[i].className == "registered_account_type col-sm text-right") {
// upgradeAccountType = children[i].value;
registeredAccountType = accountTypeValue(children[i].value);
continue;
} else if (children[i].className == "new_account_type col-sm text-right") {
// upgradeAccountType = children[i].value;
upgradeAccountType = accountTypeValue(children[i].value);
continue;
}
}
// console.log(maestroUpgradeID);
// console.log(maestroID);
// console.log(registeredAccountType);
// console.log(upgradeAccountType);
// return;
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
"./../server/admin/upgrade_maestro.php",
"maestro_upgrade_id=" + maestroUpgradeID
+ "&maestro_id=" + maestroID
+ "&registered_activate_status=" + registeredActiveStatus
+ "&registered_account_type=" + registeredAccountType
+ "&upgrade_account_type=" + upgradeAccountType,
function(jsonData) {
loadMaestroUpgradeList("");
$("#error_message").text("마에스트로 계정이 정상적으로 업그레이드되었습니다.");
},
function(errorMessage, errorCode) {
if($("#error_message").length) {
$("#error_message").text(errorMessage);
}
}
);
}
</script>
</head>
<body style="background-color: white">
<header id="header"></header>
<div class="container mt-3">
<div class="row mx-1">
<h3 class="my-3">마에스트로 업그레이드 목록</h3>
</div>
<div id="message_box"></div>
<div class="row mx-1">
<div class="col">
<h5 class="my-3">마에스트로 검색</h5>
<div class="input-group mb-3">
<div class="input-group-prepend">
<label class="input-group-text" for="search_name">마에스트로 아이디</label>
</div>
<input type="text" class="form-control" id="search_name" placeholder="Input maestro ID here" aria-label="Recipient's username" aria-describedby="basic-addon2">
<div class="input-group-append">
<button type="button" class="btn btn-primary" onClick="searchMaestroUpgrade()">검색 실행</button>
</div>
</div>
</div>
</div>
<div class="row mx-1">
<div class="col border border-warning rounded" style="background-color: #ffeab6">
<h5 class="my-3">검색 결과</h5>
<form id="search_player_list">
<div class="form-group row mx-2 mb-0 font-weight-bold">
<label class="col-form-label d-none">Upgrade ID</label>
<label class="col-form-label col-sm text-left">아이디</label>
<label class="col-form-label col-sm text-right">현 활성화 상태</label>
<label class="col-form-label col-sm text-right">현 요금제</label>
<label class="col-form-label col-sm text-right">유효기간</label>
<label class="col-form-label col-sm text-right">Upg 요금제</label>
<label class="col-form-label col-sm text-right">Upg 신청일</label>
<label class="col-form-label col-sm text-right">추가 금액</label>
<label class="col-form-label col-sm text-left">상태</label>
<label class="col-form-label col-sm-1 text-center">승인</label>
</div>
<div id="maestro_list_result_contents"></div>
</form>
</div> <!-- 학생 목록 -->
</div>
</div> <!-- container -->
</body>
</html>
-84
View File
@@ -1,84 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta charset="UTF-8">
<title>관리자 페이지</title>
<link rel="icon" href="/mouse_typing/resources/image/icon/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="/mouse_typing/resources/image/icon/favicon.ico" type="image/x-icon" />
<link href="../../../resources/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<script type="text/javascript" src="./../../../resources/jquery/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="./../js/main.js"></script>
<script type="text/javascript" src="./../js/request_server.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#password").keydown(function(key) {
if(key.keyCode == 13) {
login();
}
});
$("#section").load("admin_section.html");
});
function login() {
var name = $("#admin_name").val();
var password = $("#password").val();
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
"./../server/admin/login.php",
"admin_name=" + name + "&password=" + password,
function(jsonData) {
location.href = 'admin_all_list.html';
},
function(errorMessage, errorCode) {
if($("#error_message").length) {
$("#error_message").text(errorMessage);
}
}
);
}
</script>
</head>
<body style="background-color: white">
<div class="container">
<div class="border border-primary rounded px-5 py-4 my-3">
<h4 class="mb-4">로그인</h4>
<div id="message_box"></div>
<form class="mx-4">
<div class="form-group row">
<label for="maestro_name" class="col-sm-2 col-form-label">* 관리자 아이디</label>
<div class="col-sm-4">
<input type="text" class="form-control" id="admin_name" placeholder="아이디 입력">
</div>
</div>
<div class="form-group row">
<label for="password" class="col-sm-2 col-form-label">* 암호</label>
<div class="col-sm-4">
<input type="password" class="form-control" id="password" placeholder="Password">
<p><br/></p>
<button type="button" class="btn btn-primary btn-lg px-5" onClick="login()">로그인</button>
</div>
</div>
</form>
</div>
</div>
</body>
</html>
-103
View File
@@ -1,103 +0,0 @@
@charset "utf-8";
<style type="text/css">
.hide {
display: none;
}
#section_add_maestro {
overflow: hidden;
}
#add_maestro {
float: left;
line-height: 2em;
width: 400px;
padding: 10px;
background-color: #aaaaff;
}
#maestro_list_result {
float: right;
line-height: 2em;
width: 600px;
padding: 10px;
background-color: #ffaaaa;
}
#maestro_list_result_contents {
vertical-align: top;
}
.maestro_list {
list-style: none;
}
.maestro_list > li > span {
line-height: normal;
}
.maestro_list > li > .maestro_id {
display: none;
}
.maestro_list .maestro_id {
background-color: #ffffff;
}
.maestro_list .maestro_name {
width: 200px;
background-color: #ffdddd;
}
.maestro_list .maestro_account_type {
width: 200px;
background-color: #ddffdd;
}
.maestro_list .maestro_update {
width: 200px;
background-color: #ddddff;
}
.maestro_list_navigator {
text-align: center;
}
.maestro_list_navigator > span {
line-height: normal;
}
.maestro_list_navigator > span > a {
cursor: pointer;
}
#search_maestro {
overflow: hidden;
}
#search_maestro_name {
float: left;
line-height: 2em;
width: 400px;
padding: 10px;
background-color: #aaaaff;
}
#search_result {
float: right;
line-height: 2em;
width: 600px;
padding: 10px;
background-color: #ffaaaa;
}
/*
#mouse_app_list {
overflow: hidden;
}
*/
</style>
+14 -1
View File
@@ -9,6 +9,14 @@ $(document).ready(function() {
})
});
function togglePassword() {
var $pw = $("#password");
var show = $pw.attr("type") === "password";
$pw.attr("type", show ? "text" : "password");
$("#toggle_password").attr("aria-pressed", show)
.find("span").toggleClass("oi-eye", !show).toggleClass("oi-lock-locked", show);
}
function login() {
var name = $("#maestro_name").val();
var password = $("#password").val();
@@ -79,7 +87,12 @@ function login() {
<div class="form-group row">
<label for="password" class="col-sm-2 col-form-label">* 암호</label>
<div class="col-sm-4">
<input type="password" class="form-control" id="password" placeholder="Password">
<div class="input-group">
<input type="password" class="form-control" id="password" placeholder="Password">
<div class="input-group-append">
<button type="button" class="btn btn-outline-secondary" id="toggle_password" title="암호 보기/숨기기" aria-label="암호 보기/숨기기" aria-pressed="false" onClick="togglePassword()"><span class="oi oi-eye" aria-hidden="true"></span></button>
</div>
</div>
<p><br/></p>
<button type="button" class="btn btn-primary btn-lg px-5" onClick="login()">로그인</button>
</div>
+5 -2
View File
@@ -1,6 +1,9 @@
<?php
const SERVICE_DB_SETTING_FILE = "./../../server/setup/service_db_setting.php";
const SERVICE_DB_SETTING_FILE = __DIR__ . "/../../server/setup/service_db_setting.php";
// PHP 8.1+ 는 mysqli 오류 시 예외를 던진다. 기존처럼 반환값으로 처리하기 위해 끈다.
mysqli_report(MYSQLI_REPORT_OFF);
$has_file = file_exists(SERVICE_DB_SETTING_FILE);
if ($has_file) {
include(SERVICE_DB_SETTING_FILE);
@@ -28,7 +31,7 @@ class DBConnector
} else {
$this->db_host = "localhost";
$this->db_user = "chocomae";
$this->db_passwd = "sEobMPuJ2A8KTfwU";
$this->db_passwd = "Ei48X3lwT49DutyCH33LvULu";
$this->db_name = "chocomae";
$this->db_port = 3306;
}
@@ -5,7 +5,7 @@ $maestroID = $_POST["maestroID"];
$playerID = $_POST["playerID"];
$writingID = $_POST["writingID"];
$record = $_POST["record"];
$isPrevHourFlag = $_POST["isPrevHourFlag"];
$isPrevHourFlag = isset($_POST["isPrevHourFlag"]) ? $_POST["isPrevHourFlag"] : null;
// $isPrevHourFlag is for only TDD (addPrevHourTypingExamRecord)
include "./../lib/json_builder.php";
-29
View File
@@ -1,29 +0,0 @@
<?php
// header('Content-Type: application/json');
include "send_error_code.php";
$active_stage_list = $_POST['active_stage'];
$cnt = count($active_stage_list);
include "./connect_db.php";
$query = "UPDATE afterschool_activated_stage SET Activated = 0";
$result = $db_conn->query($query);
for($i = 0; $i < $cnt; $i++) {
$array_item = $active_stage_list[$i];
$query = "UPDATE afterschool_activated_stage SET Activated = 1 WHERE StageName = ?";
$stmt = $db_conn->prepare($query);
$stmt->bind_param('s', $array_item);
$stmt->execute();
if($stmt->affected_rows > 0) {
echo($array_item." : activated<br/>");
} else {
echo $array_item." : db error<br/>";
}
}
?>
@@ -1,84 +0,0 @@
<?php
header("Content-Type: application/json");
include "./../setup/connect_db.php";
include "./../lib/send_reply_json.php";
include "./../lib/db_maestro.php";
include "./../lib/maestro_log.php";
// include "./../mail/mail_setting.php";
// include "./../mail/send_mail.php";
include './../mail/mail_setting.php';
include './../mail/mail_contents.php';
include './../lib/maestro_account_info.php';
include "./../mail/send_jinaju_mail.php";
$maestro_extension_id = $_POST["maestro_extension_id"];
$maestro_id = $_POST["maestro_id"];
$maestro_name = $_POST["maestro_name"];
$new_available_date = $_POST["new_available_date"];
$registered_account_type = $_POST["registered_account_type"];
extension_maestro($maestro_id, $new_available_date);
change_extension_request_status_to_close($maestro_id);
change_extension_request_status_to_applied($maestro_extension_id);
$maestro_data = get_maestro_data($maestro_id);
// $maestro_name, $new_available_date, $maestro_email
sendMailExtensionDone($maestro_data["name"], $new_available_date, $maestro_data["email"]);
insertMaestroLog("extension_maestro", $maestro_id, $maestro_name."(".$registered_account_type.")");
// set_data("maestro_extension_id", $maestro_extension_id);
// set_data("maestro_id", $maestro_id);
set_data("maestroName", $maestro_name);
send_result_success();
exit;
function extension_maestro($maestro_id, $new_available_date) {
global $db_conn;
// $query = "
// UPDATE maestro
// SET ActivateStatus = 1, AvailableActivateDateTime = DATE_ADD(AvailableActivateDateTime, INTERVAL 1 YEAR)
// WHERE MaestroID = ?;
// ";
$query = "
UPDATE maestro
SET ActivateStatus = 2, AvailableActivateDateTime = DATE_FORMAT(?, '%Y-%m-%d')
WHERE MaestroID = ?;
";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("si", $new_available_date, $maestro_id);
$stmt->execute();
}
function change_extension_request_status_to_close($maestro_id) {
global $db_conn;
$query = "
UPDATE maestro_extension
SET Status = 2
WHERE MaestroID = ? AND Status = 1;
";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("i", $maestro_id);
$stmt->execute();
}
function change_extension_request_status_to_applied($maestro_extension_id) {
global $db_conn;
$query = "
UPDATE maestro_extension
SET Status = 3
WHERE MaestroExtensionID = ?
";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("i", $maestro_extension_id);
$stmt->execute();
}
?>
-89
View File
@@ -1,89 +0,0 @@
<?php
header("Content-Type: application/json");
include "./../lib/send_reply_json.php";
include "./../setup/connect_db.php";
$adminName = $_POST["admin_name"];
$password = $_POST["password"];
$maestroID = get_admin_id($adminName);
if($maestroID === null) {
set_error_code("not_registered_id");
set_error_message("등록되지 않은 서비스 관리자 아이디입니다.");
send_result_fail();
exit;
}
$loginData = login($adminName, $password);
if($loginData === null) {
set_error_code("no_data");
set_error_message("로그인하지 못했습니다.");
send_result_fail();
exit;
} else if($loginData["activateStatus"] === 0) {
set_error_code("not_activated");
set_error_message("서비스 관리자 계정이 아직 활성화되지 않았습니다.");
send_result_fail();
exit;
} else if($loginData["adminID"] === null) {
set_error_code("wrong_password");
set_error_message("비밀번호가 틀렸습니다.");
send_result_fail();
exit;
}
set_data("adminID", $loginData["adminID"]);
set_data("accountType", $loginData["accountType"]);
set_data("activateStatus", $loginData["activateStatus"]);
send_result_success();
exit;
function get_admin_id($adminName) {
global $db_conn;
$query = "
SELECT AdminID
FROM admin
WHERE Name = ?
";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("s", $adminName);
$stmt->execute();
$stmt->bind_result($maestroID);
// while($stmt->fetch()) {
// ;
// }
$stmt->fetch();
$stmt->close();
return $maestroID;
}
function login($adminName, $password) {
global $db_conn;
$query = "
SELECT AdminID, AccountType, ActivateStatus
FROM admin
WHERE Name = ? AND Password = PASSWORD(?)
";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("ss", $adminName, $password);
$stmt->execute();
$stmt->bind_result($adminID, $accountType, $activateStatus);
// while($stmt->fetch())
$stmt->fetch();
$stmt->close();
$result["adminID"] = $adminID;
$result["accountType"] = $accountType;
$result["activateStatus"] = $activateStatus;
return $result;
}
?>
-80
View File
@@ -1,80 +0,0 @@
<?php
header("Content-Type: application/json");
include "./../lib/send_reply_json.php";
include "./../setup/connect_db.php";
$maestroName = $_POST["maestro_name"];
$maestroList = null;
if(strlen($maestroName) === 0)
$maestroList = get_maestro_list();
else
$maestroList = get_maestro_list_by_name($maestroName);
set_data("maestroList", $maestroList);
send_result_success();
exit;
function get_maestro_list() {
global $db_conn;
$query = "
SELECT MaestroID, Name, AccountType, ActivateStatus, AvailableActivateDateTime, AcceptClausesDateTime, PlayerCount
FROM maestro
ORDER BY MaestroID DESC
";
$stmt = $db_conn->prepare($query);
// $stmt->bind_param("iii", $maestroID, $startNo, $endNo);
// $stmt->bind_param("ii", $maestroName, $startNo);
$stmt->execute();
$stmt->bind_result($maestroID, $name, $accountType, $activateStatus, $availableActivateDateTime , $acceptClausesDateTime, $playerCount);
$maestroList = array();
while($stmt->fetch()) {
$maestro["maestroID"] = $maestroID;
$maestro["maestroName"] = $name;
$maestro["accountType"] = $accountType;
$maestro["activateStatus"] = $activateStatus;
$maestro["availableActivateDateTime"] = $availableActivateDateTime;
$maestro["acceptClausesDateTime"] = $acceptClausesDateTime;
$maestro["playerCount"] = $playerCount;
array_push($maestroList, $maestro);
}
return $maestroList;
}
function get_maestro_list_by_name($maestroName) {
global $db_conn;
$query = "
SELECT MaestroID, Name, AccountType, ActivateStatus, AcceptClausesDateTime, PlayerCount
FROM maestro
WHERE Name LIKE CONCAT('%', ?, '%')
ORDER BY MaestroID DESC
";
$stmt = $db_conn->prepare($query);
// $stmt->bind_param("iii", $maestroID, $startNo, $endNo);
$stmt->bind_param("s", $maestroName);
$stmt->execute();
$stmt->bind_result($maestroID, $name, $accountType, $activateStatus, $acceptClausesDateTime, $playerCount);
$maestroList = array();
while($stmt->fetch()) {
$maestro["maestroID"] = $maestroID;
$maestro["maestroName"] = $name;
$maestro["accountType"] = $accountType;
$maestro["activateStatus"] = $activateStatus;
$maestro["acceptClausesDateTime"] = $acceptClausesDateTime;
$maestro["playerCount"] = $playerCount;
array_push($maestroList, $maestro);
}
return $maestroList;
}
?>
@@ -1,81 +0,0 @@
<?php
header("Content-Type: application/json");
include "./../lib/send_reply_json.php";
include "./../setup/connect_db.php";
$maestroName = $_POST["maestro_name"];
$maestroExtensionList = null;
if(strlen($maestroName) === 0)
$maestroExtensionList = get_maestro_extension_list();
else
$maestroExtensionList = get_maestro_extension_list_by_name($maestroName);
set_data("maestroExtensionList", $maestroExtensionList);
send_result_success();
exit;
function get_maestro_extension_list() {
global $db_conn;
$query = "
SELECT E.MaestroExtensionID, E.MaestroID, M.Name, E.AccountType, E.RequestedDateTime, M.AvailableActivateDateTime, E.Status
FROM maestro_extension E, maestro M
WHERE E.Status < 2 AND E.MaestroID = M.MaestroID
ORDER BY E.MaestroExtensionID DESC
";
$stmt = $db_conn->prepare($query);
// $stmt->bind_param("iii", $maestroID, $startNo, $endNo);
// $stmt->bind_param("ii", $maestroName, $startNo);
$stmt->execute();
$stmt->bind_result($maestroExtensionID, $maestroID, $maestroName, $registeredAccountType, $requestedDateTime, $availableActivateDateTime, $status);
$maestroExtensionList = array();
while($stmt->fetch()) {
$maestro["maestroExtensionID"] = $maestroExtensionID;
$maestro["maestroID"] = $maestroID;
$maestro["maestroName"] = $maestroName;
$maestro["registeredAccountType"] = $registeredAccountType;
$maestro["requestedDateTime"] = $requestedDateTime;
$maestro["availableActivateDateTime"] = $availableActivateDateTime;
$maestro["status"] = $status;
array_push($maestroExtensionList, $maestro);
}
return $maestroExtensionList;
}
function get_maestro_extension_list_by_name($searchMaestroName) {
global $db_conn;
$query = "
SELECT E.MaestroExtensionID, E.MaestroID, M.Name, E.AccountType, E.RequestedDateTime, M.AvailableActivateDateTime, E.Status
FROM maestro_extension E, maestro M
WHERE M.Name LIKE CONCAT('%', ?, '%') AND E.MaestroID = M.MaestroID
ORDER BY E.MaestroExtensionID DESC
";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("s", $searchMaestroName);
$stmt->execute();
$stmt->bind_result($maestroExtensionID, $maestroID, $maestroName, $registeredAccountType, $requestedDateTime, $availableActivateDateTime, $status);
$maestroExtensionList = array();
while($stmt->fetch()) {
$maestro["maestroExtensionID"] = $maestroExtensionID;
$maestro["maestroID"] = $maestroID;
$maestro["maestroName"] = $maestroName;
$maestro["registeredAccountType"] = $registeredAccountType;
$maestro["requestedDateTime"] = $requestedDateTime;
$maestro["availableActivateDateTime"] = $availableActivateDateTime;
$maestro["status"] = $status;
array_push($maestroExtensionList, $maestro);
}
return $maestroExtensionList;
}
?>
@@ -1,76 +0,0 @@
<?php
header("Content-Type: application/json");
include "./../lib/send_reply_json.php";
include "./../setup/connect_db.php";
$maestroName = $_POST["maestro_name"];
$maestroList = null;
if(strlen($maestroName) === 0)
$maestroList = get_maestro_list();
else
$maestroList = get_maestro_list_by_name($maestroName);
set_data("maestroList", $maestroList);
send_result_success();
exit;
function get_maestro_list() {
global $db_conn;
$query = "
SELECT MaestroID, Name, AccountType, AcceptClausesDateTime
FROM maestro
WHERE ActivateStatus=0
ORDER BY MaestroID DESC
";
$stmt = $db_conn->prepare($query);
// $stmt->bind_param("iii", $maestroID, $startNo, $endNo);
// $stmt->bind_param("ii", $maestroName, $startNo);
$stmt->execute();
$stmt->bind_result($maestroID, $name, $accountType, $acceptClausesDateTime);
$maestroList = array();
while($stmt->fetch()) {
$maestro["maestroID"] = $maestroID;
$maestro["maestroName"] = $name;
$maestro["accountType"] = $accountType;
$maestro["acceptClausesDateTime"] = $acceptClausesDateTime;
array_push($maestroList, $maestro);
}
return $maestroList;
}
function get_maestro_list_by_name($maestroName) {
global $db_conn;
$query = "
SELECT MaestroID, Name, AccountType, AcceptClausesDateTime
FROM maestro
WHERE Name LIKE CONCAT('%', ?, '%') AND ActivateStatus=0
ORDER BY MaestroID DESC
";
$stmt = $db_conn->prepare($query);
// $stmt->bind_param("iii", $maestroID, $startNo, $endNo);
$stmt->bind_param("s", $maestroName);
$stmt->execute();
$stmt->bind_result($maestroID, $name, $accountType, $acceptClausesDateTime);
$maestroList = array();
while($stmt->fetch()) {
$maestro["maestroID"] = $maestroID;
$maestro["maestroName"] = $name;
$maestro["accountType"] = $accountType;
$maestro["acceptClausesDateTime"] = $acceptClausesDateTime;
array_push($maestroList, $maestro);
}
return $maestroList;
}
?>
@@ -1,85 +0,0 @@
<?php
header("Content-Type: application/json");
include "./../lib/send_reply_json.php";
include "./../setup/connect_db.php";
$maestroName = $_POST["maestro_name"];
$maestroUpgradeList = null;
if(strlen($maestroName) === 0)
$maestroUpgradeList = get_maestro_upgrade_list();
else
$maestroUpgradeList = get_maestro_update_list_by_name($maestroName);
set_data("maestroUpgradeList", $maestroUpgradeList);
send_result_success();
exit;
function get_maestro_upgrade_list() {
global $db_conn;
$query = "
SELECT U.MaestroUpgradeID, U.MaestroID, M.Name, U.RegisteredActivateStatus, U.RegisteredAccountType, U.RequestedAccountType, U.RequestedDateTime, M.AvailableActivateDateTime, U.Status
FROM maestro_upgrade U, maestro M
WHERE U.Status < 2 AND U.MaestroID = M.MaestroID
ORDER BY U.MaestroUpgradeID DESC
";
$stmt = $db_conn->prepare($query);
// $stmt->bind_param("iii", $maestroID, $startNo, $endNo);
// $stmt->bind_param("ii", $maestroName, $startNo);
$stmt->execute();
$stmt->bind_result($maestroUpgradeID, $maestroID, $maestroName, $registeredActivateStatus, $registeredAccountType, $requestedAccountType, $requestedDateTime, $availableActivateDateTime, $status);
$maestroUpgradeList = array();
while($stmt->fetch()) {
$maestro["maestroUpgradeID"] = $maestroUpgradeID;
$maestro["maestroID"] = $maestroID;
$maestro["maestroName"] = $maestroName;
$maestro["registeredActivateStatus"] = $registeredActivateStatus;
$maestro["registeredAccountType"] = $registeredAccountType;
$maestro["requestedAccountType"] = $requestedAccountType;
$maestro["requestedDateTime"] = $requestedDateTime;
$maestro["availableActivateDateTime"] = $availableActivateDateTime;
$maestro["status"] = $status;
array_push($maestroUpgradeList, $maestro);
}
return $maestroUpgradeList;
}
function get_maestro_update_list_by_name($searchMaestroName) {
global $db_conn;
$query = "
SELECT U.MaestroUpgradeID, U.MaestroID, M.Name, U.RegisteredActivateStatus, U.RegisteredAccountType, U.RequestedAccountType, U.RequestedDateTime, M.AvailableActivateDateTime, U.Status
FROM maestro_upgrade U, maestro M
WHERE M.Name LIKE CONCAT('%', ?, '%') AND U.MaestroID = M.MaestroID
ORDER BY U.MaestroUpgradeID DESC
";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("s", $searchMaestroName);
$stmt->execute();
$stmt->bind_result($maestroUpgradeID, $maestroID, $maestroName, $registeredActivateStatus, $registeredAccountType, $requestedAccountType, $requestedDateTime, $availableActivateDateTime, $status);
$maestroUpgradeList = array();
while($stmt->fetch()) {
$maestro["maestroUpgradeID"] = $maestroUpgradeID;
$maestro["maestroID"] = $maestroID;
$maestro["maestroName"] = $maestroName;
$maestro["registeredActivateStatus"] = $registeredActivateStatus;
$maestro["registeredAccountType"] = $registeredAccountType;
$maestro["requestedAccountType"] = $requestedAccountType;
$maestro["requestedDateTime"] = $requestedDateTime;
$maestro["availableActivateDateTime"] = $availableActivateDateTime;
$maestro["status"] = $status;
array_push($maestroUpgradeList, $maestro);
}
return $maestroUpgradeList;
}
?>
-247
View File
@@ -1,247 +0,0 @@
<?php
header("Content-Type: application/json");
error_reporting( E_ALL );
ini_set( "display_errors", 1 );
include "./../lib/send_reply_json.php";
include "./../setup/connect_db.php";
include "./../lib/db_maestro.php";
include "./../lib/maestro_log.php";
include './../mail/mail_setting.php';
include './../mail/mail_contents.php';
include './../lib/maestro_account_info.php';
include "./../mail/send_jinaju_mail.php";
$maestroID = $_POST["maestro_id"];
$result = register_maestro($maestroID);
if($result <= 0) {
set_error_message("마에스트로 계정 활성화 실패");
send_result_fail();
exit;
}
add_maestro_test_player($maestroID);
$playerID = get_maestro_test_player($maestroID);
if($playerID === null) {
set_error_message("마에스트로 테스트 플레이어 생성 실패");
send_result_fail();
exit;
}
$result = set_maestro_test_player($maestroID, $playerID);
if($result === null || $result === 0) {
set_error_message("마에스트로 테스트 플레이어 등록 실패");
send_result_fail();
exit;
}
add_default_activated_apps($maestroID);
add_maestro_sample_player_data($maestroID);
$count = count_registered_player($maestroID);
update_count_registered_player($maestroID, $count);
$maestro_data = get_maestro_data($maestroID);
sendMailRegisterDone($maestro_data["name"], $maestro_data["email"]);
insertMaestroLog("register_maestro", $maestroID, $maestro_data["name"]." / ".$maestro_data["email"]);
send_result_success();
exit;
function register_maestro($maestroID) {
global $db_conn;
// $query = "
// UPDATE maestro
// SET ActivateStatus = 1, AvailableActivateDateTime = DATE_ADD(NOW(), INTERVAL 1 YEAR)
// WHERE MaestroID = ?
// ";
// closed beta
$query = "
UPDATE maestro
SET ActivateStatus = 1, AvailableActivateDateTime = '2022-07-31 23:59:59'
WHERE MaestroID = ?
";
// (07/17) before 2 weeks from closing beta service
// $query = "
// UPDATE maestro
// SET ActivateStatus = 1, AvailableActivateDateTime = DATE_ADD(NOW(), INTERVAL 14 DAY)
// WHERE MaestroID = ?
// ";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("i", $maestroID);
$stmt->execute();
return $stmt->affected_rows;
}
function add_maestro_test_player($maestroID) {
global $db_conn;
$query = "
INSERT INTO player (MaestroID, Name, EnterCode, AccountType)
VALUES (?, '마에스트로', '', 1)
";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("i", $maestroID);
$stmt->execute();
}
function get_maestro_test_player($maestroID) {
global $db_conn;
$query = "
SELECT PlayerID
FROM player
WHERE MaestroID = ? AND AccountType = 1
";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("i", $maestroID);
$stmt->execute();
$stmt->bind_result($playerID);
$stmt->fetch();
$stmt->close();
return $playerID;
}
function set_maestro_test_player($maestroID, $playerID) {
global $db_conn;
$query = "
UPDATE maestro
SET MaestroTestID = ?
WHERE MaestroID = ?
";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("ii", $playerID, $maestroID);
$stmt->execute();
return $stmt->affected_rows;
}
function add_default_activated_apps($maestroID) {
global $db_conn;
$query = "
SELECT AppID
FROM app
WHERE Status = 1;
";
$stmt = $db_conn->prepare($query);
$stmt->execute();
$stmt->bind_result($appID);
$activeAppList = array();
while($stmt->fetch()) {
array_push($activeAppList, $appID);
}
$stmt->close();
$count = count($activeAppList);
for($i = 0; $i < $count; $i++) {
$activeAppID = $activeAppList[$i];
$query = "
INSERT INTO active_app (MaestroID, AppID)
VALUES (?, ?);
";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("ii", $maestroID, $activeAppID);
$stmt->execute();
$stmt->close();
}
}
function add_maestro_sample_player_data($maestro_id) {
$samplePlayerList = make_sample_player_list($maestro_id);
for($i = 0; $i < count($samplePlayerList); $i++) {
insert_maestro_sample_player_data($maestro_id, $samplePlayerList[$i]);
}
}
function insert_maestro_sample_player_data($maestro_id, $player) {
global $db_conn;
$query = "
INSERT INTO player (MaestroID, Name, EnterCode, AccountType)
VALUES (?, ?, ?, ?)
";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("issi",
$maestro_id,
$player["Name"],
$player["EnterCode"],
$player["AccountType"]
);
$stmt->execute();
$stmt->close();
}
function make_sample_player_list() {
$samplePlayerList = array();
$player["Name"] = "050215";
$player["EnterCode"] = "050215";
$player["AccountType"] = 0;
array_push($samplePlayerList, $player);
$player["Name"] = "6-3_이철수";
$player["EnterCode"] = "1111";
$player["AccountType"] = 0;
array_push($samplePlayerList, $player);
$player["Name"] = "3-1김영희";
$player["EnterCode"] = "0301";
$player["AccountType"] = 0;
array_push($samplePlayerList, $player);
$player["Name"] = "홍길동";
$player["EnterCode"] = "181231";
$player["AccountType"] = 0;
array_push($samplePlayerList, $player);
return $samplePlayerList;
}
function count_registered_player($maestroID) {
global $db_conn;
$query = "
SELECT COUNT(PlayerID)
FROM player
WHERE MaestroID = ? AND AccountType = 0
";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("i", $maestroID);
$stmt->execute();
$stmt->bind_result($countPlayer);
// while($stmt->fetch())
$stmt->fetch();
$stmt->close();
return $countPlayer;
}
function update_count_registered_player($maestroID, $countPlayer) {
global $db_conn;
$query = "
UPDATE maestro
SET PlayerCount = ?
WHERE MaestroID = ?
";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("ii", $countPlayer, $maestroID);
$stmt->execute();
}
?>
-81
View File
@@ -1,81 +0,0 @@
<?php
header("Content-Type: application/json");
include "./../setup/connect_db.php";
include "./../lib/send_reply_json.php";
include "./../lib/db_maestro.php";
include "./../lib/maestro_log.php";
include "./../mail/mail_setting.php";
include './../mail/mail_setting.php';
include './../mail/mail_contents.php';
include './../lib/maestro_account_info.php';
include "./../mail/send_jinaju_mail.php";
$maestro_upgrade_id = $_POST["maestro_upgrade_id"];
$maestro_id = $_POST["maestro_id"];
$registered_activate_status = $_POST["registered_activate_status"];
$registered_account_type = $_POST["registered_account_type"];
$upgrade_account_type = $_POST["upgrade_account_type"];
upgrade_maestro($maestro_id, $upgrade_account_type);
change_upgrade_request_status_to_close($maestro_id);
change_upgrade_request_status_to_applied($maestro_upgrade_id);
$maestro_data = get_maestro_data($maestro_id);
if($registered_activate_status == 1) { // 체험
sendMailTrialMaestroUpgradeDone($maestro_data["name"], $maestro_data["email"], $registered_account_type, $upgrade_account_type);
} else { // 0: 미승인, 2: 활성화, 3: 환불
sendMailUpgradeDone($maestro_data["name"], $maestro_data["email"], $registered_account_type, $upgrade_account_type);
}
insertMaestroLog("upgrade_maestro", $maestro_id, $registered_account_type." -> ".$upgrade_account_type);
// set_data("maestro_upgrade_id", $maestro_upgrade_id);
// set_data("maestro_id", $maestro_id);
// set_data("upgrade_account_type", $upgrade_account_type);
send_result_success();
exit;
function upgrade_maestro($maestro_id, $upgrade_account_type) {
global $db_conn;
$query = "
UPDATE maestro
SET AccountType = ?, ActivateStatus = 2, AvailableActivateDateTime = DATE_ADD(NOW(), INTERVAL 1 YEAR)
WHERE MaestroID = ?;
";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("ii", $upgrade_account_type, $maestro_id);
$stmt->execute();
}
function change_upgrade_request_status_to_close($maestro_id) {
global $db_conn;
$query = "
UPDATE maestro_upgrade
SET Status = 2
WHERE MaestroID = ? AND Status = 1;
";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("i", $maestro_id);
$stmt->execute();
}
function change_upgrade_request_status_to_applied($maestro_upgrade_id) {
global $db_conn;
$query = "
UPDATE maestro_upgrade
SET Status = 3
WHERE MaestroUpgradeID = ?
";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("i", $maestro_upgrade_id);
$stmt->execute();
}
?>
@@ -5,16 +5,18 @@
<script>
<?php
$maestro_name = $_GET["maestro_name"];
$maestro_name = isset($_GET["maestro_name"]) ? (string)$_GET["maestro_name"] : "";
// echo "maestro_name : $maestro_name</br>";
if($maestro_name == "") {
echo "no maestro_name";
echo "// no maestro_name\n";
run_url("./../../client/license_timer.html");
exit;
}
echo("sessionStorage.setItem('maestroName', '$maestro_name');\n\r");
// 사용자 입력이 스크립트로 실행되지 않도록 JS 문자열 리터럴로 안전하게 출력 (XSS 방지)
$maestro_name_js = json_encode($maestro_name, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP);
echo("sessionStorage.setItem('maestroName', $maestro_name_js);\n\r");
run_url("./../../client/license_timer.html");
function run_url($targetUrl) {
+1 -1
View File
@@ -18,7 +18,7 @@ if($maestroID === null) {
$loginData = login($maestroName, $password);
$date = new DateTime($loginData["availableActivateDateTime"]);
$date = new DateTime($loginData["availableActivateDateTime"] ?? "now");
$now = new DateTime();
if($loginData === null) {
set_error_code("no_data");
@@ -5,16 +5,18 @@
<script>
<?php
$maestro_name = $_GET["maestro_name"];
$maestro_name = isset($_GET["maestro_name"]) ? (string)$_GET["maestro_name"] : "";
// echo "maestro_name : $maestro_name</br>";
if($maestro_name == "") {
echo "no maestro_name";
echo "// no maestro_name\n";
run_url("./../../player/login.html");
exit;
}
echo("sessionStorage.setItem('maestroName', '$maestro_name');\n\r");
// 사용자 입력이 스크립트로 실행되지 않도록 JS 문자열 리터럴로 안전하게 출력 (XSS 방지)
$maestro_name_js = json_encode($maestro_name, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP);
echo("sessionStorage.setItem('maestroName', $maestro_name_js);\n\r");
run_url("./../../client/login.html");
function run_url($targetUrl) {
@@ -1,97 +0,0 @@
<?php
$hostNameUrl = "https://mail.apigw.ntruss.com"; // 호스트 URL
$requestUrl= "/api/v1/mails"; // 요청 URI
$accessKey = "YOUR_ACCESS_KEY"; // 네이버 클라우드 플랫폼 회원에게 발급되는 개인 인증키
$secretKey = "YOUR_SECRET_KEY"; // 2차 인증을 위해 서비스마다 할당되는 service secret
$apiKey = "YOU_API_KEY"; // API Gateway에서 발급받은 키 (primary key 또는 secondary key)
$method = "POST"; // 요청 method mail 발송 : POST, 발송 확인 GET
$requestId = ""; // 요청 ID
try {
$timestamp = "";
$microtime = "";
list($microtime,$timestamp) = explode(' ',microtime());
$timestamp = $timestamp.substr($microtime, 2, 3);
$is_post = false;
if($method == "POST") {
$postParam = array(
"advertising" => false, // 광고메일여부 default: false
"attachFileIds" => array_map(), // 첨부파일ID
"body" => "", // Email 본문
"individual" => true, // 개인발송여부 (개인발송 시 참조인, 숨은참조 무시됨) default: true
"parameters" => array_map(), // 치환 파라미터 (전체 수신자에게 적용), ‘치환 ID’ 를 key로, ‘치환 ID에 맵핑되는 값’ 을 value로 가지는 Map 형태의 Object
"recipients" => array( // 수신자목록
array(
"address" => "", // 수신자 Email 주소
"name" => "", // 수신자 명
"type" => "", // 수신자 유형 (R: 수신자, C: 참조인, B: 숨은참조) default: R
"parameters" => array_map(), // 치환 파라미터 (수신자별로 적용), ‘치환 ID’ 를 key로, ‘치환 ID에 맵핑되는 값’ 을 value로 가지는 Map 형태의 Object
),
),
"referencesHeader" => "", // 특정 메일을 모아서 보기 위해 네이버 메일에서 지원하는 기능, 해당 필드에 동일한 값을 입력한 메일들을 모아서 볼 수 있다. (다음의 형태가 되어야 함 : <unique_id@domain.com> )
"reservationUtc" => "", // 예약 발송 일시 ( 1970년 1월 1일 00:00:00 협정 세계시(UTC) 부터의 경과 시간을 1/1000초로 환산한 정수 ), reservationDateTime 값보다 이 값이 우선 적용된다.
"reservationDateTime" => "", // 다음과 같은 형태의 예약 발송 일시 (‘yyyy-MM-dd HH:mm’ UTC+09:00), reservationUtc 값이 우선한다.
"senderAddress" => "", // 발송자 Email 주소
"senderName" => "", // 발송자 이름
"tempRequestId" => "", // 첨부파일 등록 시 사용한 임시 요청 ID
"templateSid" => "", // 템플릿 ID
"title" => "", // Mail 제목
);
$postParam = json_encode($postParam);
$is_post = true;
$success_code = 201;
} else {
$success_code = 200;
$requestUrl = $requestUrl."/requests/".$requestId."/status";
}
$signautue = makeSignature($secretKey, $method, $requestUrl, $timestamp, $accessKey);
$url = $hostNameUrl.$requestUrl;
echo $url."\n";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, $is_post);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
if($method == "POST") {
curl_setopt($ch, CURLOPT_POSTFIELDS, $postParam);
}
$headers = array();
$headers[] = "X-NCP-APIGW-TIMESTAMP: " .$timestamp;
$headers[] = "X-NCP-IAM-ACCESS-KEY: " .$accessKey;
$headers[] = "X-NCP-APIGW-SIGNATURE-V2: " .$signautue;
$headers[] = "content-type: application/json";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec ($ch);
$status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
echo "status_code:".$status_code."\n";
curl_close ($ch);
if($status_code == 200) {
echo $response."\n";
} else {
echo "Error 내용:".$response."\n";
}
} catch(Exception $E) {
echo "Response: ". $E->lastResponse . "\n";
}
function makeSignature($secretKey, $method, $uri, $timestamp, $accessKey) {
$space = " ";
$newLine = "\n";
$hmac = $method.$space.$uri.$newLine.$timestamp.$newLine.$accessKey;
$signautue = base64_encode(hash_hmac('sha256', $hmac, $secretKey,true));
echo "this is signiture : ".$signautue."\n";
return $signautue;
}
?>
-62
View File
@@ -1,62 +0,0 @@
<?php
header("Content-Type: application/json");
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require './../PHPMailer/src/Exception.php';
require './../PHPMailer/src/PHPMailer.php';
require './../PHPMailer/src/SMTP.php';
// Load Composer's autoloader
// require $_SERVER['DOCUMENT_ROOT'] . '/vendor/autoload.php';
function send_gmail($maestro_email, $maestro_name, $subject, $body) {
global $new_line; // = "\r\n";
global $html_br_tag; // = "<br/>";
// global $from; // = "support+chocomae@jinaju.com";
// global $bcc; // = "support+chocomae.automail@jinaju.com";
// mail sender info
global $sender_name; // = "초코마에";
global $sender_email; // = $from;
global $sender_address; // = $from;
global $sender_bcc; // = $bcc;
$mail = new PHPMailer(true);
try {
//Server settings
// $mail->SMTPDebug = SMTP::DEBUG_SERVER; //Enable verbose debug output
$mail->isSMTP(); // Send using SMTP
$mail->Host = 'smtp.gmail.com'; // Set the SMTP server to send through
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'chocomae@jinaju.com'; // SMTP username
$mail->Password = '52napark!'; // SMTP password
$mail->CharSet = 'utf-8';
$mail->Encoding = "base64";
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //Enable implicit TLS encryption
// $mail->SMTPSecure = 'ssl';
$mail->Port = 465; // TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` above
//Recipients
$mail->SetFrom($sender_email, $sender_name);
$mail->addAddress($maestro_email, $maestro_name); // Add a recipient
$mail->addReplyTo($sender_address, $sender_name);
$mail->addBCC($sender_bcc);
// Content
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = $subject;
$mail->Body = $body;
$mail->send();
echo 'Message has been sent';
return true;
} catch (Exception $e) {
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
return false;
}
}
-614
View File
@@ -1,614 +0,0 @@
<?php
header("Content-Type: application/json");
require_once("./../PHPMailer/src/PHPMailer.php");
require_once("./../PHPMailer/src/SMTP.php");
require_once("./../PHPMailer/src/Exception.php");
// variables for ncloud outbound mailer
$host_name_url = "https://mail.apigw.ntruss.com"; // 호스트 URL
$request_url= "/api/v1/mails"; // 요청 URI
$access_key = "qNXWk443wdnDXrkPvoqr"; // 네이버 클라우드 플랫폼 회원에게 발급되는 개인 인증키
$secret_key = "umWxQXulhNSya2CkMNqqVJnSRfwRaN8BjMUX0skV"; // 2차 인증을 위해 서비스마다 할당되는 service secret
$api_key = "eWfapJfbR5W9NXPEsdXGzlJsShEV30DfxIV0d51J"; // API Gateway에서 발급받은 키 (primary key 또는 secondary key)
$method = "POST"; // 요청 method mail 발송 : POST, 발송 확인 GET
$request_id = ""; // 요청 ID
////////////////////////
// nCloud Outbound Mailer
////////////////////////
function makeDefaultPostParamData($maestro_name, $maestro_email) {
global $sender_email, $sender_name, $sender_bcc;
$postParamData["sender_address"] = $sender_email;
$postParamData["sender_name"] = $sender_name;
$postParamData["individual"] = false;
$postParamData["title"] = null;
$postParamData["body"] = null;
$postParamData["recipients"] = array(
array(
"address" => $maestro_email, // 수신자 Email 주소
"name" => "", // 수신자 명
"type" => "R", // 수신자 유형 (R: 수신자, C: 참조인, B: 숨은참조) default: R
// "parameters" => array_map(),
// 치환 파라미터 (수신자별로 적용), ‘치환 ID’ 를 key로, ‘치환 ID에 맵핑되는 값’ 을 value로 가지는 Map 형태의 Object
"parameters" => array(
"maestro_name" => $maestro_name,
), // 치환 파라미터 (수신자별로 적용), ‘치환 ID’ 를 key로, ‘치환 ID에 맵핑되는 값’ 을 value로 가지는 Map 형태의 Object
),
array(
"address" => $sender_bcc, // 수신자 Email 주소
"name" => "", // 수신자 명
"type" => "B", // 수신자 유형 (R: 수신자, C: 참조인, B: 숨은참조) default: R
"parameters" => array_map(),
// 치환 파라미터 (수신자별로 적용), ‘치환 ID’ 를 key로, ‘치환 ID에 맵핑되는 값’ 을 value로 가지는 Map 형태의 Object
),
);
return $postParamData;
}
function sendMailRegisterBankInfo($maestro_name, $maestro_email, $account_type) {
$postParamData = makeDefaultPostParamData($maestro_name, $maestro_email);
$postParamData["templateSid"] = "134";
$postParamData["parameters"] = array(
"account_type" => get_accout_type($account_type),
"bank_account_no" => "3333-07-4977969",
"bank_name" => "카카오뱅크",
"bank_owner_name" => "박지상",
"maestro_name" => $maestro_name,
"price" => number_format(get_price($account_type))
);
sendEmail($postParamData);
}
function sendMailRegisterDone($maestro_name, $maestro_email) {
$postParamData = makeDefaultPostParamData($maestro_name, $maestro_email);
$postParamData["templateSid"] = "138";
$postParamData["parameters"] = array(
"maestro_name" => $maestro_name,
);
sendEmail($postParamData);
}
function sendMailUpgradeBankInfo($maestro_name, $maestro_email, $account_type, $upgrade_account_type) {
$postParamData = makeDefaultPostParamData($maestro_name, $maestro_email);
$postParamData["templateSid"] = "139";
$postParamData["parameters"] = array(
"account_type" => get_accout_type($account_type),
"upgrade_account_type" => get_accout_type($upgrade_account_type),
"bank_account_no" => "3333-07-4977969",
"bank_name" => "카카오뱅크",
"bank_owner_name" => "박지상",
"maestro_name" => $maestro_name,
"price" => number_format(get_price($upgrade_account_type) - get_price($account_type))
);
sendEmail($postParamData);
}
function sendMailUpgradeDone($maestro_name, $maestro_email, $account_type, $upgrade_account_type) {
$postParamData = makeDefaultPostParamData($maestro_name, $maestro_email);
$postParamData["templateSid"] = "140";
$postParamData["parameters"] = array(
"account_type" => get_accout_type($account_type),
"upgrade_account_type" => get_accout_type($upgrade_account_type),
"maestro_name" => $maestro_name,
);
sendEmail($postParamData);
}
function sendMailUpdateMaestroName($maestro_name, $maestro_name_prev, $maestro_email) {
$postParamData = makeDefaultPostParamData($maestro_name, $maestro_email);
$postParamData["templateSid"] = "161";
$postParamData["parameters"] = array(
"maestro_name_prev" => $maestro_name_prev,
"maestro_name" => $maestro_name,
);
sendEmail($postParamData);
}
function sendMailUpdateMaestroEmail($maestro_name, $maestro_email, $maestro_email_prev) {
// send to new email
$postParamData = makeDefaultPostParamData($maestro_name, $maestro_email);
$postParamData["templateSid"] = "137";
$postParamData["parameters"] = array(
"maestro_email_prev" => $maestro_email_prev,
"maestro_email" => $maestro_email,
);
sendEmail($postParamData);
// send to previous email
$postParamDataPrev = makeDefaultPostParamData($maestro_name, $maestro_email_prev);
$postParamDataPrev["templateSid"] = "137";
$postParamDataPrev["parameters"] = array(
"maestro_email_prev" => $maestro_email_prev,
"maestro_email" => $maestro_email,
);
sendEmail($postParamDataPrev);
}
function sendMailExtensionBankInfo($maestro_name, $available_date, $new_available_date, $maestro_email, $registered_account_type) {
// echo("$maestro_email : ".$maestro_email." / ");
// echo("$available_date : ".$available_date);
// return;
$postParamData = makeDefaultPostParamData($maestro_name, $maestro_email);
$postParamData["templateSid"] = "335";
$postParamData["parameters"] = array(
"account_type" => get_accout_type($registered_account_type),
"bank_account_no" => "3333-07-4977969",
"bank_name" => "카카오뱅크",
"bank_owner_name" => "박지상",
"maestro_email" => $maestro_email,
"maestro_name" => $maestro_name,
"available_date" => $available_date,
"new_available_date" => $new_available_date,
"price" => number_format(get_price($registered_account_type))
);
sendEmail($postParamData);
}
function sendMailExtensionDone($maestro_name, $new_available_date, $maestro_email) {
$postParamData = makeDefaultPostParamData($maestro_name, $maestro_email);
$postParamData["templateSid"] = "336";
$postParamData["parameters"] = array(
"maestro_name" => $maestro_name,
"new_available_date" => $new_available_date
);
sendEmail($postParamData);
}
function sendEmail($postParamData) {
global $host_name_url, $request_url, $access_key, $secret_key, $api_key, $method, $request_id;
global $sender_name, $sender_address;
$postParam = null;
if($method == "POST") {
$postParam = makePostParam($postParamData);
// echo "\n\r".$postParam."\n\r";
// set_data("postParam", $postParam);
} else {
$request_url = $request_url."/requests/".$request_id."/status";
}
$timestamp = getTimeStamp();
$signature = makeSignature($secret_key, $method, $request_url, $timestamp, $access_key);
// cUrl($postParam, $timestamp, $signature);
$recipients = getPostParamData($postParamData, "recipients");
$maestro_email = $recipients;
$subject = getPostParamData($postParamData, "title");
$body = getPostParamData($postParamData, "body");
send_mail($address, $subject, $body);
}
function makeRequestUrl() {
global $method, $request_url, $request_id;
if($method == "POST")
return $request_url;
else
return $request_url."/requests/".$request_id."/status";
}
function getPostParamData($postParamData, $key) {
if(array_key_exists($key, $postParamData))
return $postParamData[$key];
switch($key) {
case "body":
case "sender_address":
case "sender_name":
case "templateSid":
case "title":
return "";
break;
case "parameters":
case "recipients":
return array_map();
break;
case "individual":
return false;
break;
}
}
function makePostParam($postParamData) {
global $sender_name, $sender_address, $sender_bcc;
$postParam = array(
"advertising" => false, // 광고메일여부 default: false
"attachFileIds" => array_map(), // 첨부파일ID
"body" => getPostParamData($postParamData, "body"), // Email 본문
"individual" => getPostParamData($postParamData, "individual"),
// 개인발송여부 (개인발송 시 참조인, 숨은참조 무시됨) default: true
"parameters" => getPostParamData($postParamData, "parameters"),
// 치환 파라미터 (전체 수신자에게 적용), ‘치환 ID’ 를 key로, ‘치환 ID에 맵핑되는 값’ 을 value로 가지는 Map 형태의 Object
"recipients" => getPostParamData($postParamData, "recipients"),
"referencesHeader" => "",
// 특정 메일을 모아서 보기 위해 네이버 메일에서 지원하는 기능, 해당 필드에 동일한 값을 입력한 메일들을 모아서 볼 수 있다. (다음의 형태가 되어야 함 : <unique_id@domain.com> )
"reservationUtc" => "",
// 예약 발송 일시 ( 1970년 1월 1일 00:00:00 협정 세계시(UTC) 부터의 경과 시간을 1/1000초로 환산한 정수 ), reservationDateTime 값보다 이 값이 우선 적용된다.
"reservationDateTime" => "",
// 다음과 같은 형태의 예약 발송 일시 (‘yyyy-MM-dd HH:mm’ UTC+09:00), reservationUtc 값이 우선한다.
"sender_address" => getPostParamData($postParamData, "sender_address"), // 발송자 Email 주소
"sender_name" => getPostParamData($postParamData, "sender_name"), // 발송자 이름
"temprequest_id" => "", // 첨부파일 등록 시 사용한 임시 요청 ID
"templateSid" => getPostParamData($postParamData, "templateSid"), // 템플릿 ID
"title" => getPostParamData($postParamData, "title"), // Mail 제목
);
return json_encode($postParam);
}
function getTimeStamp() {
$timestamp = "";
$microtime = "";
list($microtime,$timestamp) = explode(' ',microtime());
$timestamp = $timestamp.substr($microtime, 2, 3);
return $timestamp;
}
function makeSignature($secret_key, $method, $uri, $timestamp, $access_key) {
$space = " ";
$newLine = "\n";
$hmac = $method.$space.$uri.$newLine.$timestamp.$newLine.$access_key;
$signature = base64_encode(hash_hmac('sha256', $hmac, $secret_key,true));
// set_data("signature", $signature);
return $signature;
}
/*
function cUrl($postParam, $timestamp, $signature) {
global $host_name_url, $request_url, $access_key, $secret_key, $api_key, $method, $request_id;
$is_post = false;
if($method == "POST")
$is_post = true;
try {
$url = $host_name_url.$request_url;
// echo $url."\n";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, $is_post);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
if($method == "POST") {
curl_setopt($ch, CURLOPT_POSTFIELDS, $postParam);
}
$headers = array();
$headers[] = "X-NCP-APIGW-TIMESTAMP: " .$timestamp;
$headers[] = "X-NCP-IAM-ACCESS-KEY: " .$access_key;
$headers[] = "X-NCP-APIGW-SIGNATURE-V2: " .$signature;
$headers[] = "content-type: application/json";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec ($ch);
$status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
// echo "status_code:".$status_code."\n";
curl_close ($ch);
if($status_code == 200) {
set_data("sendmail_respond", $response);
set_data("sendmail_postParam", $postParam);
} else if($status_code == 201) {
set_data("sendmail_succeed", $response);
set_data("sendmail_postParam", $postParam);
} else {
set_data("sendmail_error", $response);
set_data("sendmail_error_postParam", $postParam);
}
} catch(Exception $E) {
set_data("sendmail_error", $E->lastResponse);
set_data("sendmail_error_postParam", $postParam);
}
}
*/
function send_mail($address, $subject, $body) {
$mail = new PHPMailer(true);
try {
//Server settings
$mail->SMTPDebug = SMTP::DEBUG_SERVER; //Enable verbose debug output
$mail->isSMTP(); // Send using SMTP
$mail->Host = 'smtp.gmail.com'; // Set the SMTP server to send through
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'support@jinaju.com'; // SMTP username
$mail->Password = '52napark!'; // SMTP password
$mail->CharSet = 'utf-8';
$mail->Encoding = "base64";
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //Enable implicit TLS encryption
// $mail->SMTPSecure = 'ssl';
$mail->Port = 465; // TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` above
//Recipients
$mail->SetFrom('support@jinaju.com', '초코마에');
$mail->addAddress($address); // Add a recipient
// foreach ($addresses as $address) {
// $mail->addAddress($address);
// }
$mail->addReplyTo('support@jinaju.com', 'Information');
$mail->addCC('support@jinaju.com');
// Content
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = $subject;
$mail->Body = $body;
$mail->send();
echo 'Message has been sent';
return true;
} catch (Exception $e) {
//echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
return false;
}
}
/*
////////////////////////
// CentOS postfix e-mail sender (canceled)
////////////////////////
function makeMailHeader($from, $bcc) {
global $new_line;
return "From:".$from.$new_line."BCC:".$bcc;
}
////////////////////////////////////////
// 마에스트로 계정 신청 - 입금 안내
function sendMailRegisterBankInfo($maestro_name, $mail_to, $account_type) {
global $from, $bcc;
header("Content-Type: text/html; charset=UTF-8");
mb_send_mail(
$mail_to,
subjectRegisterBankInfo($maestro_name),
messageRegisterBankInfo($maestro_name, $account_type),
makeMailHeader($from, $bcc)
);
header("Content-Type: application/json");
}
function subjectRegisterBankInfo($maestro_name) {
return "[초코마에] ".$maestro_name." - 마에스트로 계정 등록을 위한 입금 안내";
};
function messageRegisterBankInfo($maestro_name, $account_type) {
global $new_line, $bank_name, $bank_account_no, $bank_owner_name;
$price = number_format(get_price($account_type));
return "안녕하세요.".$new_line.
"[초코마에] 마에스트로 계정을 신청해 주셔서 감사합니다.".$new_line
.$new_line
."※ 지금 보고 계신 메일이 [스팸 메일함]에 들어있다면, [스팸 해제]를 부탁드립니다 ※".$new_line
."(이후에 [계정 등록 알림], [계정 유효기간 종료 예고] 등의 메일이 발송됩니다)".$new_line
.$new_line
.$new_line
."신청하신 마에스트로 계정 내용은 아래와 같습니다.".$new_line
."1) 아이디 : ".$maestro_name.$new_line
."2) 요금제 : ".get_accout_type($account_type).$new_line
.$new_line
."계정 등록을 위한 은행 계좌 입금 정보는 아래와 같습니다.".$new_line
."------------------------------------------------------------".$new_line
." * 은행 계좌 : ".$bank_account_no." ( ".$bank_name.", 예금주 : ".$bank_owner_name." )".$new_line
." * 금액 : ".$price." 원".$new_line
." * 송금자명 : ".$maestro_name." (신청하신 마에스트로 아이디)".$new_line
." ☞ 빠른 입금 확인을 위해, 송금자명을 본인 이름 대신 위와 같이 아이디로 부탁드립니다 ☜".$new_line
."------------------------------------------------------------".$new_line
.$new_line
."* 혹시 신청하신 아이디가 아니라 본인 이름등으로 송금되었다면, 송금자명을 본 메일로 답신 부탁드립니다.".$new_line
.$new_line
."* 계정이 활성화되면 1년동안 사용하실 수 있습니다.".$new_line
."* 연장 결제를 해주시면, 남은 기간에 1년이 추가됩니다.".$new_line
."* 상위 요금제로 업그레이드 하셔도, 현재 계정의 남은 기간에 1년이 추가됩니다.".$new_line
."* 비활성화된 계정과 그 안에 있는 모든 정보는, 6개월 후에 자동 삭제됩니다.".$new_line
.$new_line
.$new_line
."계정 신청 내역과 입금 내역이 확인되는대로 마에스트로 아이디를 활성화 해드리겠습니다.".$new_line
."현재 수작업으로 확인하고 활성화하고 있어서 시간이 조금 걸리는 점 양해 부탁드립니다.".$new_line
."마에스트로 계정이 활성화되는대로, 즉시 알림 메일을 드리겠습니다.".$new_line
.$new_line
."감사합니다.".$new_line;
}
////////////////////////////////////////
// 마에스트로 계정 활성화 안내
function sendMailRegisterDone($maestro_name, $mail_to) {
global $from, $bcc;
header("Content-Type: text/html; charset=UTF-8");
mb_send_mail(
$mail_to,
subjectRegisterDone($maestro_name),
messageRegisterDone($maestro_name),
makeMailHeader($from, $bcc)
);
header("Content-Type: application/json");
}
function subjectRegisterDone($maestro_name) {
return "[초코마에] ".$maestro_name." - 마에스트로 계정 등록 및 활성화 완료";
};
function messageRegisterDone($maestro_name) {
global $new_line, $bank_name, $bank_account_no, $bank_owner_name;
return "안녕하세요.".$new_line.
"[초코마에] 마에스트로 계정을 신청해 주셔서 감사합니다.".$new_line
.$new_line
."※ 지금 보고 계신 메일이 [스팸 메일함]에 들어있다면, [스팸 해제]를 부탁드립니다 ※".$new_line
."(이후에 [계정 유효기간 종료 예고], [계정 업그레이드] 등의 메일이 발송됩니다)".$new_line
.$new_line
.$new_line
.$maestro_name." - 마에스트로 계정이 활성화 되었습니다.".$new_line
.$new_line
."* 계정이 활성화되면 1년동안 사용하실 수 있습니다.".$new_line
."* 연장 결제를 해주시면, 남은 기간에 1년이 추가됩니다.".$new_line
."* 상위 요금제로 업그레이드 하시면, 현재 계정의 남은 기간에 1년이 추가됩니다.".$new_line
."* 비활성화된 계정과 그 안에 있는 모든 정보는, 6개월 후에 자동 삭제됩니다.".$new_line
.$new_line
.$new_line
."등록하신 마에스트로 계정 정보는 마에스트로 로그인 후, [계정 정보 수정] 화면에서 변경이 가능합니다.".$new_line
."(변경 가능 정보 : 마에스트로 아이디, 이메일, 암호)".$new_line
.$new_line
."감사합니다.".$new_line;
}
////////////////////////////////////////
// 마에스트로 업그레이드 신청 - 입금 안내
function sendMailUpgradeBankInfo($maestro_name, $mail_to, $account_type, $upgrade_account_type) {
global $from, $bcc;
header("Content-Type: text/html; charset=UTF-8");
mb_send_mail(
$mail_to,
subjectUpgradeBankInfo($maestro_name),
messageUpgradeBankInfo($maestro_name, $account_type, $upgrade_account_type),
makeMailHeader($from, $bcc)
);
header("Content-Type: application/json");
}
function subjectUpgradeBankInfo($maestro_name) {
return "[초코마에] ".$maestro_name." - 마에스트로 계정 업그레이드를 위한 입금 안내";
};
function messageUpgradeBankInfo($maestro_name, $account_type, $upgrade_account_type) {
global $new_line, $bank_name, $bank_account_no, $bank_owner_name;
$price = number_format(get_price($upgrade_account_type) - get_price($account_type));
return "안녕하세요.".$new_line.
"[초코마에] 마에스트로 계정 요금제 업그레이드를 신청해주셔서 감사합니다.".$new_line
.$new_line
."※ 지금 보고 계신 메일이 [스팸 메일함]에 들어있다면, [스팸 해제]를 부탁드립니다 ※".$new_line
."(이후에 [계정 등록 알림], [계정 유효기간 종료 예고] 등의 메일이 발송됩니다)".$new_line
.$new_line
.$new_line
.$maestro_name." - 마에스트로 계정의 현재 요금제와 업그레이드 요금제는 아래와 같습니다.".$new_line
."1) 현재 사용중인 요금제 : ".get_accout_type($account_type).$new_line
."2) 신청하신 업그레이드 요금제 : ".get_accout_type($upgrade_account_type).$new_line
.$new_line
.$new_line
."계정 요금제 업그레이드를 위한 은행 계좌 입금 정보는 아래와 같습니다.".$new_line
."------------------------------------------------------------".$new_line
." * 은행 계좌 : ".$bank_account_no." ( ".$bank_name.", 예금주 : ".$bank_owner_name." )".$new_line
." * 금액 : ".$price." 원".$new_line
." * 송금자명 : ".$maestro_name." (신청하신 마에스트로 아이디)".$new_line
." ☞ 빠른 입금 확인을 위해, 송금자명을 본인 이름 대신 위와 같이 아이디로 부탁드립니다 ☜".$new_line
."------------------------------------------------------------".$new_line
.$new_line
."* 혹시 신청하신 아이디가 아니라 본인 이름등으로 송금되었다면, 송금자명을 본 메일로 답신 부탁드립니다.".$new_line
.$new_line
."* 상위 요금제로 업그레이드 하시면, 현재 계정의 남은 기간에 1년이 추가됩니다.".$new_line
."* 비활성화된 계정과 그 안에 있는 모든 정보는, 6개월 후에 자동 삭제됩니다.".$new_line
.$new_line
.$new_line
."계정 신청 내역과 입금 내역이 확인되는대로 마에스트로 아이디를 업그레이드 해드리겠습니다.".$new_line
."현재 수작업으로 확인하고 활성화하고 있어서 시간이 조금 걸리는 점 양해 부탁드립니다.".$new_line
."마에스트로 계정이 업그레이드 되는대로, 즉시 알림 메일을 드리겠습니다.".$new_line
.$new_line
."감사합니다.".$new_line;
}
////////////////////////////////////////
// 마에스트로 업그레이드 완료 안내
function sendMailUpgradeDone($maestro_name, $mail_to, $account_type, $upgrade_account_type) {
global $from, $bcc;
header("Content-Type: text/html; charset=UTF-8");
mb_send_mail(
$mail_to,
subjectUpgradeDone($maestro_name),
messageUpgradeDone($maestro_name, $account_type, $upgrade_account_type),
makeMailHeader($from, $bcc)
);
header("Content-Type: application/json");
}
function subjectUpgradeDone($maestro_name) {
return "[초코마에] ".$maestro_name." - 마에스트로 계정의 요금제 업그레이드 완료 알림";
};
function messageUpgradeDone($maestro_name, $account_type, $upgrade_account_type) {
global $new_line, $bank_name, $bank_account_no, $bank_owner_name;
return "안녕하세요.".$new_line.
"[초코마에] 마에스트로 계정 요금제 업그레이드를 신청해주셔서 감사합니다.".$new_line
.$new_line
."※ 지금 보고 계신 메일이 [스팸 메일함]에 들어있다면, [스팸 해제]를 부탁드립니다 ※".$new_line
."(이후에 [계정 유효기간 종료 예고], [계정 업그레이드] 등의 메일이 발송됩니다)".$new_line
.$new_line
.$new_line
.$maestro_name." - 마에스트로 계정의 요금제가 [ ".get_accout_type($account_type)." ] 에서 [ ".get_accout_type($upgrade_account_type)." ] 로 업그레이드 되었습니다.".$new_line
.$new_line
."* 마에스트로 계정 유효기간이 업그레이드 되기 전 남은 기간 + 추가 1년으로 설정되었습니다.".$new_line
.$new_line
.$new_line
."등록하신 마에스트로 계정 정보는 마에스트로 로그인 후, [계정 정보 수정] 화면에서 변경이 가능합니다.".$new_line
."(변경 가능 정보 : 마에스트로 아이디, 이메일, 암호)".$new_line
.$new_line
."감사합니다.".$new_line;
}
*/
?>
-53
View File
@@ -1,53 +0,0 @@
<?php
header("Content-Type: application/json");
include "./../lib/send_reply_json.php";
include "./../setup/connect_db.php";
include "./../lib/db_maestro.php";
include './mail_setting.php';
include './mail_contents.php';
include './../lib/maestro_account_info.php';
include "./send_jinaju_mail.php";
$type = $_POST["type"];
$maestro_id = $_POST["maestro_id"];
$maestro_name = $_POST["maestro_name"];
$password = $_POST["password"];
$available_date = $_POST["available_date"];
$new_available_date = $_POST["new_available_date"];
$maestro_email = $_POST["email"];
$account_type = $_POST["account_type"];
$upgrade_account_type = $_POST["upgrade_account_type"];
$registered_account_type = $_POST["registered_account_type"];
$maestro_name_prev = $_POST["maestro_name_prev"];
$maestro_email_prev = $_POST["email_prev"];
if($type == "sendMailRegisterBankInfo") {
$result = sendMailRegisterBankInfo($maestro_name, $maestro_email, $account_type);
} else if($type == "sendMailRegistered") {
$result = sendMailRegisterDone($maestro_name, $maestro_email);
} else if($type == "sendMailUpgradeBankInfo") {
$result = sendMailUpgradeBankInfo($maestro_name, $maestro_email, $account_type, $upgrade_account_type);
} else if($type == "sendMailUpgradeDone") {
$result = sendMailUpgradeDone($maestro_name, $maestro_email, $account_type, $upgrade_account_type);
} else if($type == "sendMailUpdateMaestroName") {
$result = sendMailUpdateMaestroName($maestro_name, $maestro_name_prev, $maestro_email);
} else if($type == "sendMailUpdateMaestroEmail") {
$result = sendMailUpdateMaestroEmail($maestro_name, $maestro_email, $maestro_email_prev);
} else if($type == "sendMailExtensionBankInfo") {
$result = sendMailExtensionBankInfo($maestro_name, $available_date, $new_available_date, $maestro_email, $registered_account_type);
} else if($type == "sendMailExtensionDone") {
$result = sendMailExtensionDone($maestro_name, $new_available_date, $maestro_email);
} else if($type == "get_maestro_data") {
// maestro data
$maestro_data = get_maestro_data($maestro_id);
set_data("maestroData", $maestro_data);
}
set_data("sendMailResult", $result);
send_result_success();
exit;
?>
-276
View File
@@ -1,276 +0,0 @@
<?php
header("Content-Type: application/json");
error_reporting( E_ALL );
ini_set( "display_errors", 1 );
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require_once __DIR__.'/../PHPMailer/src/Exception.php';
require_once __DIR__.'/../PHPMailer/src/PHPMailer.php';
require_once __DIR__.'/../PHPMailer/src/SMTP.php';
include_once "mail_setting.php";
// Register
function sendMailRegisterBankInfo($maestro_name, $maestro_email, $account_type) {
global $subjectMap, $bodyMap, $bank_account_no;
$subject = str_replace("{{maestro_name}}", $maestro_name, $subjectMap['registrationBankInfo']);
$body = str_replace("{{maestro_name}}", $maestro_name, $bodyMap['registrationBankInfo']);
$body = str_replace("{{student_count}}", get_max_player_count($account_type), $body);
$price = number_format(get_price($account_type));
$body = str_replace("{{price}}", $price, $body);
$body = str_replace("{{bank_account_no}}", $bank_account_no, $body);
return send_naver_mail($maestro_email, $maestro_name, $subject, $body);
}
function sendMailRegisterDone($maestro_name, $maestro_email) {
global $subjectMap, $bodyMap;
$subject = str_replace("{{maestro_name}}", $maestro_name, $subjectMap['registrationDone']);
$body = str_replace("{{maestro_name}}", $maestro_name, $bodyMap['registrationDone']);
return send_naver_mail($maestro_email, $maestro_name, $subject, $body);
}
// Register - closed beta, trial maestro
function sendMailTrialRegisterDone($maestro_name, $maestro_email, $account_type) {
global $subjectMap, $bodyMap;
$subject = str_replace("{{maestro_name}}", $maestro_name, $subjectMap['trialMaestroRegistrationDone']);
$body = str_replace("{{maestro_name}}", $maestro_name, $bodyMap['trialMaestroRegistrationDone']);
$body = str_replace("{{student_count}}", get_max_player_count($account_type), $body);
$price = number_format(get_price($account_type));
$body = str_replace("{{price}}", $price, $body);
$today = date("Y-m-d"); //현재 날짜
$two_weeks_later = date("Y-m-d", strtotime($today."+2 weeks"));
$body = str_replace("{{two_weeks_later}}", $two_weeks_later, $body);
return send_naver_mail($maestro_email, $maestro_name, $subject, $body);
}
// Extend
function sendMailExtensionBankInfo($maestro_name, $prev_date, $new_available_date, $maestro_email, $account_type) {
global $subjectMap, $bodyMap, $bank_account_no;
$subject = str_replace("{{maestro_name}}", $maestro_name, $subjectMap['extensionBankInfo']);
$body = str_replace("{{maestro_name}}", $maestro_name, $bodyMap['extensionBankInfo']);
$body = str_replace("{{student_count}}", get_max_player_count($account_type), $body);
$price = number_format(get_price($account_type));
$body = str_replace("{{price}}", $price, $body);
$body = str_replace("{{prev_date}}", $prev_date, $body);
$body = str_replace("{{new_available_date}}", $new_available_date, $body);
$body = str_replace("{{bank_account_no}}", $bank_account_no, $body);
return send_naver_mail($maestro_email, $maestro_name, $subject, $body);
}
function sendMailExtensionDone($maestro_name, $new_available_date, $maestro_email) {
global $subjectMap, $bodyMap;
$subject = str_replace("{{maestro_name}}", $maestro_name, $subjectMap['extensionDone']);
$body = str_replace("{{maestro_name}}", $maestro_name, $bodyMap['extensionDone']);
$body = str_replace("{{new_available_date}}", $new_available_date, $body);
return send_naver_mail($maestro_email, $maestro_name, $subject, $body);
}
// Upgrade - trial maestro
function sendMailTrialMaestroUpgradeBankInfo($maestro_name, $maestro_email, $prev_account_type, $upgrade_account_type) {
global $subjectMap, $bodyMap, $bank_account_no;
$subject = str_replace("{{maestro_name}}", $maestro_name, $subjectMap['trialMaestroUpgradeBankInfo']);
$body = str_replace("{{maestro_name}}", $maestro_name, $bodyMap['trialMaestroUpgradeBankInfo']);
$body = str_replace("{{prev_student_count}}", get_max_player_count($prev_account_type), $body);
$prev_price = number_format(get_price($prev_account_type));
$body = str_replace("{{upgrade_student_count}}", get_max_player_count($upgrade_account_type), $body);
$upgrade_price = number_format(get_price($upgrade_account_type));
$body = str_replace("{{upgrade_price}}", $upgrade_price, $body);
$body = str_replace("{{bank_account_no}}", $bank_account_no, $body);
$body = str_replace("{{price}}", $upgrade_price, $body);
return send_naver_mail($maestro_email, $maestro_name, $subject, $body);
}
function sendMailTrialMaestroUpgradeDone($maestro_name, $maestro_email, $prev_account_type, $upgrade_account_type) {
global $subjectMap, $bodyMap;
$subject = str_replace("{{maestro_name}}", $maestro_name, $subjectMap['trialMaestroUpgradeDone']);
$body = str_replace("{{maestro_name}}", $maestro_name, $bodyMap['trialMaestroUpgradeDone']);
$body = str_replace("{{prev_student_count}}", get_max_player_count($prev_account_type), $body);
$body = str_replace("{{upgrade_student_count}}", get_max_player_count($upgrade_account_type), $body);
$upgrade_price = number_format(get_price($upgrade_account_type));
$body = str_replace("{{upgrade_price}}", $upgrade_price, $body);
return send_naver_mail($maestro_email, $maestro_name, $subject, $body);
}
// Upgrade
function sendMailUpgradeBankInfo($maestro_name, $maestro_email, $prev_account_type, $upgrade_account_type) {
global $subjectMap, $bodyMap, $bank_account_no;
$subject = str_replace("{{maestro_name}}", $maestro_name, $subjectMap['upgradeBankInfo']);
$body = str_replace("{{maestro_name}}", $maestro_name, $bodyMap['upgradeBankInfo']);
$body = str_replace("{{prev_student_count}}", get_max_player_count($prev_account_type), $body);
$prev_price = number_format(get_price($prev_account_type));
$body = str_replace("{{prev_price}}", $prev_price, $body);
$body = str_replace("{{upgrade_student_count}}", get_max_player_count($upgrade_account_type), $body);
$upgrade_price = number_format(get_price($upgrade_account_type));
$body = str_replace("{{upgrade_price}}", $upgrade_price, $body);
$body = str_replace("{{bank_account_no}}", $bank_account_no, $body);
$charge_price = get_price($upgrade_account_type) - get_price($prev_account_type);
// $charge_price = (int)$upgrade_price - (int)$prev_price;
$body = str_replace("{{price}}", number_format($charge_price), $body);
return send_naver_mail($maestro_email, $maestro_name, $subject, $body);
}
function sendMailUpgradeDone($maestro_name, $maestro_email, $prev_account_type, $upgrade_account_type) {
global $subjectMap, $bodyMap;
$subject = str_replace("{{maestro_name}}", $maestro_name, $subjectMap['upgradeDone']);
$body = str_replace("{{maestro_name}}", $maestro_name, $bodyMap['upgradeDone']);
$body = str_replace("{{prev_student_count}}", get_max_player_count($prev_account_type), $body);
$prev_price = number_format(get_price($prev_account_type));
$body = str_replace("{{prev_price}}", $prev_price, $body);
$body = str_replace("{{upgrade_student_count}}", get_max_player_count($upgrade_account_type), $body);
$upgrade_price = number_format(get_price($upgrade_account_type));
$body = str_replace("{{upgrade_price}}", $upgrade_price, $body);
return send_naver_mail($maestro_email, $maestro_name, $subject, $body);
}
// Update
function sendMailUpdateMaestroName($maestro_name, $maestro_name_prev, $maestro_email) {
global $subjectMap, $bodyMap;
$subject = str_replace("{{update_maestro_name}}", $maestro_name, $subjectMap['updateMaestroName']);
$body = str_replace("{{prev_maestro_name}}", $maestro_name_prev, $bodyMap['updateMaestroName']);
$body = str_replace("{{update_maestro_name}}", $maestro_name, $body);
return send_naver_mail($maestro_email, $maestro_name, $subject, $body);
}
function sendMailUpdateMaestroEmail($maestro_name, $maestro_email, $maestro_email_prev) {
global $subjectMap, $bodyMap;
$subject = $subjectMap['updateMaestroEmail'];
$body = str_replace("{{prev_email}}", $maestro_email_prev, $bodyMap['updateMaestroEmail']);
$body = str_replace("{{update_email}}", $maestro_email, $body);
return send_naver_mail($maestro_email, $maestro_name, $subject, $body);
}
// experation
function sendMailTo7DaysLeftMestroEmail($maestro_name, $maestro_email, $available_date) {
global $subjectMap, $bodyMap;
$subject = str_replace("{{maestro_name}}", $maestro_name, $subjectMap['7daysLeft']);
$body = str_replace("{{maestro_name}}", $maestro_name, $bodyMap['7daysLeft']);
$body = str_replace("{{available_date}}", $available_date, $body);
return send_naver_mail($maestro_email, $maestro_name, $subject, $body);
}
function sendMailToOverDatedMestroEmail($maestro_name, $maestro_email, $available_date) {
global $subjectMap, $bodyMap;
$subject = str_replace("{{maestro_name}}", $maestro_name, $subjectMap['overdated']);
$body = str_replace("{{maestro_name}}", $maestro_name, $bodyMap['overdated']);
$body = str_replace("{{available_date}}", $available_date, $body);
return send_naver_mail($maestro_email, $maestro_name, $subject, $body);
}
function sendMailToClosedBetaPaidMestroEmail($maestro_name, $maestro_email, $available_date) {
global $subjectMap, $bodyMap;
$subject = str_replace("{{maestro_name}}", $maestro_name, $subjectMap['closedBetaPaid']);
$body = str_replace("{{maestro_name}}", $maestro_name, $bodyMap['closedBetaPaid']);
$body = str_replace("{{available_date}}", $available_date, $body);
return send_naver_mail($maestro_email, $maestro_name, $subject, $body);
}
// Load Composer's autoloader
// require $_SERVER['DOCUMENT_ROOT'] . '/vendor/autoload.php';
function send_naver_mail($maestro_email, $maestro_name, $subject, $body) {
global $new_line; // = "\r\n";
global $html_br_tag; // = "<br/>";
// global $from; // = "support+chocomae@jinaju.com";
// global $bcc; // = "support+chocomae.automail@jinaju.com";
// mail sender info
global $sender_name; // = "초코마에";
$sender_email = "jisangs@naver.com"; // = $from;
global $sender_address; // = $from;
global $sender_bcc; // = $bcc;
$mail = new PHPMailer(true);
try {
//Server settings
// $mail->SMTPDebug = SMTP::DEBUG_SERVER; // Enable verbose debug output
$mail->isSMTP(); // Send using SMTP
$mail->Host = 'smtp.naver.com'; // Set the SMTP server to send through
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = $sender_email; // SMTP username
$mail->Password = 'n52napark!'; // SMTP password
$mail->CharSet = 'utf-8';
$mail->Encoding = "base64";
// $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //Enable implicit TLS encryption
$mail->SMTPSecure = 'ssl';
$mail->Port = 465; // TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` above
//Recipients
$mail->SetFrom($sender_email, $sender_name);
$mail->addAddress($maestro_email, $maestro_name); // Add a recipient
$mail->addReplyTo($sender_address, $sender_name);
$mail->addBCC($sender_bcc);
// Content
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = $subject;
$mail->Body = $body;
$mail->send();
// set_data("message", "Message has been sent");
// send_result_success();
return true;
} catch (Exception $e) {
// set_error_code("Message could not be sent. Mailer Error: {".$mail->ErrorInfo."}");
// send_result_success();
return false;
}
}
-40
View File
@@ -1,40 +0,0 @@
<?php
header("Content-Type: application/json");
include_once "./mail_setting.php";
include_once "./send_gmail.php";
$maestro_email = "jisangs@naver.com";
$maestro_name = "박지상 마에스트로";
$subject = "Gmail 발신 테스트";
$body = "안녕하세요.".$new_line.
"[초코마에] 마에스트로 계정 요금제 업그레이드를 신청해주셔서 감사합니다.".$new_line
.$new_line
."※ 지금 보고 계신 메일이 [스팸 메일함]에 들어있다면, [스팸 해제]를 부탁드립니다 ※".$new_line
."(이후에 [계정 등록 알림], [계정 유효기간 종료 예고] 등의 메일이 발송됩니다)".$new_line
.$new_line
.$new_line
.$maestro_name." - 마에스트로 계정의 현재 요금제와 업그레이드 요금제는 아래와 같습니다.".$new_line
."1) 현재 사용중인 요금제 : ////".$new_line
."2) 신청하신 업그레이드 요금제 : ////".$new_line
.$new_line
.$new_line
."계정 요금제 업그레이드를 위한 은행 계좌 입금 정보는 아래와 같습니다.".$new_line
."------------------------------------------------------------".$new_line
." ☞ 빠른 입금 확인을 위해, 송금자명을 본인 이름 대신 위와 같이 아이디로 부탁드립니다 ☜".$new_line
."------------------------------------------------------------".$new_line
.$new_line
."* 혹시 신청하신 아이디가 아니라 본인 이름등으로 송금되었다면, 송금자명을 본 메일로 답신 부탁드립니다.".$new_line
.$new_line
."* 상위 요금제로 업그레이드 하시면, 현재 계정의 남은 기간에 1년이 추가됩니다.".$new_line
."* 비활성화된 계정과 그 안에 있는 모든 정보는, 6개월 후에 자동 삭제됩니다.".$new_line
.$new_line
.$new_line
."계정 신청 내역과 입금 내역이 확인되는대로 마에스트로 아이디를 업그레이드 해드리겠습니다.".$new_line
."현재 수작업으로 확인하고 활성화하고 있어서 시간이 조금 걸리는 점 양해 부탁드립니다.".$new_line
."마에스트로 계정이 업그레이드 되는대로, 즉시 알림 메일을 드리겠습니다.".$new_line
.$new_line
."감사합니다.".$new_line;
send_gmail($maestro_email, $maestro_name, $subject, $body);
-44
View File
@@ -1,44 +0,0 @@
<?php
header("Content-Type: application/json");
include './mail_setting.php';
include './mail_contents.php';
include './../lib/maestro_account_info.php';
include "./send_naver_mail.php";
$br = "<br>";
$maestro_email = "jisangs@daum.net";
$maestro_name = "박지상 마에스트로";
$subject = "Naver 메일 발신 테스트";
$body = "안녕하세요.".$br.
"[초코마에] 마에스트로 계정 요금제 업그레이드를 신청해주셔서 감사합니다.".$br
.$br
."※ 지금 보고 계신 메일이 [스팸 메일함]에 들어있다면, [스팸 해제]를 부탁드립니다 ※".$br
."(이후에 [계정 등록 알림], [계정 유효기간 종료 예고] 등의 메일이 발송됩니다)".$br
.$br
.$br
.$maestro_name." - 마에스트로 계정의 현재 요금제와 업그레이드 요금제는 아래와 같습니다.".$br
."1) 현재 사용중인 요금제 : ////".$br
."2) 신청하신 업그레이드 요금제 : ////".$br
.$br
.$br
."계정 요금제 업그레이드를 위한 은행 계좌 입금 정보는 아래와 같습니다.".$br
."------------------------------------------------------------".$br
." ☞ 빠른 입금 확인을 위해, 송금자명을 본인 이름 대신 위와 같이 아이디로 부탁드립니다 ☜".$br
."------------------------------------------------------------".$br
.$br
."* 혹시 신청하신 아이디가 아니라 본인 이름등으로 송금되었다면, 송금자명을 본 메일로 답신 부탁드립니다.".$br
.$br
."* 상위 요금제로 업그레이드 하시면, 현재 계정의 남은 기간에 1년이 추가됩니다.".$br
."* 비활성화된 계정과 그 안에 있는 모든 정보는, 6개월 후에 자동 삭제됩니다.".$br
.$br
.$br
."계정 신청 내역과 입금 내역이 확인되는대로 마에스트로 아이디를 업그레이드 해드리겠습니다.".$br
."현재 수작업으로 확인하고 활성화하고 있어서 시간이 조금 걸리는 점 양해 부탁드립니다.".$br
."마에스트로 계정이 업그레이드 되는대로, 즉시 알림 메일을 드리겠습니다.".$br
.$br
."감사합니다.".$br;
send_naver_mail($maestro_email, $maestro_name, $subject, $body);
+1 -1
View File
@@ -40,7 +40,7 @@ if($activateStatus == 0) {
exit;
}
$date = new DateTime($maestroInfo["availableActivateDateTime"]);
$date = new DateTime($maestroInfo["availableActivateDateTime"] ?? "now");
$now = new DateTime();
if($maestroInfo["activateStatus"] === 1 && $date < $now) {
set_error_message("마에스트로 계정의 유효기간이 지났습니다.\n(만료일 : ".$date->format("Y-m-d").")\n선생님께 문의하세요.");
@@ -8,7 +8,7 @@ include "./../setup/connect_db.php";
$maestro_id = (int)$_POST["MaestroID"];
$start_date = $_POST["StartDate"];
$end_date = $_POST["EndDate"];
$player_name = trim($_POST["PlayerNameList"]);
$player_name = trim($_POST["PlayerNameList"] ?? "");
$app_id = (int)$_POST["AppID"];
$limit_count = (int)$_POST["LimitCount"];
@@ -8,7 +8,7 @@ include "./../setup/connect_db.php";
$maestro_id = (int)$_POST["MaestroID"];
$start_date = $_POST["StartDate"];
$end_date = $_POST["EndDate"];
$player_name = trim($_POST["PlayerNameList"]);
$player_name = trim($_POST["PlayerNameList"] ?? "");
$app_id = (int)$_POST["AppID"];
$limit_count = (int)$_POST["LimitCount"];
@@ -8,7 +8,7 @@ include "./../setup/connect_db.php";
$maestro_id = (int)$_POST["MaestroID"];
$start_date = $_POST["StartDate"];
$end_date = $_POST["EndDate"];
$player_name = trim($_POST["PlayerNameList"]);
$player_name = trim($_POST["PlayerNameList"] ?? "");
$app_id = (int)$_POST["AppID"];
$limit_count = (int)$_POST["LimitCount"];
@@ -2,7 +2,7 @@
$db_host = "localhost";
$db_user = "chocomae";
$db_passwd = "sEobMPuJ2A8KTfwU";
$db_passwd = "Ei48X3lwT49DutyCH33LvULu";
$db_name = "chocomae";
$db_port = 3306;
+2 -2
View File
@@ -17,7 +17,7 @@ if (!isset($db_port)) $db_port = 3306;
mysqli_report(MYSQLI_REPORT_OFF);
// connect db with persistent connection (connection pool)
$db_conn = new mysqli("p:".$db_host, $db_user, $db_passwd, $db_name, $db_port);
$db_conn = new mysqli($db_host, $db_user, $db_passwd, $db_name, $db_port);
if ($db_conn->connect_error) {
set_error_message("DB connection failed.");
@@ -28,7 +28,7 @@ if ($db_conn->connect_error) {
// verify connection is alive (handle wait_timeout from server)
if (!$db_conn->ping()) {
$db_conn->close();
$db_conn = new mysqli("p:".$db_host, $db_user, $db_passwd, $db_name, $db_port);
$db_conn = new mysqli($db_host, $db_user, $db_passwd, $db_name, $db_port);
if ($db_conn->connect_error) {
set_error_message("DB connection failed.");
send_result_fail();