포인트 내역 삭제 기능 추가

This commit is contained in:
chicpro
2013-07-29 09:50:13 +09:00
parent b60bc5cc1c
commit 9eb3b7e415
2 changed files with 74 additions and 0 deletions

View File

@ -113,9 +113,21 @@ function point_clear()
<li><?php echo subject_sort_link('po_point') ?>포인트<span class="sound_only"> 순 정렬</span></a></li>
</ul>
<form name="fpointlist" id="fpointlist" method="post" action="./point_list_delete.php" onsubmit="return fpointlist_submit(this);">
<input type="hidden" name="sst" value="<?php echo $sst ?>">
<input type="hidden" name="sod" value="<?php echo $sod ?>">
<input type="hidden" name="sfl" value="<?php echo $sfl ?>">
<input type="hidden" name="stx" value="<?php echo $stx ?>">
<input type="hidden" name="page" value="<?php echo $page ?>">
<input type="hidden" name="token" value="<?php echo $token ?>">
<table class="tbl_pt_list">
<thead>
<tr>
<th scope="col">
<label for="chkall" class="sound_only">포인트 내역 전체</label>
<input type="checkbox" name="chkall" value="1" id="chkall" onclick="check_all(this.form)">
</th>
<th scope="col">회원아이디</th>
<th scope="col">이름</th>
<th scope="col">별명</th>
@ -144,6 +156,12 @@ function point_clear()
?>
<tr>
<td class="td_chk">
<input type="hidden" name="mb_id[<?php echo $i ?>]" value="<?php echo $row['mb_id'] ?>" id="mb_id_<?php echo $i ?>">
<input type="hidden" name="po_id[<?php echo $i ?>]" value="<?php echo $row['po_id'] ?>" id="po_id_<?php echo $i ?>">
<label for="chk_<?php echo $i; ?>" class="sound_only">내역</label>
<input type="checkbox" name="chk[]" value="<?php echo $i ?>" id="chk_<?php echo $i ?>">
</td>
<td class="td_mbid"><a href="?sfl=mb_id&amp;stx=<?php echo $row['mb_id'] ?>"><?php echo $row['mb_id'] ?></a></td>
<td class="td_mbname"><?php echo $row2['mb_name'] ?></td>
<td class="td_name sv_use"><div><?php echo $mb_nick ?></div></td>
@ -162,6 +180,12 @@ function point_clear()
?>
</tbody>
</table>
<div class="btn_list">
<input type="submit" name="act_button" value="선택삭제" onclick="document.pressed=this.value">
</div>
</form>
</section>
<?php echo get_paging(G4_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, "{$_SERVER['PHP_SELF']}?$qstr&amp;page="); ?>
@ -212,6 +236,24 @@ function point_clear()
</section>
<script>
function fpointlist_submit(f)
{
if (!is_checked("chk[]")) {
alert(document.pressed+" 하실 항목을 하나 이상 선택하세요.");
return false;
}
if(document.pressed == "선택삭제") {
if(!confirm("선택한 자료를 정말 삭제하시겠습니까?")) {
return false;
}
}
return true;
}
</script>
<?php
include_once ('./admin.tail.php');
?>

32
adm/point_list_delete.php Normal file
View File

@ -0,0 +1,32 @@
<?php
$sub_menu = "200200";
include_once('./_common.php');
check_demo();
auth_check($auth[$sub_menu], 'd');
check_token();
$count = count($_POST['chk']);
if(!$count)
alert($_POST['act_button']." 하실 항목을 하나 이상 체크하세요.");
for ($i=0; $i<$count; $i++)
{
// 실제 번호를 넘김
$k = $_POST['chk'][$i];
$sql = " delete from {$g4['point_table']} where po_id = '{$_POST['po_id'][$k]}' ";
sql_query($sql);
$sql = " select sum(po_point) as sum_po_point from {$g4['point_table']} where mb_id = '{$_POST['mb_id'][$k]}' ";
$row = sql_fetch($sql);
$sum_point = $row['sum_po_point'];
$sql= " update {$g4['member_table']} set mb_point = '{$sum_point}' where mb_id = '{$_POST['mb_id'][$k]}' ";
sql_query($sql);
}
goto_url('./point_list.php?'.$qstr);
?>