Add: maestro register
This commit is contained in:
@@ -20,8 +20,6 @@ function login() {
|
||||
xhr.open('POST', './../server/maestro/login.php', true);
|
||||
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||
xhr.send("maestro_name=" + name + "&password=" + password);
|
||||
|
||||
//응답
|
||||
xhr.onload = function() {
|
||||
if(xhr.readyState === 4 && xhr.status === 200) {
|
||||
let replyJSON = JSON.parse(xhr.responseText);
|
||||
|
||||
@@ -11,40 +11,133 @@
|
||||
</style>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
let maestro_name = "";
|
||||
let isAvailableID = false;
|
||||
|
||||
let password = "";
|
||||
let email = "";
|
||||
let accountType = 0;
|
||||
let selectedAccountTypeValue = "";
|
||||
|
||||
|
||||
function check_id() {
|
||||
maestro_name = $("#maestro_name").val();
|
||||
|
||||
let xhr = new XMLHttpRequest(); //new로 생성.
|
||||
xhr.open('POST', './../server/maestro/check_id.php', true);
|
||||
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||
xhr.send("maestro_name=" + maestro_name);
|
||||
xhr.onload = function() {
|
||||
if(xhr.readyState === 4 && xhr.status === 200) {
|
||||
let replyJSON = JSON.parse(xhr.responseText);
|
||||
// console.log(replyJSON);
|
||||
|
||||
// if(replyJSON !== null)
|
||||
// console.log(replyJSON);
|
||||
|
||||
// if(replyJSON["MaestroID"] !== undefined)
|
||||
// console.log(replyJSON["MaestroID"]);
|
||||
|
||||
if(replyJSON !== null && replyJSON["Result"] !== undefined && replyJSON["Result"] === "ok") {
|
||||
// sessionStorage.setItem("maestroID", replyJSON["MaestroID"]);
|
||||
// location.href = './../maestro/main_menu.html';
|
||||
isAvailableID = true;
|
||||
} else {
|
||||
isAvailableID = false;
|
||||
$("#error_message").val(replyJSON["ERROR"]);
|
||||
$("#maestro_name").val("");
|
||||
$("#maestro_name").focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function check_data() {
|
||||
if(!isAvailableID) {
|
||||
$("#error_message").val("아이디 중복 확인을 해 주세요.");
|
||||
$("#check_id").focus();
|
||||
return;
|
||||
}
|
||||
|
||||
password = $("#password").val();
|
||||
if(password.length === 0) {
|
||||
$("#error_message").val("패스워드를 입력해 주세요.");
|
||||
$("#password").focus();
|
||||
return;
|
||||
}
|
||||
|
||||
email = $("#email").val();
|
||||
if(email.length === 0) {
|
||||
$("#error_message").val("이메일을 입력해 주세요.");
|
||||
$("#email").focus();
|
||||
return;
|
||||
}
|
||||
|
||||
selectedAccountTypeValue = $("#account_type option:selected").text();
|
||||
console.log(selectedAccountTypeValue);
|
||||
|
||||
let isCheckAcceptClauses = $("#check_accept_clauses").is(":checked");
|
||||
if(!isCheckAcceptClauses) {
|
||||
$("#error_message").val("약관을 읽고, 동의 체크 버튼을 눌러 주세요.");
|
||||
$("#check_accept_clauses").focus();
|
||||
return;
|
||||
}
|
||||
|
||||
$(".maestro_name").append(maestro_name);
|
||||
$(".password").append(password);
|
||||
$(".email").append(email);
|
||||
$(".account_type").append(selectedAccountTypeValue);
|
||||
$(".price_account").append(selectedAccountTypeValue);
|
||||
|
||||
$("#input_data").css("display", "none");
|
||||
$("#register_account").css("display", "block");
|
||||
}
|
||||
|
||||
function register_account() {
|
||||
$("#register_account").css("display", "none");
|
||||
$("#banking_guide").css("display", "block");
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<div class="container">
|
||||
<div class="maestro_manager_user">
|
||||
<div id="input_data">
|
||||
|
||||
<h1>마에스트로 계정 신청</h1>
|
||||
|
||||
<form action="/action_page.php" method="get" id="register">
|
||||
(필수) 마에스트로 아이디 : <input type="text" name="id">
|
||||
<button >중복 확인</button><br/>
|
||||
(필수) 암호 : <input type="password" name="password"><br/>
|
||||
(필수) 이메일 : <input type="password" name="email"><br/>
|
||||
(필수) 학생 수 :
|
||||
<select>
|
||||
<option value="1">20명 : (1년) 1만원</option>
|
||||
<option value="1">50명 : (1년) 2만원</option>
|
||||
<option value="1">100명 : (1년) 3만원</option>
|
||||
</select>
|
||||
<br/>
|
||||
<br/>
|
||||
<input type="checkbox" name="accept_clauses">아래 약관을 읽었으며, 모든 내용에 동의합니다.<br/>
|
||||
<br/>
|
||||
<button type="submit" form="register">등록 신청</button>
|
||||
</form>
|
||||
(필수) 마에스트로 아이디 : <input type="text" id="maestro_name">
|
||||
<button id="check_id" onClick="check_id()">중복 확인</button><br/>
|
||||
(필수) 암호 : <input id="password" type="password" name="password"><br/>
|
||||
(필수) 이메일 : <input id="email" name="email"><br/>
|
||||
(필수) 학생 수 :
|
||||
<select id="account_type">
|
||||
<option name="account_type" value="1">20명 (1만원 / 1년)</option>
|
||||
<option name="account_type" value="1">50명 (2만원 / 1년)</option>
|
||||
<option name="account_type" value="1">100명 (3만원 / 1년)</option>
|
||||
</select>
|
||||
<br/>
|
||||
<br/>
|
||||
<input id="check_accept_clauses" type="checkbox" name="accept_clauses">아래 약관을 읽었으며, 모든 내용에 동의합니다.<br/>
|
||||
<br/>
|
||||
|
||||
<div class="col alignCenter">
|
||||
<a id="maestro_register" class="btn btn-sea width400" onClick="check_data()">등록 신청</a>
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
<textarea id="error_message">
|
||||
</textarea>
|
||||
|
||||
<h1>약관 주요 내용 요약</h1>
|
||||
|
||||
<p style="text-align: right;">마지막 갱신 : 2018년 6월 26일</p>
|
||||
|
||||
<div class="col alignCenter">
|
||||
<a href="#" id="maestro_register" class="btn btn-sea">약관 읽기</a>
|
||||
</div>
|
||||
|
||||
|
||||
<ol>
|
||||
<li>결제는 계좌 이체(송금)으로만 가능합니다. 신용카드 결제는 준비되지 않았습니다.</li>
|
||||
<li>결제는 계좌 이체(송금)으로만 가능합니다. 신용카드 결제는 준비되지 않았습니다.</li>
|
||||
@@ -55,25 +148,33 @@
|
||||
<li>서비스 업그레이드는 가능합니다. 업그레이드한 날부터 1년간 업그레이드 서비스가 시작됩니다.</li>
|
||||
</ol>
|
||||
|
||||
<div class="col alignCenter">
|
||||
<a id="agreement_clauses" class="btn btn-orange">전체 약관 읽기</a>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="register_account" style="display: none;">
|
||||
<h2>신청 정보 확인</h2>
|
||||
|
||||
마에스트로 아이디 : <span></span><br/>
|
||||
암호 : <span></span><br/>
|
||||
학생 수 : <span></span><br/>
|
||||
마에스트로 아이디 : <span class="maestro_name"></span><br/>
|
||||
암호 : <span class="password"></span><br/>
|
||||
이메일 : <span class="email"></span><br/>
|
||||
학생 수 : <span class="account_type"></span><br/>
|
||||
|
||||
<!--
|
||||
<h3>입금 계좌</h3>
|
||||
<div>
|
||||
카카오뱅크 : 9999-999999<br/>
|
||||
계좌 이름 : 박지상<br/>
|
||||
금액 : <span class="price_account"></span>원
|
||||
<div>보내는 사람 이름 : 요청하신 마에스트로 아이디 <span class="maestro_id"></span>로 입력해주세요.</div>
|
||||
<div>보내는 사람 이름 : 요청하신 마에스트로 아이디 <span class="maestro_name"></span>로 입력해주세요.</div>
|
||||
<div class="tip">보내는 사람 이름을 마에스트로 아이디로 해주실 경우, 가장 빠르게 계정을 활성화 해드릴 수 있습니다.</div>
|
||||
</div>
|
||||
-->
|
||||
|
||||
<div>
|
||||
<div>
|
||||
신청 내용이 모두 맞는지 확인해주세요.
|
||||
아래의 등록 신청 버튼을 누르면, 입력하신 이메일 주소로도 입금 내용을 보내드립니다.
|
||||
신청후에 <span class="price_account"></span>원을 송금해주세요.
|
||||
@@ -82,16 +183,17 @@
|
||||
<br/>
|
||||
|
||||
<div class="col alignCenter">
|
||||
<a href="#" id="send_register" class="btn btn-sea">마에스트로 계정 등록</a>
|
||||
<a href="#" id="send_register" class="btn btn-sea width400" onClick="register_account()">마에스트로 계정 등록</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div id="banking_guide" style="display: none;">
|
||||
<h2>신청 정보 확인</h2>
|
||||
|
||||
<div>마에스트로 아이디</div>
|
||||
<div class="maestro_id"></div>
|
||||
<div class="maestro_name"></div>
|
||||
<div>가 신청되었습니다.</div>
|
||||
|
||||
<h3>입금 계좌</h3>
|
||||
@@ -99,7 +201,7 @@
|
||||
카카오뱅크 : 9999-999999<br/>
|
||||
계좌 이름 : 박지상<br/>
|
||||
금액 : <span class="price_account"></span>원
|
||||
<div>보내는 사람 이름 : 요청하신 마에스트로 아이디 <span class="maestro_id"></span>로 입력해주세요.</div>
|
||||
<div>보내는 사람 이름 : 요청하신 마에스트로 아이디 <span class="maestro_name"></span>로 입력해주세요.</div>
|
||||
<div class="tip">보내는 사람 이름을 마에스트로 아이디로 해주실 경우, 가장 빠르게 계정을 활성화 해드릴 수 있습니다.</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$maestro_name = $_POST["maestro_name"];
|
||||
/*
|
||||
if(!is_numeric($enterCode)) {
|
||||
send_error_code('생년월일이 숫자가 아닙니다. : '.$enterCode);
|
||||
exit;
|
||||
} else if(strlen($enterCode) != 6) {
|
||||
send_error_code('6자리 숫자값을 정확히 입력하세요 : YYMMDD (예 : 120131) : '.$enterCode);
|
||||
exit;
|
||||
}
|
||||
*/
|
||||
|
||||
include "./../setup/connect_db.php";
|
||||
|
||||
$maestro_id = get_maestro_id($maestro_name);
|
||||
if($maestro_id !== null) {
|
||||
$replyJSON["ERROR"] = "등록된 마에스트로 아이디가 있습니다";
|
||||
echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
|
||||
$db_conn->close();
|
||||
exit;
|
||||
}
|
||||
|
||||
$replyJSON["Result"] = "ok";
|
||||
echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
|
||||
$db_conn->close();
|
||||
exit;
|
||||
|
||||
|
||||
function get_maestro_id($maestro_name) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "SELECT MaestroID FROM moty_maestro WHERE Name=?";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('s', $maestro_name);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($maestro_id);
|
||||
// while($stmt->fetch()) {
|
||||
// ;
|
||||
// }
|
||||
$stmt->fetch();
|
||||
$stmt->close();
|
||||
|
||||
return $maestro_id;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -3,6 +3,7 @@ header('Content-Type: application/json');
|
||||
|
||||
$maestro_name = $_POST["maestro_name"];
|
||||
$password = $_POST["password"];
|
||||
|
||||
/*
|
||||
if(!is_numeric($enterCode)) {
|
||||
send_error_code('생년월일이 숫자가 아닙니다. : '.$enterCode);
|
||||
@@ -55,7 +56,7 @@ function get_maestro_id($maestro_name) {
|
||||
function login($maestro_name, $password) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "SELECT MaestroID FROM moty_maestro WHERE Name=? AND Password=?";
|
||||
$query = "SELECT MaestroID FROM moty_maestro WHERE Name=? AND Password=PASSWORD(?)";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('ss', $maestro_name, $password);
|
||||
$stmt->execute();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
CREATE TABLE moty_maestro (
|
||||
MaestroID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
Name CHAR(50) NOT NULL,
|
||||
Password CHAR(10) NOT NULL,
|
||||
Password CHAR(50) NOT NULL,
|
||||
Email CHAR(50) NOT NULL,
|
||||
AccountType INT UNSIGNED NOT NULL,
|
||||
AccountStatus INT UNSIGNED NOT NULL,
|
||||
|
||||
Reference in New Issue
Block a user