Files
firstgarden-web-gnu/adm/fg_admin/tail.sub.php

164 lines
3.5 KiB
PHP

<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
// 폐기문구 설정
if( $page == 'viplist' ) {
$msg = "정말 변경하시겠습니까?";
} else {
$msg = "삭제 후 복구가 불가능합니다. 정말 삭제하시겠습니까?";
}
// 현재 파일의 이름을 구하는 코드 (확장자 제외)
$currentPath = $_SERVER['PHP_SELF'];
$pageName = basename($_SERVER['PHP_SELF'], '.php');
if ($pageName == 'vip_list' || $pageName == 'annual_member_list') { // LIST에서도 입장처리를 시킬 수 있음
$ent_url = dirname($currentPath)."/{$pageName}_ent.enter.php" ;
} else {
$ent_url = dirname($currentPath)."/{$pageName}.enter.php" ; // 입장처리
}
$add_url = dirname($currentPath)."/{$pageName}.update.php" ; // 추가
$modify_url = dirname($currentPath)."/{$pageName}.modify.php" ; // 수정
$delete_url = dirname($currentPath)."/{$pageName}.delete.php" ; // 삭제
$renew_url = dirname($currentPath)."/{$pageName}.renew.php" ; // 재발급
?>
<script>
// 삭제
function deleteItem(idx)
{
if(confirm("<?php echo $msg?>"))
{
var delete_url = "<?php echo $delete_url?>";
var formData = {
idx: idx
}
$.post(delete_url, formData, function(json)
{
if(json != undefined && json.isSuccess)
{
alert("처리가 완료되었습니다.");
location.reload();
}
else
{
alert("처리중 에러가 발생하였습니다. ");
location.reload();
}
});
}
}
// 입장처리
function entMem(idx)
{
var url = "<?php echo $ent_url?>";
var formData = {
idx: idx,
mode: "enter"
}
$.post(url, formData, function(json)
{
if(json != undefined && json.isSuccess)
{
alert("처리가 완료되었습니다.");
location.reload();
}
else
{
alert("처리중 에러가 발생하였습니다. ");
location.reload();
}
});
}
$(function()
{
// 추가
$(".signup").on("submit", function()
{
var f = $(this).get(0);
// 등록 프로세스
var url = "<?php echo $add_url?>";
var formData = $(this).serialize();
$.post(url, formData, function(json)
{
if(json != undefined && json.isSuccess)
{
alert("등록이 완료되었습니다.");
location.reload();
}
else
{
alert("등록중 에러가 발생하였습니다.");
location.reload();
}
});
return false;
});
// 수정
$(".modify").on("submit", function()
{
var f = $(this).get(0);
// 등록 프로세스
var modify_url = "<?php echo $modify_url?>";
var formData = $(this).serialize();
$.post(modify_url, formData, function(json)
{
console.log(json);
if(json != undefined && json.isSuccess)
{
alert("수정이 완료되었습니다.");
location.reload();
}
else
{
alert("수정중 에러가 발생하였습니다.");
location.reload();
}
});
return false;
});
// 재발급
$(".renew").on("submit", function()
{
var f = $(this).get(0);
// 등록 프로세스
var renew_url = "<?php echo $renew_url?>";
var formData = $(this).serialize();
$.post(renew_url, formData, function(json)
{
console.log(json);
if(json != undefined && json.isSuccess == "dup")
{
alert("입력한 카드번호가 이미 있습니다.")
//location.reload();
}
else if(json != undefined && json.isSuccess)
{
alert("재발급이 완료되었습니다.");
location.reload();
}
else
{
alert("처리중 에러가 발생하였습니다.");
location.reload();
}
});
return false;
});
});
</script>