|
PCCS MySQLDatabase Admin Tool version 1.3.4
|
/ -> mysqldb_deluseracct.php
1 <?php
2 //////////////////////////////////////////////////////////////////////////////////////////////////////////// 3 // coder: Chauncey Thorn 4 // email: cthorn 5 /************************************************************************
6 PCCS MySQLDatabase Admin Tool
7 Copyright (C) 1999 Chauncey Thorn
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 , USA.
22 **************************************************************************/
23 // We don't need anyone passing args to this script 24
25 require('mysqldb_app_includes.php');
26
27
28 common_header($str_mainTitle);
29
30 pageTop("PCCS MySQLAdmin Tool: DELETE USER ACCOUNT","600");
31
32 if($action == "deleteuser"):
33 print "
34 <center>
35 <form action=\"mysqldb_deluseracct.php?action=do_delete\" method=\"post\">
36 <table width=400 border=1>
37 <tr>
38 <th colspan=2 align=center><font color=red>Delete this user: </font></th>
39 </tr>
40 <tr>
41 <td>Select DB User Id</td><td>
42 <SELECT NAME=dbuser SINGLE>";
43
44 $qry = "SELECT User,host FROM user ORDER BY User";
45 $res = mysqlquery("mysql",$qry) or die("Error running query");
46 for ($i = 0; $i < mysql_numrows($res); $i++):
47 $user_output = mysql_result($res,$i,"User");
48 $host_output = mysql_result($res,$i,"Host");
49 print "<OPTION VALUE=\"$user_output@$host_output\">$user_output@$host_output</OPTION>";
50 endfor;
51
52
53 print "
54 </SELECT>
55
56 </td>
57 </tr>
58 <tr>
59 <td colspan=2 align=center><input type=submit value=\"Delete UserID from System
60 Tables\">
61 </tr>
62 </table>";
63 print "</form>";
64 print "<A HREF=mysqldb_newuser.php>Back to User Mgmt</a>";
65 endif;
66
67 if($action == "do_delete"):
68 $vars = explode("@", $dbuser);
69
70
71 mysql("mysql","delete from user where User = \"$vars[0]\" and Host = \"$vars[1]\" ")
72 or die("Failed delete from user table");
73 mysql("mysql","delete from db where User = \"$vars[0]\" and Host = \"$vars[1]\" ")
74 or die("Failed delete from db table");
75
76 print $dbuser . " Was deleted from the System";
77 print "<br><A HREF=./>Back to Main</a>";
78 endif;
79
80 pageBottom();
81
82 ?>
| |