내 정보 관리 새로 구현

- 비밀번호 수정,
- 전콘 제거, 전콘 변경 기능 추가
This commit is contained in:
2018-03-20 02:59:40 +09:00
parent b27562613e
commit f3d7a6a1a7
20 changed files with 893 additions and 368 deletions
+1
View File
@@ -129,3 +129,4 @@ pwe/.htaccess
twe/.htaccess
hwe/.htaccess
d_pic/*.jpg
+6
View File
@@ -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;
-11
View File
@@ -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(
-8
View File
@@ -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;
+79 -1
View File
@@ -1,3 +1,81 @@
<?php
require_once('_common.php');
require_once(ROOT.'/f_config/DB.php');
require_once(ROOT.'/f_config/SESSION.php');
//
$db = getRootDB();
$userGrade = $SESSION->getGrade();
if($userGrade < 6){
header('Location:../');
die();
}
?>
<script type="text/javascript">
ImportStyle("<?=ROOT;?>/i_entrance/member/Style.css");
ImportAction("<?=ROOT;?>/i_entrance/member/Action.js");
EntranceMember_Import();
EntranceMember_Init();
</script>
<div id="EntranceMember_00">
<div id="EntranceMember_0000" class="bg2 font4">
회 원 정 보
<font id="EntranceMember_000000">(0/0)</font>
</div>
<input id="EntranceMember_0001" type="button" value="돌아가기">
<div id="EntranceMember_0006" class="bg2 font2">
<div id="EntranceMember_000600"></div>
<input id="btn_allow_join" type="button" value="가입허용">
<input id="btn_deny_join" type="button" value="가입금지">
<input id="btn_allow_login" type="button" value="로그인허용">
<input id="btn_deny_login" type="button" value="로그인금지">
<input id="btn_process_withdraw" type="button" value="탈퇴처리(1개월)">
<input id="btn_process_scrub_olduser" type="button" value="오래된계정(6개월)">
</div>
<div id="EntranceMember_0002" class="bg2 font2">
선택:
<select id="EntranceMember_000200" size="1">
<option value="0">순서</option>
<option value="1">ID</option>
<option value="2">장수</option>
<option value="3">민번</option>
<option value="4">IP</option>
<option value="5">등급</option>
<option value="6">등록</option>
<option value="7">최근</option>
</select>
<input id="EntranceMember_000201" type="button" value="정렬">
</div>
<div id="EntranceMember_0003" class="bg2 font2">
선택:
<select id="EntranceMember_000300" size="1">
</select>
<input id="EntranceMember_000301" type="button" value="블럭회원">
<input id="EntranceMember_000302" type="button" value="일반회원">
<input id="EntranceMember_000303" type="button" value="참여회원">
<input id="EntranceMember_000304" type="button" value="유효회원">
<input id="EntranceMember_000305" type="button" value="특별회원">
<input id="EntranceMember_000306" type="button" value="전콘제거">
<input id="EntranceMember_000307" type="button" value="비번초기화">
<input id="EntranceMember_000308" type="button" value="회원삭제">
</div>
<div id="EntranceMember_0004" class="bg1">
<div id="EntranceMember_000400">순번</div>
<div id="EntranceMember_000401">ID</div>
<div id="EntranceMember_000402">민번</div>
<div id="EntranceMember_000403">닉네임</div>
<div id="EntranceMember_000404">IP</div>
<div id="EntranceMember_000405">블럭</div>
<div id="EntranceMember_000406">최근블럭일</div>
<div id="EntranceMember_000407">등록</div>
<div id="EntranceMember_000408">최근등록일</div>
<div id="EntranceMember_000409">등급</div>
<div id="EntranceMember_000412">사진</div>
<div id="EntranceMember_000413">SVR</div>
<div id="EntranceMember_000414">탈퇴</div>
</div>
<div id="EntranceMember_0005">
</div>
</div>
+1 -4
View File
@@ -23,8 +23,6 @@ $userGrade = $SESSION->getGrade();
<link type="text/css" rel="stylesheet" href='../i_popup/Style.css'>
<link type="text/css" rel="stylesheet" href='../i_entrance/Style.css'>
<!-- 액션 -->
<script type="text/javascript" src='../js/common.js'></script>
<script type="text/javascript" src='../e_lib/jquery-3.2.1.min.js'></script>
@@ -41,7 +39,6 @@ $userGrade = $SESSION->getGrade();
</head>
<body>
<?php include("manage".W."Frame.php"); ?>
<?php
if($userGrade >= 6) {
include('member/Frame.php');
@@ -97,7 +94,7 @@ if($userGrade >= 6){
<div id="user_info">
<div class="bg2 section_title with_border">계 정 관 리</div>
<div class="center_ordered_items with_border bg0">
<button id="btn_user_manage" class="with_skin">비밀번호 &amp; 전콘 &amp; 탈퇴</button>
<a href="user_info.html"><button id="btn_user_manage" class="with_skin">비밀번호 &amp; 전콘 &amp; 탈퇴</button></a>
<button id="btn_logout" class="with_skin">로 그 아 웃</button>
</div>
</div>
+59
View File
@@ -0,0 +1,59 @@
<?php
require_once('_common.php');
require_once(ROOT.'/f_config/DB.php');
require_once(ROOT.'/f_func/class._Session.php');
$SESSION = new _Session();
if(!$SESSION->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'
]);
+54
View File
@@ -0,0 +1,54 @@
<?php
require_once('_common.php');
require_once(ROOT.'/f_config/DB.php');
require_once(ROOT.'/f_func/class._Session.php');
$SESSION = new _Session();
if(!$SESSION->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()
]);
@@ -1,14 +1,23 @@
<?php
require_once('_common.php');
require_once(ROOT.'/f_config/DB.php');
require_once(ROOT.'/f_config/SESSION.php');
require_once(ROOT.'/f_func/class._Session.php');
$SESSION = new _Session();
if(!$SESSION->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 "<script type='text/javascript'>
alert('{$response['msg']}');
location.replace('".ROOT.'/i_entrance/entrance.php'."');
</script>";
*/
echo ROOT.'/i_entrance/entrance.php';//TODO:debug all and replace
returnJson($response);
+68
View File
@@ -0,0 +1,68 @@
<?php
require_once('_common.php');
require_once(ROOT.'/f_config/DB.php');
require_once(ROOT.'/f_func/class._Session.php');
$SESSION = new _Session();
if(!$SESSION->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);
-158
View File
@@ -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();
});
}
}
)
})
});
}
-36
View File
@@ -1,36 +0,0 @@
<?php
require_once('_common.php');
require_once(ROOT.'/f_config/DB.php');
require_once(ROOT.'/f_config/SESSION.php');
// 외부 파라미터
$db = getRootDB();
$member = $db->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);
-53
View File
@@ -1,53 +0,0 @@
<?php
require_once('_common.php');
require_once(ROOT.'/f_config/DB.php');
require_once(ROOT.'/f_config/SESSION.php');
// 외부 파라미터
$respone = [];
$db = getRootDB();
$member = $db->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);
-29
View File
@@ -1,29 +0,0 @@
<?php
require_once('_common.php');
require_once(ROOT.'/f_config/DB.php');
require_once(ROOT.'/f_config/SESSION.php');
// 외부 파라미터
// $_POST['pw'] : PW
// $_POST['newPw'] : 새 PW
$pw = $_POST['pw'];
$newPw = $_POST['newPw'];
$response['result'] = 'FAIL';
$db = getRootDB();
$member = $db->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);
@@ -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 {
+116
View File
@@ -0,0 +1,116 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>계정 관리</title>
<!-- 스타일 -->
<link type="text/css" rel="stylesheet" href='../f_config/config.css'>
<link type="text/css" rel="stylesheet" href='../f_config/app.css'>
<link type="text/css" rel="stylesheet" href='../i_popup/Style.css'>
<link type="text/css" rel="stylesheet" href='../i_entrance/user_info.css'>
<!-- 액션 -->
<script type="text/javascript" src='../js/common.js'></script>
<script type="text/javascript" src='../e_lib/jquery-3.2.1.min.js'></script>
<script type="text/javascript" src='../e_lib/sha512.min.js'></script>
<script type="text/javascript" src='../f_func/func.js'></script>
<script type="text/javascript" src='../i_popup/Action.js'></script>
<script type="text/javascript" src='user_info.js'></script>
</head>
<body>
<div id="user_info_container">
<table class="bg0" id="user_info_table">
<caption class="bg2 section_title with_border">
계 정 관 리
<a href="entrance.php"><button id="btn_back1" >돌아가기</button></a>
</caption>
<colgroup>
<col style="width:80px;" />
<col style="width:140px;"/>
<col style="width:80px;"/>
<col/>
</colgroup>
<thead>
<tr>
<th colspan="4" class="bg1">회 원 정 보</th>
</tr>
</thead>
<tbody>
<tr>
<th class="bg1">ID</th>
<td style="position:relative;">
<span id="slot_id"></span>
<button id="btn_delete_me">탈퇴신청</button>
</td>
<th class="bg1">비밀번호</th>
<td style="text-align:right;">
<form name="change_pw_form" id="change_pw_form" method="post">
<input type="hidden" id="global_salt" name="global_salt">
<input type="text" autocomplete="username" style="display:none;"><!--자동 완성툴을 위해-->
<label for="current_pw">현재 비밀번호</label>
<input class="with_skin" type="password" autocomplete="current-password" name="current_pw" id="current_pw" style="width:100px;"><br>
<label for="new_pw">새 비밀번호</label>
<input class="with_skin" type="password" autocomplete="new-password" name="new_pw" id="new_pw" style="width:100px;"><br>
<label for="new_pw_confirm">비밀번호 확인</label>
<input class="with_skin" type="password" autocomplete="new-password" name="new_pw_confirm" id="new_pw_confirm" style="width:100px;"><br>
<input class="with_skin" type="submit" id="change_pw" value="비밀번호 변경">
</form>
</td>
</tr>
<tr>
<th class="bg1">닉네임</th>
<td style="height:36px;">
<span id="slot_nickname"></span>
</td>
<th class="bg1">등급</th>
<td>
<span id="slot_grade"></span>
</td>
</tr>
<tr>
<th class="bg1"></th>
<th class="bg1">
현재 / 신규
</th>
<th colspan="2" class="bg1">
전용 아이콘 변경
</th>
</tr>
<tr>
<th class="bg1">전용<br>아이콘</th>
<td style="height:64px;">
<img width="64px" height="64px" id="slot_icon" src="../../image/default.jpg">
<img width="64px" height="64px" id="slot_new_icon" src="../../image/default.jpg">
</td>
<td colspan="2" style="position:relative;" >
<form name="change_icon_form" id="change_icon_form" method="post" enctype="multipart/form-data">
<input class="with_skin" type="text" readonly="readonly" id="image_upload_filename">
<button id="image_upload_fake_btn" class="with_skin">찾아보기</button>
<input type="file" id="image_upload" name="image_upload" accept=".jpg,.jpeg,.png,.gif"><br>
<input class="with_skin" id="btn_image_submit" type="submit" value="아이콘 변경"> <button id="btn_remove_icon" class="with_skin">아이콘 제거</button>
</form>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<th class="bg1">도움말</th>
<td colspan="3" style="text-align:left;padding:8px;">
<p style="line-height:1.2em;">
아이콘은 64 x 64픽셀, 10KB 이하의 jpg, gif, png 파일만 가능합니다.</p>
<p style="margin-top:1em;color:magenta;line-height:1.2em;">탈퇴시 1개월간 정보가 보존되며, 1개월간 재가입이 불가능합니다.</span>
</p>
</td>
</tr>
</tfoot>
</table>
</div>
</body>
</html>
+344
View File
@@ -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();
});
}
}
)
})
});
}
-2
View File
@@ -1,2 +0,0 @@
<?php
+2 -2
View File
@@ -57,7 +57,7 @@ $access_token = $SESSION->get('access_token');
<div class="form-group row">
<label for="username" class="col-sm-3 col-form-label">계정명</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="username" id="username" placeholder="계정명"/>
<input autocomplete="username" type="text" class="form-control" name="username" id="username" placeholder="계정명"/>
</div>
</div>
@@ -65,7 +65,7 @@ $access_token = $SESSION->get('access_token');
<div class="form-group row">
<label for="password" class="col-sm-3 col-form-label">비밀번호</label>
<div class="col-sm-9">
<input type="password" class="form-control" name="password" id="password" placeholder="비밀번호"/>
<input autocomplete="current-password" type="password" class="form-control" name="password" id="password" placeholder="비밀번호"/>
</div>
</div>
+43
View File
@@ -0,0 +1,43 @@
<?php
include('lib.php');
include('func.php');
$userID = getUserID();
$generalID = getGeneralID();
session_write_close();
if(!$userID){
returnJson([
'result'=>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'
]);