root/trunk/gui/client/ftp_delete.php

Revision 1327, 2.7 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
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 if (isset($_GET['id']) && $_GET['id'] !== '') {
26   $ftp_id = $_GET['id'];
27   $dmn_name = $_SESSION['user_logged'];
28
29   $query = <<<SQL_QUERY
30         select
31              t1.userid,
32              t1.uid,
33              t2.domain_gid
34         from
35             ftp_users as t1,
36             domain as t2
37         where
38             t1.userid = ?
39           and
40             t1.uid = t2.domain_gid
41           and
42             t2.domain_name = ?
43 SQL_QUERY;
44
45   $rs = exec_query($sql, $query, array($ftp_id, $dmn_name));
46   $ftp_name = $rs->fields['userid'];
47
48   if ($rs -> RecordCount() == 0) {
49     user_goto('ftp_accounts.php');
50   }
51
52   $query = <<<SQL_QUERY
53         select
54             t1.gid,
55             t2.members
56         from
57             ftp_users as t1,
58             ftp_group as t2
59         where
60             t1.gid = t2.gid
61           and
62             t1.userid = ?
63 SQL_QUERY;
64
65   $rs = exec_query($sql, $query, array($ftp_id));
66
67   $ftp_gid = $rs -> fields['gid'];
68   $ftp_members = $rs -> fields['members'];
69   $members = preg_replace("/$ftp_id/", "", "$ftp_members");
70   $members = preg_replace("/,,/", ",", "$members");
71   $members = preg_replace("/^,/", "", "$members");
72   $members = preg_replace("/,$/", "", "$members");
73
74   if (strlen($members) == 0) {
75     $query = <<<SQL_QUERY
76       delete from
77           ftp_group
78       where
79           gid = ?
80 SQL_QUERY;
81
82     $rs = exec_query($sql, $query, array($ftp_gid));
83
84   } else {
85     $query = <<<SQL_QUERY
86       update
87           ftp_group
88       set
89           members = ?
90       where
91           gid = ?
92 SQL_QUERY;
93
94     $rs = exec_query($sql, $query, array($members, $ftp_gid));
95   }
96
97   $query = <<<SQL_QUERY
98       delete from
99           ftp_users
100       where
101           userid = ?
102 SQL_QUERY;
103
104   $rs = exec_query($sql, $query, array($ftp_id));
105
106   write_log($_SESSION['user_logged'].": deletes FTP account: ".$ftp_name);
107   set_page_message(tr('FTP account deleted successfully!'));
108   user_goto('ftp_accounts.php');
109
110 } else {
111
112   user_goto('ftp_accounts.php');
113 }
114
115 ?>
Note: See TracBrowser for help on using the browser.