내 정보 관리 새로 구현

- 비밀번호 수정,
- 전콘 제거, 전콘 변경 기능 추가
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
-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);
-199
View File
@@ -1,199 +0,0 @@
@charset "utf-8";
#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;
}
#EntranceManage_000600 {
width: 80px; height: 17px;
}
#EntranceManage_000601 {
width: 80px; height: 17px;
}
#EntranceManage_000602 {
width: 80px; height: 17px;
}
#EntranceManage_000603 {
width: 144px; height: 20px;
}
#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 {
width: 498px; height: 20px;
}
.EntranceManage_Sequence {
width: 48px; height: 20px;
}
.EntranceManage_Date {
width: 148px; height: 20px;
}
.EntranceManage_Amount {
width: 148px; height: 20px;
}
.EntranceManage_Cumul {
width: 148px; height: 20px;
}
-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);
-101
View File
@@ -1,101 +0,0 @@
<?php
require_once('_common.php');
require_once(ROOT.'/f_config/DB.php');
require_once(ROOT.'/f_config/SESSION.php');
// 외부 파라미터
// $_FILES['picture'] : 사진파일
$defaultImg = 'default.jpg';
$image = $_FILES['picture'];
$ext = strrchr($image['name'], ".");
$size = getImageSize($image['tmp_name']);
$imageType = $size[2];
$availableImageType = array('.jpg'=>IMAGETYPE_JPEG, '.png'=>IMAGETYPE_PNG, '.gif'=>IMAGETYPE_GIF);
$db = getRootDB();
$member = $db->queryFirstRow('SELECT `ID`, `PICTURE` FROM `MEMBER` WHERE `NO` = %i', $SESSION->NoMember());
$picName = $member['PICTURE'];
$newExt = array_search($imageType, $availableImageType, true);
if($picName && strlen($picName) > 11){
$dt = substr($picName, -8);
$picName = substr($picName, 0, -10);
}
else{
$dt = '00000000';
}
$old_path = ROOT.'/d_pic/'.$picName;
$rf = date('Ymd');
$response['result'] = 'FAIL';
$response['msg'] = '요청이 올바르지 않습니다!';
if(!is_uploaded_file($image['tmp_name'])) {
//진짜 전송된 파일인지 검증
$response['msg'] = '업로드가 되지 않았습니다!';
$response['result'] = 'FAIL';
} elseif(!$newExt) {
//확장자 검사
$response['msg'] = 'jpg, gif, png 파일이 아닙니다!';
$response['result'] = 'FAIL';
} elseif($image['size'] > 10000) {
//파일크기 검사
$response['msg'] = '10kb 이하로 올려주세요!';
$response['result'] = 'FAIL';
} elseif($size[0] != 64 || $size[1] != 64) {
//이미지크기 검사
$response['msg'] = '64x64 크기로 올려주세요!';
$response['result'] = 'FAIL';
} elseif($dt == $rf) {
//갱신날짜 검사
$response['msg'] = '1일 1회 변경 가능합니다!';
$response['result'] = 'FAIL';
} else {
//이미지 저장
while(true){
$newPicName = dechex(rand(0x000000f,0xfffffff)).$newExt;
$dest = ROOT.'/d_pic/'.$newPicName;
if(file_exists($dest)){
continue;
}
break;
}
if(!move_uploaded_file($image['tmp_name'], $dest)) {
$response['msg'] = '업로드에 실패했습니다!';
$response['result'] = 'FAIL';
} else {
$pic = "{$newPicName}?={$rf}";
getRootDB()->update('MEMBER',[
'PICTURE' => $pic,
'IMGSVR' => 1
], 'NO=%i', $SESSION->NoMember());
//TODO: 각 서버에도 전파
//Update('general', "PICTURE='{$pic}', IMGSVR=1", "NPC=0 AND USER_ID='{$member['ID']}'");
$response['msg'] = '업로드에 성공했습니다!';
$response['result'] = 'SUCCESS';
}
}
/*
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
-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);