source: branches/feature-module-update/html/admin/system/delete.php @ 16582

Revision 16582, 2.1 KB checked in by nanasess, 15 years ago (diff)

ライセンス表記変更

  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-httpd-php; charset=UTF-8
Line 
1<?php
2/*
3 * This file is part of EC-CUBE
4 *
5 * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
6 *
7 * http://www.lockon.co.jp/
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22 */
23require_once("../require.php");
24
25$conn = new SC_DbConn();
26$oquery = new SC_Query();
27
28// 認証可否の判定
29$objSess = new SC_Session();
30sfIsSuccess($objSess);
31
32// member_idのチェック
33if(sfIsInt($_GET['id'])){
34    // レコードの削除
35    $conn->query("BEGIN");
36    fnRenumberRank($conn, $oquery, $_GET['id']);
37    fnDeleteRecord($conn, $_GET['id']);
38    $conn->query("COMMIT");
39} else {
40    // エラー処理
41    gfPrintLog("error id=".$_GET['id']);
42}
43
44// ページの表示
45$location = "Location: " . URL_SYSTEM_TOP . "?pageno=".$_GET['pageno'];
46header($location);
47
48// ランキングの振り直し
49function fnRenumberRank($conn, $oquery, $id) {
50    $where = "member_id = $id";
51    // ランクの取得
52    $rank = $oquery->get("dtb_member", "rank", $where);
53    // 削除したレコードより上のランキングを下げてRANKの空きを埋める。
54    $sqlup = "UPDATE dtb_member SET rank = (rank - 1) WHERE rank > $rank AND del_flg <> 1";
55    // UPDATEの実行
56    $ret = $conn->query($sqlup);
57    return $ret;
58}
59
60// レコードの削除(削除フラグをONにする)
61function fnDeleteRecord($conn, $id) {
62    // ランクを最下位にする、DELフラグON
63    $sqlup = "UPDATE dtb_member SET rank = 0, del_flg = 1 WHERE member_id = $id";
64    // UPDATEの実行
65    $ret = $conn->query($sqlup);
66    return $ret;
67}
68?>
Note: See TracBrowser for help on using the repository browser.