Add: sql - login, history_record
This commit is contained in:
+14
-49
@@ -54,20 +54,20 @@ class Login {
|
||||
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2)
|
||||
.boundsAlignH = 'right';
|
||||
|
||||
this.inputTextBirthday = new InputTypeText(inputX, birthdayTextY);
|
||||
this.inputTextBirthday.anchor.set(0.5);
|
||||
this.inputTextBirthday.canvasInput.value('');
|
||||
this.inputTextEnterCode = new InputTypeText(inputX, birthdayTextY);
|
||||
this.inputTextEnterCode.anchor.set(0.5);
|
||||
this.inputTextEnterCode.canvasInput.value('');
|
||||
if(isDebugMode()) {
|
||||
this.inputTextBirthday.canvasInput.value('760621');
|
||||
this.inputTextEnterCode.canvasInput.value('760621');
|
||||
}
|
||||
this.inputTextBirthday.canvasInput._onkeyup = function() {
|
||||
this.inputTextEnterCode.canvasInput._onkeyup = function() {
|
||||
if(event.keyCode == Phaser.Keyboard.ENTER) {
|
||||
self.startMenu();
|
||||
}
|
||||
}
|
||||
|
||||
this.inputTextName.canvasInput.focus();
|
||||
// this.inputTextBirthday.canvasInput.focus();
|
||||
// this.inputTextEnterCode.canvasInput.focus();
|
||||
}
|
||||
|
||||
makeButton() {
|
||||
@@ -80,50 +80,15 @@ class Login {
|
||||
|
||||
startMenu() {
|
||||
sessionStorageManager.playerName = self.inputTextName.canvasInput._value;
|
||||
let birthday = self.inputTextBirthday.canvasInput._value;
|
||||
let enterCode = self.inputTextEnterCode.canvasInput._value;
|
||||
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.onreadystatechange = function() {
|
||||
// console.log("onreadystatechange : " + xhr);
|
||||
// console.log("xhr.readyState : " + xhr.readyState);
|
||||
// console.log("xhr.status : " + xhr.status);
|
||||
if(xhr.readyState == 4 && xhr.status == 200) {
|
||||
// console.log(xhr.responseText);
|
||||
let jsonData = JSON.parse(xhr.responseText);
|
||||
// console.log(JSON.stringify(jsonData));
|
||||
|
||||
// console.log(jsonData);
|
||||
if(jsonData != null && jsonData["UserID"] != null) {
|
||||
// login successed
|
||||
|
||||
self.loginSucceeded(jsonData);
|
||||
} else {
|
||||
// login failed
|
||||
self.loginFailed(jsonData);
|
||||
}
|
||||
}
|
||||
}
|
||||
xhr.open('POST', '../../web/client/php/check_user.php', true);
|
||||
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
||||
let param = 'name=' + sessionStorageManager.playerName + '&birthday=' + birthday;
|
||||
// console.log(param);
|
||||
xhr.send(param);
|
||||
|
||||
/*
|
||||
let params = {
|
||||
'name': this.inputTextName.canvasInput._value,
|
||||
'birthday': this.inputTextBirthday.canvasInput._value
|
||||
};
|
||||
console.log(params);
|
||||
console.log(JSON.stringify(params));
|
||||
|
||||
xhr.setRequestHeader("Content-type", "application/json");
|
||||
// let data = JSON.stringify({"name":"박지상","birthday":"760621","test":101});
|
||||
xhr.send(data);
|
||||
xhr.send(JSON.stringify(params));
|
||||
|
||||
// xhr.send(null);
|
||||
*/
|
||||
let dbConnectManager = new DBConnectManager();
|
||||
dbConnectManager.requestCheckUserLogin(
|
||||
sessionStorageManager.playerName,
|
||||
enterCode,
|
||||
self.loginSucceeded,
|
||||
self.loginFailed
|
||||
);
|
||||
}
|
||||
|
||||
loginSucceeded(jsonData) {
|
||||
|
||||
Reference in New Issue
Block a user