root/trunk/gui/admin/ip_delete.php

Revision 1327, 2.4 kB (checked in by rats, 4 months ago)

* Fixed: --scan-knownbad-files and --check-deleted are no longer supported by rkhunter
* Fixed #1471: chkrootkit should be in lenny / hardy
* Updated Chinese (simplified)
* Updated German
* Fixed #1475: typo on installation (ispcp-setup)
* Fixed: default user for rkhunter.log

Line 
1 <?php
2 /**
3  * ispCP ω (OMEGA) a Virtual Hosting Control System
4  *
5  * @copyright     2001-2006 by moleSoftware GmbH
6  * @copyright     2006-2008 by ispCP | http://isp-control.net
7  * @version     SVN: $Id$
8  * @link         http://isp-control.net
9  * @author         ispCP Team (2007)
10  *
11  * @license
12  *   This program is free software; you can redistribute it and/or modify it under
13  *   the terms of the MPL General Public License as published by the Free Software
14  *   Foundation; either version 1.1 of the License, or (at your option) any later
15  *   version.
16  *   You should have received a copy of the MPL Mozilla Public License along with
17  *   this program; if not, write to the Open Source Initiative (OSI)
18  *   http://opensource.org | osi@opensource.org
19  */
20
21 require '../include/ispcp-lib.php';
22
23 check_login(__FILE__);
24
25 /* do we have a proper delete_id ? */
26
27 if (!isset($_GET['delete_id'])) {
28     header("Location: ip_manage.php");
29     die();
30 }
31
32 if (!is_numeric($_GET['delete_id'])) {
33     set_page_message(tr('You cannot delete the last active IP address!'));
34     header("Location: ip_manage.php");
35     die();
36 }
37
38 $delete_id = $_GET['delete_id'];
39
40 /* check for domain that user this ip */
41
42 $query = <<<SQL_QUERY
43     select
44         count(domain_id) as dcnt
45     from
46         domain
47     where
48         domain_ip_id=?
49 SQL_QUERY;
50
51 $rs = exec_query($sql, $query, array($delete_id));
52
53 if ($rs->fields['dcnt'] > 0) {
54     /* ERR - we have domain that use this ip */
55
56     set_page_message(tr('Error: we have a domain using this IP!'));
57
58     header("Location: ip_manage.php");
59     die();
60 }
61 // check if the IP is assignet to reseller
62 $query = <<<SQL_QUERY
63         select
64             reseller_ips
65         from
66             reseller_props
67 SQL_QUERY;
68
69 $res = exec_query($sql, $query, array());
70
71 while (($data = $res->FetchRow())) {
72     if (preg_match("/$delete_id;/", $data['reseller_ips'])) {
73         set_page_message(tr('Error: we have a reseller using this IP!'));
74         header("Location: ip_manage.php");
75         die();
76     }
77 }
78
79 $query = <<<SQL_QUERY
80     select
81         *
82     from
83         server_ips
84     where
85         ip_id=?
86 SQL_QUERY;
87
88 $rs = exec_query($sql, $query, array($delete_id));
89
90 $user_logged = $_SESSION['user_logged'];
91
92 $ip_number = $rs->fields['ip_number'];
93
94 write_log("$user_logged: deletes IP address $ip_number");
95
96 /* delete it ! */
97 $query = <<<SQL_QUERY
98     delete from
99         server_ips
100     where
101         ip_id = ?
102 SQL_QUERY;
103
104 $rs = exec_query($sql, $query, array($delete_id));
105
106 set_page_message(tr('IP was deleted!'));
107
108 header("Location: ip_manage.php");
109 die();
110
111 ?>
Note: See TracBrowser for help on using the browser.