From f7a9445954eed904550cab82dbfed8a54455a571 Mon Sep 17 00:00:00 2001 From: hide_d Date: Wed, 21 Mar 2018 02:57:59 +0900 Subject: [PATCH] =?UTF-8?q?=ED=83=88=ED=87=B4=20=ED=94=84=EB=A1=9C?= =?UTF-8?q?=EC=84=B8=EC=8A=A4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- f_install/sql/common_schema.sql | 2 +- i_entrance/Action.js | 3 +- i_entrance/j_delete_me.php | 73 +++++++++++++++++ i_entrance/j_icon_delete.php | 8 -- i_entrance/manage/Action.js | 0 i_entrance/manage/Frame.php | 54 ------------- i_entrance/manage/_common.php | 10 --- i_entrance/manage/quitPost.php | 34 -------- i_entrance/user_info.css | 2 +- i_entrance/user_info.html | 66 ++++++++++------ i_entrance/user_info.js | 134 ++++++++++++-------------------- twe/j_server_basic_info.php | 2 +- 12 files changed, 167 insertions(+), 221 deletions(-) create mode 100644 i_entrance/j_delete_me.php delete mode 100644 i_entrance/manage/Action.js delete mode 100644 i_entrance/manage/Frame.php delete mode 100644 i_entrance/manage/_common.php delete mode 100644 i_entrance/manage/quitPost.php diff --git a/f_install/sql/common_schema.sql b/f_install/sql/common_schema.sql index 06722bcd..552f1046 100644 --- a/f_install/sql/common_schema.sql +++ b/f_install/sql/common_schema.sql @@ -48,7 +48,7 @@ CREATE TABLE `member_log` ( `id` BIGINT(20) NOT NULL AUTO_INCREMENT, `member_no` INT(11) NOT NULL, `date` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, - `action_type` ENUM('reg','try_login','login','logout','oauth','change_pw','make_general','access_server') NOT NULL, + `action_type` ENUM('reg','try_login','login','logout','oauth','change_pw','make_general','access_server','delete') NOT NULL, `action` TEXT NULL DEFAULT NULL COMMENT 'JSON', PRIMARY KEY (`id`), INDEX `action` (`member_no`, `action_type`, `date`), diff --git a/i_entrance/Action.js b/i_entrance/Action.js index 67ae1c52..aa98a304 100644 --- a/i_entrance/Action.js +++ b/i_entrance/Action.js @@ -43,7 +43,6 @@ var serverLoginTemplate = "\ "; function Entrance_Import() { - ImportAction("../i_entrance/manage/Action.js"); } function Entrance_Init() { @@ -108,7 +107,7 @@ function Entrance_drawServerList(serverInfos){ TemplateEngine(serverTextInfo, game) ); - if(result.me){ + if(result.me && result.me.length > 1){ var me = result.me; me.serverPath = serverPath; $serverHtml.append( diff --git a/i_entrance/j_delete_me.php b/i_entrance/j_delete_me.php new file mode 100644 index 00000000..d900acc0 --- /dev/null +++ b/i_entrance/j_delete_me.php @@ -0,0 +1,73 @@ +isLoggedIn()) { + returnJson([ + 'result'=>false, + 'reason'=>'로그인되지 않았습니다.' + ]); +} + +// 외부 파라미터 +// $_POST['pw'] : PW +$pw = $_POST['pw']; + +if(!$pw){ + returnJson([ + 'result'=>false, + 'reason'=>'패스워드를 입력해주세요.' + ]); +} + +//TODO: 탈퇴 처리하되 한달간 유지. +$db = getRootDB(); + +$userInfo = $db->queryFirstRow('SELECT oauth_id, oauth_type, email, delete_after FROM MEMBER '. + 'WHERE `no`=%i and pw=sha2(concat(salt, %s, salt), 512)', + $SESSION->NoMember(), $pw); + +if(!$userInfo){ + returnJson([ + 'result'=>false, + 'reason'=>'현재 비밀번호가 일치하지 않습니다.' + ]); +} + +if($userInfo['delete_after']){ + returnJson([ + 'result'=>false, + 'reason'=>'이미 탈퇴 처리되어있습니다.' + ]); +} + +$db->update('member',[ + 'delete_after'=>_Time::DatetimeFromNowMinute(60*24*30) +], 'no=%i', $SESSION->NoMember()); + +if(!$db->affectedRows()){ + returnJson([ + 'result'=>false, + 'reason'=>'알 수 없는 이유로 탈퇴에 실패했습니다.' + ]); +} + + + +$db->insert('member_log', [ + 'member_no'=>$SESSION->NoMember(), + 'action_type'=>'delete' +]); + +$SESSION->logout(); +unset($_SESSION['access_token']); +setcookie("hello", "", time()-3600); + +returnJson([ + 'result'=>true, + 'reason'=>'success' +]); diff --git a/i_entrance/j_icon_delete.php b/i_entrance/j_icon_delete.php index 933fe14f..a9b517aa 100644 --- a/i_entrance/j_icon_delete.php +++ b/i_entrance/j_icon_delete.php @@ -43,14 +43,6 @@ if($dt == $rf) { 'IMGSVR'=>0, ], 'NO=%i', $SESSION->NoMember()); - //TODO: 각 세부 서버가 '열린 경우' 이미지를 갱신하도록 처리 - //Token을 받아 처리하는 형식이면 가능할듯. - /* - for($i=0; $i < ; $i++) { - Update('general', "PICTURE='default.jpg', IMGSVR=0", "NPC=0 AND USER_ID='{$member['ID']}'"); - } - */ - $servers = []; foreach(getServerConfigList() as $key=>$server){ diff --git a/i_entrance/manage/Action.js b/i_entrance/manage/Action.js deleted file mode 100644 index e69de29b..00000000 diff --git a/i_entrance/manage/Frame.php b/i_entrance/manage/Frame.php deleted file mode 100644 index 5bd407bd..00000000 --- a/i_entrance/manage/Frame.php +++ /dev/null @@ -1,54 +0,0 @@ - - -
-
계 정 관 리
- - -
회 원 정 보
- -
ID
-
- -
비밀번호
-
- 현재비번: - 바꿀비번: - 다시입력: - -
- -
닉네임
-
-
등급
-
- -
-
-
기존 / 신규
-
전용아이콘 올리기
- -
전용사진
-
- - -
-
- -
- -
- - -
- -
도움말
-
-
jpg,png,gif 파일 64 x 64 크기만 가능합니다.
-서버최적화를 위해 신규에서 기존으로 약 월1회 저장됩니다.
-브라우저의 임시파일을 삭제하셔야 제대로 나옵니다.
-새로 캐릭터를 생성할때부터 적용됩니다.
-탈퇴신청시 1개월간 정보가 보존되며,
-1개월간 재가입이 불가능합니다.
-
-
diff --git a/i_entrance/manage/_common.php b/i_entrance/manage/_common.php deleted file mode 100644 index 5bdcfa60..00000000 --- a/i_entrance/manage/_common.php +++ /dev/null @@ -1,10 +0,0 @@ -queryFirstRow('SELECT `PW` FROM `MEMBER` WHERE `NO` = %i', $SESSION->NoMember()); - -if($member['PW'] != $pw) { - $response['result'] = 'FAIL'; - $response['msg'] = '실패: 현재 비밀번호가 일치하지 않습니다.'; -} else { - $db->update('MEMBER', array( - 'QUIT' => 'Y', - 'REG_DATE'=> _Time::DatetimeNow() - ), 'NO=%i', $SESSION->NoMember()); - - - $SESSION->logout(); - - $response['result'] = 'SUCCESS'; - $response['msg'] = "정상적으로 탈퇴신청 되었습니다."; -} - -echo json_encode($response); - - diff --git a/i_entrance/user_info.css b/i_entrance/user_info.css index bb787525..436f22b8 100644 --- a/i_entrance/user_info.css +++ b/i_entrance/user_info.css @@ -39,7 +39,7 @@ position:absolute; height:16px; left:10px; - width:150px; + width:130px; top:16px; } diff --git a/i_entrance/user_info.html b/i_entrance/user_info.html index ecf2c659..9bc025a8 100644 --- a/i_entrance/user_info.html +++ b/i_entrance/user_info.html @@ -30,38 +30,24 @@ - + + + - 회 원 정 보 + 회 원 정 보 ID - + - + - 비밀번호 - -
- - - -
- -
- -
- -
- - - 닉네임 @@ -70,23 +56,53 @@ + - + 회원 탈퇴 + 비밀번호 변경 + + + 정보
수정 + +
+ +
+
+ +
+ + +
+ + + +
+ +
+ +
+ +
+ + + + + 현재 / 신규 - + 전용 아이콘 변경 전용
아이콘 - + - +
@@ -101,7 +117,7 @@ 도움말 - +

아이콘은 64 x 64픽셀, 10KB 이하의 jpg, gif, png 파일만 가능합니다.

탈퇴시 1개월간 정보가 보존되며, 1개월간 재가입이 불가능합니다. diff --git a/i_entrance/user_info.js b/i_entrance/user_info.js index 9caf9789..8a45d937 100644 --- a/i_entrance/user_info.js +++ b/i_entrance/user_info.js @@ -68,9 +68,16 @@ function deleteIcon(){ function changeIcon(e){ e.preventDefault(); - console.log('haha'); var $icon = $('#image_upload'); + + if($icon[0].files.length == 0){ + alert('파일을 선택해주세요'); + return false; + } var icon = $icon[0].files[0]; + + + $.ajax({ type:'post', url:'j_icon_change.php', @@ -156,6 +163,40 @@ function changePassword(e){ }); } +function deleteMe(){ + var $form = $('#delete_me_form'); + + var pw = $('#delete_pw').val(); + + if(!pw){ + alert('비밀번호를 입력해야 합니다.'); + return; + } + + var global_salt = $('#global_salt').val(); + + var password = sha512(global_salt+pw+global_salt); + + $.ajax({ + type:'post', + url:'j_delete_me.php', + dataType:'json', + data:{ + pw:password + } + }).then(function(result){ + if(!result.result){ + alert(result.reason); + } + else{ + alert('탈퇴 처리되었습니다.'); + location.href='../'; + } + },function(){ + alert('알 수 없는 이유로 회원탈퇴에 실패했습니다.'); + }); +} + $(function(){ $.ajax({ type:'post', @@ -180,29 +221,16 @@ $(function(){ $('#change_pw_form').submit(changePassword); $('#change_icon_form').submit(changeIcon); + + $('#delete_me_form').submit(function(e){ + e.preventDefault(); + if(confirm('한 달 동안 재 가입할 수 없습니다. 정말로 탈퇴할까요?')){ + deleteMe(e); + } + }); }) - -function EntranceManage_Import() { -} - -function EntranceManage_Init() { - $("#EntranceManage_0001").click(EntranceManage_Back); - $("#EntranceManage_000603").click(EntranceManage_ChangePw); - $("#EntranceManage_001600").attr("disabled", "true"); - $("#EntranceManage_001601").change(EntranceManage_SelectIcon); - $("#EntranceManage_001602").click(EntranceManage_ChangeIcon); - $("#EntranceManage_001603").click(EntranceManage_DeleteIcon); - $("#EntranceManage_0019").click(EntranceManage_Quit); - - if(navigator.userAgent.match('mozilla')) { - $("#EntranceManage_001601").css("left", "10px"); - } else { - $("#EntranceManage_001600").show(); - } -} - function EntranceManage_Update() { Popup_Wait(function() { PostJSON( @@ -220,70 +248,6 @@ function EntranceManage_Update() { }); } -function EntranceManage_Back() { - $("#EntranceManage_00").hide(); - $("#Entrance_00").show(); - Entrance_Update(); -} - -function EntranceManage_SelectIcon() { - $("#EntranceManage_001600").val($("#EntranceManage_001601").val()); -} - -function EntranceManage_UpdateInfo(member) { - $("#EntranceManage_0004").text(member.id); - $("#EntranceManage_0008").text(member.name); - $("#EntranceManage_0010").text(member.grade); - $("#EntranceManage_001500").attr("src", member.picture0); - $("#EntranceManage_001501").attr("src", member.picture1); -} - -function EntranceManage_ChangePw() { - var pw = $("#EntranceManage_000600").val(); - var pw1 = $("#EntranceManage_000601").val(); - var pw2 = $("#EntranceManage_000602").val(); - - if(pw.length < 4 || pw.length > 12) { - Popup_Alert("비밀번호 길이가 부적합합니다!", function() { - $("#EntranceManage_000600").val(""); - $("#EntranceManage_000600").focus(); - }); - return false; - } - if(pw1.length < 4 || pw1.length > 12) { - Popup_Alert("비밀번호 길이가 부적합합니다!", function() { - $("#EntranceManage_000601").val(""); - $("#EntranceManage_000601").focus(); - }); - return false; - } - if(pw1 != pw2) { - Popup_Alert("비밀번호가 일치하지 않습니다!", function() { - $("#EntranceManage_000601").val(""); - $("#EntranceManage_000601").focus(); - }); - return false; - } - - Popup_Confirm('정말 실행하시겠습니까?', function() { - Popup_Wait(function() { - PostJSON( - "../../i_entrance/manage/passwordPost.php", { - pw: hex_md5(pw+""+pw), - newPw: hex_md5(pw1+""+pw1) - }, - function(response, textStatus) { - Popup_WaitShow(response.msg, function() { - $("#EntranceManage_000600").val(""); - $("#EntranceManage_000601").val(""); - $("#EntranceManage_000602").val(""); - }); - } - ) - }) - }); -} - function EntranceManage_ChangeIcon() { if($("#EntranceManage_001601").val() == "") { Popup_Alert("파일을 선택해 주세요!"); diff --git a/twe/j_server_basic_info.php b/twe/j_server_basic_info.php index b6485b8d..df5b6f40 100644 --- a/twe/j_server_basic_info.php +++ b/twe/j_server_basic_info.php @@ -90,5 +90,5 @@ if($generalID){ //TODO: 이를 표현하는 방법은 '이전 버전'의 serverListPost.php를 참고할 것. returnJson([ 'game'=>$game, - 'me'=>$me + 'me'=>$me?$me:null ]); \ No newline at end of file