diff --git a/.gitignore b/.gitignore index a9be39c2..059a9260 100644 --- a/.gitignore +++ b/.gitignore @@ -129,3 +129,4 @@ pwe/.htaccess twe/.htaccess hwe/.htaccess +d_pic/*.jpg \ No newline at end of file diff --git a/f_config/config.css b/f_config/config.css index 320fcaa0..caa069d9 100644 --- a/f_config/config.css +++ b/f_config/config.css @@ -36,6 +36,12 @@ div { border-bottom-color: black; } +.section_title { + height:50px; + line-height:50px; + font-size: 30px; font-weight: bold; + text-align: center; +} .legacy_layout div { border: solid 1px; border-spacing: 0px; border-collapse: separate; border-top-color: gray; border-left-color: gray; border-right-color: black; border-bottom-color: black; diff --git a/i_entrance/Action.js b/i_entrance/Action.js index 4066d470..67ae1c52 100644 --- a/i_entrance/Action.js +++ b/i_entrance/Action.js @@ -44,14 +44,9 @@ var serverLoginTemplate = "\ function Entrance_Import() { ImportAction("../i_entrance/manage/Action.js"); - - EntranceManage_Import(); } function Entrance_Init() { - EntranceManage_Init(); - - $("#btn_user_manage").click(Entrance_Manage); $("#btn_logout").click(Entrance_Logout); } @@ -159,12 +154,6 @@ function Entrance_ServerListPosition() { $("#Entrance_0003").css("top", top+"px"); } -function Entrance_Manage() { - $("#Entrance_00").hide(); - $("#EntranceManage_00").show(); - EntranceManage_Update(); -} - function Entrance_Logout() { Popup_Wait(function() { PostJSON( diff --git a/i_entrance/Style.css b/i_entrance/Style.css index c1c1477f..451c1738 100644 --- a/i_entrance/Style.css +++ b/i_entrance/Style.css @@ -1,7 +1,5 @@ @charset "utf-8"; -@import url("manage/Style.css"); - #server_notice { margin:10px 0; border: none; @@ -46,12 +44,6 @@ width: 800px; height: 130px; } -.section_title { - height:50px; - line-height:50px; - font-size: 30px; font-weight: bold; - text-align: center; -} #user_info button{ width: 200px; diff --git a/i_entrance/admin_userlist.php b/i_entrance/admin_userlist.php index 3d148509..6804d423 100644 --- a/i_entrance/admin_userlist.php +++ b/i_entrance/admin_userlist.php @@ -1,3 +1,81 @@ getGrade(); + +if($userGrade < 6){ + header('Location:../'); + die(); +} +?> + + + +
+
+ 회 원 정 보 + (0/0) +
+ +
+
+ + + + + + +
+
+ 선택: + + +
+
+ 선택: + + + + + + + + + +
+
+
순번
+
ID
+
민번
+
닉네임
+
IP
+
블럭
+
최근블럭일
+
등록
+
최근등록일
+
등급
+
사진
+
SVR
+
탈퇴
+
+
+
+
diff --git a/i_entrance/entrance.php b/i_entrance/entrance.php index de048f1c..f5249830 100644 --- a/i_entrance/entrance.php +++ b/i_entrance/entrance.php @@ -23,8 +23,6 @@ $userGrade = $SESSION->getGrade(); - - @@ -41,7 +39,6 @@ $userGrade = $SESSION->getGrade(); - = 6) { include('member/Frame.php'); @@ -97,7 +94,7 @@ if($userGrade >= 6){
계 정 관 리
- +
diff --git a/i_entrance/j_change_password.php b/i_entrance/j_change_password.php new file mode 100644 index 00000000..fea00194 --- /dev/null +++ b/i_entrance/j_change_password.php @@ -0,0 +1,59 @@ +isLoggedIn()) { + returnJson([ + 'result'=>false, + 'reason'=>'로그인되지 않았습니다.' + ]); +} + +session_write_close(); + +// 외부 파라미터 +// $_POST['old_pw'] : PW +// $_POST['new_pw'] : 새 PW +$pw = $_POST['old_pw']; +$newPw = $_POST['new_pw']; + +$response['result'] = false; + +$db = getRootDB(); + +$userInfo = $db->update('member',[ + 'pw'=>$db->sqleval('sha2(concat(salt, %s, salt), 512)', $newPw) +], 'no=%i and pw=sha2(concat(salt, %s, salt), 512)', $SESSION->NoMember(), $pw); + +if(!$db->affectedRows()){ + $db->insert('member_log', [ + 'member_no'=>$SESSION->NoMember(), + 'action_type'=>'change_pw', + 'action'=>json_encode([ + 'type'=>'plain', + 'result'=>false + ]) + ]); + + returnJson([ + 'result'=>false, + 'reason'=>'현재 비밀번호가 일치하지 않습니다.' + ]); +} + +$db->insert('member_log', [ + 'member_no'=>$SESSION->NoMember(), + 'action_type'=>'change_pw', + 'action'=>json_encode([ + 'type'=>'plain', + 'result'=>true + ]) +]); + +returnJson([ + 'result'=>true, + 'reason'=>'success' +]); \ No newline at end of file diff --git a/i_entrance/j_get_user_info.php b/i_entrance/j_get_user_info.php new file mode 100644 index 00000000..a4a6a79b --- /dev/null +++ b/i_entrance/j_get_user_info.php @@ -0,0 +1,54 @@ +isLoggedIn()) { + returnJson([ + 'result'=>false, + 'reason'=>'로그인되지 않았습니다.' + ]); +} + +// 외부 파라미터 + +$db = getRootDB(); +$member = $db->queryFirstRow('SELECT `id`, `name`, `grade`, `picture` FROM `MEMBER` WHERE `NO` = %i', $SESSION->NoMember()); + +if(!$member['picture']){ + $picture = IMAGE.W.'default.jpg'; +} +else{ + $picture = $member['picture']; + if(strlen($picture) > 11){ + $picture = substr($picture, 0, -10); + } + $picture = '../d_pic/'.$picture; + if(!file_exists($picture)){ + $picture = IMAGE.W.$picture; + } +} + +if($member['grade'] == 6) { + $grade = '운영자'; +} elseif($member['grade'] == 5) { + $grade = '부운영자'; +} elseif($member['grade'] > 1) { + $grade = '특별회원'; +} elseif($member['grade'] == 1) { + $grade = '일반회원'; +} elseif($member['grade'] == 0) { + $grade = '블럭회원'; +} + +returnJson([ + 'result'=>true, + 'reason'=>'success', + 'id'=>$member['id'], + 'name'=>$member['name'], + 'grade'=>$grade, + 'picture'=>$picture, + 'global_salt'=>getGlobalSalt() +]); diff --git a/i_entrance/manage/iconPost.php b/i_entrance/j_icon_change.php similarity index 53% rename from i_entrance/manage/iconPost.php rename to i_entrance/j_icon_change.php index 5f43f319..61560a42 100644 --- a/i_entrance/manage/iconPost.php +++ b/i_entrance/j_icon_change.php @@ -1,14 +1,23 @@ isLoggedIn()) { + returnJson([ + 'result'=>false, + 'reason'=>'로그인되지 않았습니다.' + ]); +} // 외부 파라미터 -// $_FILES['picture'] : 사진파일 +// $_FILES['image_upload'] : 사진파일 $defaultImg = 'default.jpg'; -$image = $_FILES['picture']; +$image = $_FILES['image_upload']; $ext = strrchr($image['name'], "."); $size = getImageSize($image['tmp_name']); @@ -33,33 +42,30 @@ else{ $dt = '00000000'; } -$old_path = ROOT.'/d_pic/'.$picName; - - $rf = date('Ymd'); -$response['result'] = 'FAIL'; -$response['msg'] = '요청이 올바르지 않습니다!'; +$response['result'] = false; +$response['reason'] = '요청이 올바르지 않습니다!'; if(!is_uploaded_file($image['tmp_name'])) { //진짜 전송된 파일인지 검증 - $response['msg'] = '업로드가 되지 않았습니다!'; - $response['result'] = 'FAIL'; + $response['reason'] = '업로드가 되지 않았습니다!'; + $response['result'] = false; } elseif(!$newExt) { //확장자 검사 - $response['msg'] = 'jpg, gif, png 파일이 아닙니다!'; - $response['result'] = 'FAIL'; + $response['reason'] = 'jpg, gif, png 파일이 아닙니다!'; + $response['result'] = false; } elseif($image['size'] > 10000) { //파일크기 검사 - $response['msg'] = '10kb 이하로 올려주세요!'; - $response['result'] = 'FAIL'; + $response['reason'] = '10kb 이하로 올려주세요!'; + $response['result'] = false; } elseif($size[0] != 64 || $size[1] != 64) { //이미지크기 검사 - $response['msg'] = '64x64 크기로 올려주세요!'; - $response['result'] = 'FAIL'; + $response['reason'] = '64x64 크기로 올려주세요!'; + $response['result'] = false; } elseif($dt == $rf) { //갱신날짜 검사 - $response['msg'] = '1일 1회 변경 가능합니다!'; - $response['result'] = 'FAIL'; + $response['reason'] = '1일 1회 변경 가능합니다!'; + $response['result'] = false; } else { //이미지 저장 @@ -73,8 +79,8 @@ if(!is_uploaded_file($image['tmp_name'])) { } if(!move_uploaded_file($image['tmp_name'], $dest)) { - $response['msg'] = '업로드에 실패했습니다!'; - $response['result'] = 'FAIL'; + $response['reason'] = '업로드에 실패했습니다!'; + $response['result'] = false; } else { $pic = "{$newPicName}?={$rf}"; getRootDB()->update('MEMBER',[ @@ -82,20 +88,21 @@ if(!is_uploaded_file($image['tmp_name'])) { 'IMGSVR' => 1 ], 'NO=%i', $SESSION->NoMember()); - //TODO: 각 서버에도 전파 - //Update('general', "PICTURE='{$pic}', IMGSVR=1", "NPC=0 AND USER_ID='{$member['ID']}'"); + $servers = []; - $response['msg'] = '업로드에 성공했습니다!'; - $response['result'] = 'SUCCESS'; + foreach(getServerConfigList() as $key=>$server){ + $setting = $server[2]; + if($setting->isExists()){ + $servers[] = $key; + } + } + + $response['servers'] = $servers; + + $response['reason'] = '업로드에 성공했습니다!'; + $response['result'] = true; } } -/* -echo ""; -*/ -echo ROOT.'/i_entrance/entrance.php';//TODO:debug all and replace - +returnJson($response); \ No newline at end of file diff --git a/i_entrance/j_icon_delete.php b/i_entrance/j_icon_delete.php new file mode 100644 index 00000000..933fe14f --- /dev/null +++ b/i_entrance/j_icon_delete.php @@ -0,0 +1,68 @@ +isLoggedIn()) { + returnJson([ + 'result'=>false, + 'reason'=>'로그인되지 않았습니다.' + ]); +} + +// 외부 파라미터 + +$respone = []; +$db = getRootDB(); +$picName = $db->queryFirstField('SELECT picture FROM `MEMBER` WHERE `NO` = %i', $SESSION->NoMember()); + +if($picName && strlen($picName) > 11){ + $dt = substr($picName, -8); + $picName = substr($picName, 0, -10); +} +else{ + $dt = '00000000'; +} + +$dest = ROOT.'/d_pic/'.$picName; + +$rf = date('Ymd'); + +$response['result'] = false; +$response['reason'] = '요청이 올바르지 않습니다!'; + +if($dt == $rf) { + //갱신날짜 검사 + $response['reason'] = '1일 1회 변경 가능합니다!'; + $response['result'] = false; +} else { + $db->update('MEMBER', [ + 'PICTURE'=>'default.jpg', + '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){ + $setting = $server[2]; + if($setting->isExists()){ + $servers[] = $key; + } + } + + $response['servers'] = $servers; + $response['reason'] = '제거에 성공했습니다!'; + $response['result'] = true; +} + +returnJson($response); \ No newline at end of file diff --git a/i_entrance/manage/Action.js b/i_entrance/manage/Action.js index e4caee49..e69de29b 100644 --- a/i_entrance/manage/Action.js +++ b/i_entrance/manage/Action.js @@ -1,158 +0,0 @@ -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( - "../../i_entrance/manage/Get.php", { - }, - function(response, textStatus) { - if(response.result == "SUCCESS") { - EntranceManage_UpdateInfo(response); - Popup_WaitHide(); - } else { - Popup_WaitShow("정보 로드 실패!"); - } - } - ) - }); -} - -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("파일을 선택해 주세요!"); - } else { - Popup_Wait(function() { - $("#formIcon").submit(); - }); - } -} - -function EntranceManage_DeleteIcon() { - Popup_Confirm('정말 실행하시겠습니까?', function() { - Popup_Wait(function() { - PostJSON( - "../../i_entrance/manage/deletePost.php", { - }, - function(response, textStatus) { - Popup_WaitShow(response.msg, function() { - EntranceManage_Update(); - }); - } - ) - }) - }); -} - -function EntranceManage_Quit() { - var pw = $("#EntranceManage_000600").val(); - - if(pw.length < 4 || pw.length > 12) { - Popup_Alert("현재 비밀번호를 입력해주세요.", function() { - $("#EntranceManage_000600").val(""); - $("#EntranceManage_000600").focus(); - }); - return false; - } - - Popup_Confirm('정말 탈퇴하시겠습니까?', function() { - Popup_Wait(function() { - PostJSON( - "../../i_entrance/manage/quitPost.php", { - pw: hex_md5(pw+""+pw) - }, - function(response, textStatus) { - if(response.result == "SUCCESS") { - Popup_WaitShow(response.msg, function() { - ReplaceFrame("../../"); - }); - } else { - Popup_WaitShow(response.msg, function() { - EntranceManage_Update(); - }); - } - } - ) - }) - }); -} diff --git a/i_entrance/manage/Get.php b/i_entrance/manage/Get.php deleted file mode 100644 index 949734d1..00000000 --- a/i_entrance/manage/Get.php +++ /dev/null @@ -1,36 +0,0 @@ -queryFirstRow('SELECT `ID`, `NAME`, `GRADE`, `PICTURE` FROM `MEMBER` WHERE `NO` = %i', $SESSION->NoMember()); - -$response['id'] = $member['ID']; -$response['name'] = $member['NAME']; -if($member['GRADE'] == 6) { - $response['grade'] = '운영자'; -} elseif($member['GRADE'] == 5) { - $response['grade'] = '부운영자'; -} elseif($member['GRADE'] == 4) { - $response['grade'] = '특별회원'; -} elseif($member['GRADE'] == 1) { - $response['grade'] = '일반회원'; -} elseif($member['GRADE'] == 0) { - $response['grade'] = '블럭회원'; -} -if($member['PICTURE'] == '') { - $response['picture0'] = IMAGE.W.'default.jpg'; - $response['picture1'] = IMAGE.W.'default.jpg'; -} else { - $response['picture0'] = IMAGE.W.$member['PICTURE']; - $response['picture1'] = '../d_pic/'.$member['PICTURE']; -} - -$response['result'] = 'SUCCESS'; - -echo json_encode($response); - - diff --git a/i_entrance/manage/deletePost.php b/i_entrance/manage/deletePost.php deleted file mode 100644 index 3972eb9e..00000000 --- a/i_entrance/manage/deletePost.php +++ /dev/null @@ -1,53 +0,0 @@ -queryFirstRow('SELECT ID, PICTURE FROM `MEMBER` WHERE `NO` = %i', $SESSION->NoMember()); - - - -$picName = $member['PICTURE']; - -if($picName && strlen($picName) > 11){ - $dt = substr($picName, -8); - $picName = substr($picName, 0, -10); -} -else{ - $dt = '00000000'; -} - -$dest = ROOT.'/d_pic/'.$picName; - -$rf = date('Ymd'); - -$response['result'] = 'FAIL'; -$response['msg'] = '요청이 올바르지 않습니다!'; - -if($dt == $rf) { - //갱신날짜 검사 - $response['msg'] = '1일 1회 변경 가능합니다!'; - $response['result'] = 'FAIL'; -} else { - $db->update('MEMBER', [ - 'PICTURE'=>'', - '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']}'"); - } - */ - - $response['msg'] = '제거에 성공했습니다!'; - $response['result'] = 'SUCCESS'; -} - -echo json_encode($response); \ No newline at end of file diff --git a/i_entrance/manage/passwordPost.php b/i_entrance/manage/passwordPost.php deleted file mode 100644 index 42c5af80..00000000 --- a/i_entrance/manage/passwordPost.php +++ /dev/null @@ -1,29 +0,0 @@ -queryFirstRow('SELECT `ID`, `PW` FROM `MEMBER` WHERE `NO` = %i', $SESSION->NoMember()); - -if($member['PW'] != $pw) { - $response['result'] = 'FAIL'; - $response['msg'] = '실패: 현재 비밀번호가 일치하지 않습니다.'; -} else { - $db->update('MEMBER', ['PW'=>$newPw], 'NO=%i', $SESSION->NoMember()); - - $response['result'] = 'SUCCESS'; - $response['msg'] = "정상적으로 비밀번호가 수정되었습니다."; -} - -echo json_encode($response); - - diff --git a/i_entrance/manage/Style.css b/i_entrance/user_info.css similarity index 63% rename from i_entrance/manage/Style.css rename to i_entrance/user_info.css index b9700ad5..bb787525 100644 --- a/i_entrance/manage/Style.css +++ b/i_entrance/user_info.css @@ -1,50 +1,120 @@ @charset "utf-8"; +#user_info_container{ + width:500px; + position:absolute; + left:50%; + margin-left:-250px; +} + +#user_info_table{ + width:100%; + margin-top:30px; +} + +#user_info_table th{ + padding:5px; +} + +#btn_back1{ + position:absolute; + right: 6px; + margin:6px; + height:40px; +} + +#btn_delete_me{ + bottom:0; + left:0; + margin:0 1px; + position:absolute; + width:100%; +} + +#change_pw{ + width:100%; +} + +#image_upload_filename{ + position:absolute; + height:16px; + left:10px; + width:150px; + top:16px; +} + +#image_upload_fake_btn{ + top:16px; + height:20px; + right:10px; + position:absolute; +} + +#image_upload{ + opacity: 0; + position:absolute; + top:16px; + height:22px; + left:0; + height:20px; + width:100%; +} + +#slot_new_icon{ + visibility: hidden; +} + + +#btn_image_submit{ + position:absolute; + bottom:0; + left:0; + width:50%; + height:20px; +} + +#btn_remove_icon{ + position:absolute; + bottom:0; + right:0; + width:50%; + height:20px; +} + #EntranceManage_00 { width: 500px; height: 409px; - position: absolute; - top: 50px; left: 50%; - margin-left: -256px; /* DIV박스 크기의 1/2로 마진을 잡아줍니다. */ - display: none; z-index: 2; } #EntranceManage_0000 { width: 498px; height: 50px; - position: absolute; top: 0px; left: 0px; } #EntranceManage_0001 { width: 100px; height: 30px; - position: absolute; top: 10px; left: 350px; } #EntranceManage_0002 { width: 498px; height: 25px; - position: absolute; top: 50px; left: 0px; } #EntranceManage_0003 { width: 98px; height: 84px; - position: absolute; top: 75px; left: 0px; line-height: 84px; } #EntranceManage_0004 { width: 148px; height: 84px; - position: absolute; top: 75px; left: 100px; line-height: 84px; } #EntranceManage_0005 { width: 98px; height: 84px; - position: absolute; top: 75px; left: 250px; line-height: 84px; } #EntranceManage_0006 { width: 148px; height: 84px; - position: absolute; top: 75px; left: 350px; text-align: left; } @@ -66,116 +136,95 @@ #EntranceManage_0007 { width: 98px; height: 64px; - position: absolute; top: 159px; left: 0px; line-height: 64px; } #EntranceManage_0008 { width: 148px; height: 64px; - position: absolute; top: 159px; left: 100px; line-height: 64px; } #EntranceManage_0009 { width: 98px; height: 64px; - position: absolute; top: 159px; left: 250px; line-height: 64px; } #EntranceManage_0010 { width: 148px; height: 64px; - position: absolute; top: 159px; left: 350px; line-height: 64px; } #EntranceManage_0011 { width: 98px; height: 20px; - position: absolute; top: 223px; left: 0px; } #EntranceManage_0012 { width: 148px; height: 20px; - position: absolute; top: 223px; left: 100px; } #EntranceManage_0013 { width: 248px; height: 20px; - position: absolute; top: 223px; left: 250px; } #EntranceManage_0014 { width: 98px; height: 64px; - position: absolute; top: 243px; left: 0px; line-height: 64px; } #EntranceManage_0015 { width: 148px; height: 64px; - position: absolute; top: 243px; left: 100px; } #EntranceManage_001500 { width: 64px; height: 64px; - position: absolute; top: 0px; left: 0px; } #EntranceManage_001501 { width: 64px; height: 64px; - position: absolute; top: 0px; left: 85px; } #EntranceManage_0016 { width: 248px; height: 64px; - position: absolute; top: 243px; left: 250px; } #EntranceManage_001600 { width: 100px; height: 16px; - position: absolute; top: 10px; left: 10px; display: none; } #EntranceManage_001601 { width: 70px; height: 20px; - position: absolute; top: 10px; left: 120px; } #EntranceManage_001602 { width: 85px; height: 20px; - position: absolute; top: 35px; left: 10px; } #EntranceManage_001603 { width: 85px; height: 20px; - position: absolute; top: 35px; left: 105px; } #EntranceManage_0017 { width: 98px; height: 100px; - position: absolute; top: 307px; left: 0px; line-height: 100px; } #EntranceManage_0018 { width: 398px; height: 100px; - position: absolute; top: 307px; left: 100px; text-align: left; } #EntranceManage_0019 { width: 149px; height: 20px; - position: absolute; top: 139px; left: 101px; } #EntranceManage_0020 { width: 500px; height: 20px; - position: absolute; top: 409px; left: -1px; border: none; } #EntranceManage_002000 { width: 500px; - position: absolute; top: 0px; left: 0px; } #EntranceManage_00200000 { diff --git a/i_entrance/user_info.html b/i_entrance/user_info.html new file mode 100644 index 00000000..ecf2c659 --- /dev/null +++ b/i_entrance/user_info.html @@ -0,0 +1,116 @@ + + + + + + 계정 관리 + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ 계 정 관 리 + +
회 원 정 보
ID + + + 비밀번호 +
+ + + +
+ +
+ +
+ +
+
닉네임 + + 등급 + +
+ 현재 / 신규 + + 전용 아이콘 변경 +
전용
아이콘
+ + + +
+ + +
+ +
+ + +
도움말 +

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

+

탈퇴시 1개월간 정보가 보존되며, 1개월간 재가입이 불가능합니다. +

+
+ +
+ + \ No newline at end of file diff --git a/i_entrance/user_info.js b/i_entrance/user_info.js new file mode 100644 index 00000000..9caf9789 --- /dev/null +++ b/i_entrance/user_info.js @@ -0,0 +1,344 @@ + + + + +function fillUserInfo(result){ + if(!result.result){ + alert(result.reason); + location.href='entrance.php'; + return; + } + + $('#slot_id').html(result.id); + $('#slot_nickname').html(result.name); + $('#slot_grade').html(result.grade); + $('#slot_icon').attr('src', result.picture); + $('#global_salt').val(result.global_salt); +} + +function changeIconPreview(){ + var $preview = $(this); + console.log($preview); + + var filename = $preview[0].files[0].name; + var reader = new FileReader(); + reader.onload = function(e) { + $('#slot_new_icon').attr('src', e.target.result).css('visibility','visible'); + } + + reader.readAsDataURL($preview[0].files[0]); + + $('#image_upload_filename').val(filename); +} + +function deleteIcon(){ + $.ajax({ + type:'post', + url:'j_icon_delete.php', + dataType:'json' + }).then(function(result){ + if(!result.result){ + alert(result.reason); + location.reload(); + return; + } + + var ajaxResults = result.servers.map(function(server){ + return $.ajax({ + type:'post', + url:'../{0}/j_adjust_icon.php'.format(server), + dataType:'json' + }); + }); + + $.when.apply($, ajaxResults).then(function(){ + alert('이미지를 삭제했습니다.'); + location.reload(); + },function(){ + //서버 폐쇄등으로 접근하지 못할 수도 있음. + alert('이미지를 삭제했습니다.'); + location.reload(); + }); + + },function(){ + alert('알 수 없는 이유로 아이콘 삭제를 실패했습니다.'); + location.reload(); + }); +} + +function changeIcon(e){ + e.preventDefault(); + console.log('haha'); + var $icon = $('#image_upload'); + var icon = $icon[0].files[0]; + $.ajax({ + type:'post', + url:'j_icon_change.php', + dataType:'json', + contentType:false, + processData:false, + data:new FormData($(this)[0]) + }).then(function(result){ + if(!result.result){ + alert(result.reason); + location.reload(); + return; + } + + var ajaxResults = result.servers.map(function(server){ + return $.ajax({ + type:'post', + url:'../{0}/j_adjust_icon.php'.format(server), + dataType:'json' + }); + }); + + $.when.apply($, ajaxResults).then(function(){ + alert('이미지를 업로드했습니다.'); + location.reload(); + },function(){ + //서버 폐쇄등으로 접근하지 못할 수도 있음. + alert('이미지를 업로드했습니다.'); + location.reload(); + }); + + },function(){ + alert('알 수 없는 이유로 아이콘 업로드를 실패했습니다.'); + location.reload(); + }); +} + +function changePassword(e){ + e.preventDefault(); + var $form = $(this); + + var old_pw = $('#current_pw').val(); + var new_pw = $('#new_pw').val(); + var new_pw_confirm = $('#new_pw_confirm').val(); + + if(!old_pw){ + alert('이전 비밀번호를 입력해야 합니다.'); + return; + } + if(new_pw.length < 6){ + alert('비밀번호 길이는 6글자 이상이어야 합니다.'); + return; + } + + if(new_pw != new_pw_confirm){ + alert('입력 값이 일치하지 않습니다.'); + return; + } + + var global_salt = $('#global_salt').val(); + + var old_password = sha512(global_salt+old_pw+global_salt); + var new_password = sha512(global_salt+new_pw+global_salt); + + $.ajax({ + type:'post', + url:'j_change_password.php', + dataType:'json', + data:{ + old_pw:old_password, + new_pw:new_password + } + }).then(function(result){ + if(!result.result){ + alert(result.reason); + } + else{ + alert('비밀번호를 바꾸었습니다'); + location.reload(); + } + },function(){ + alert('알 수 없는 이유로 비밀번호를 바꾸지 못했습니다.'); + }); +} + +$(function(){ + $.ajax({ + type:'post', + url:'j_get_user_info.php', + dataType:'json' + }).then(function(result){ + fillUserInfo(result); + },function(){ + alert('알 수 없는 이유로, 회원 정보를 불러오지 못했습니다.'); + location.href='entrance.php'; + }); + + $('#image_upload').change(changeIconPreview); + + $('#btn_remove_icon').click(function(){ + if(confirm('아이콘을 제거할까요?')){ + deleteIcon(); + } + return false; + }); + + $('#change_pw_form').submit(changePassword); + + $('#change_icon_form').submit(changeIcon); +}) + + + +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( + "../../i_entrance/manage/Get.php", { + }, + function(response, textStatus) { + if(response.result == "SUCCESS") { + EntranceManage_UpdateInfo(response); + Popup_WaitHide(); + } else { + Popup_WaitShow("정보 로드 실패!"); + } + } + ) + }); +} + +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("파일을 선택해 주세요!"); + } else { + Popup_Wait(function() { + $("#formIcon").submit(); + }); + } +} + +function EntranceManage_DeleteIcon() { + Popup_Confirm('정말 실행하시겠습니까?', function() { + Popup_Wait(function() { + PostJSON( + "../../i_entrance/manage/deletePost.php", { + }, + function(response, textStatus) { + Popup_WaitShow(response.msg, function() { + EntranceManage_Update(); + }); + } + ) + }) + }); +} + +function EntranceManage_Quit() { + var pw = $("#EntranceManage_000600").val(); + + if(pw.length < 4 || pw.length > 12) { + Popup_Alert("현재 비밀번호를 입력해주세요.", function() { + $("#EntranceManage_000600").val(""); + $("#EntranceManage_000600").focus(); + }); + return false; + } + + Popup_Confirm('정말 탈퇴하시겠습니까?', function() { + Popup_Wait(function() { + PostJSON( + "../../i_entrance/manage/quitPost.php", { + pw: hex_md5(pw+""+pw) + }, + function(response, textStatus) { + if(response.result == "SUCCESS") { + Popup_WaitShow(response.msg, function() { + ReplaceFrame("../../"); + }); + } else { + Popup_WaitShow(response.msg, function() { + EntranceManage_Update(); + }); + } + } + ) + }) + }); +} diff --git a/i_entrance/user_info.php b/i_entrance/user_info.php deleted file mode 100644 index a4abe2da..00000000 --- a/i_entrance/user_info.php +++ /dev/null @@ -1,2 +0,0 @@ -get('access_token');
- +
@@ -65,7 +65,7 @@ $access_token = $SESSION->get('access_token');
- +
diff --git a/twe/j_adjust_icon.php b/twe/j_adjust_icon.php new file mode 100644 index 00000000..0d79da84 --- /dev/null +++ b/twe/j_adjust_icon.php @@ -0,0 +1,43 @@ +false, + 'reason'=>'로그인되지 않았습니다.' + ]); +} + +if(!$generalID){ + returnJson([ + 'result'=>false, + 'reason'=>'장수를 생성하지 않았습니다.' + ]); +} + +$rootDB = getRootDB(); +$db = getDB(); + +$image = $rootDB->queryFirstRow('SELECT picture, imgsvr FROM `MEMBER` WHERE no = %i', $userID); + +if(!$image){ + returnJson([ + 'result'=>false, + 'reason'=>'회원 기록 정보가 없습니다' + ]); +} + +$db->update('general', [ + 'picture'=>$image['picture'], + 'imgsvr'=>$image['imgsvr'] +], 'owner = %i and npc = 0', $userID); + +returnJson([ + 'result'=>true, + 'reason'=>'success' +]); \ No newline at end of file