|
PCCS MySQLDatabase Admin Tool version 1.3.4
|
/ -> mysqldb_admpanel.php
1 <?php
2 // Hacked by: Chauncey Thorn 3 // some code reuse and new some code 4 /************************************************************************
5 PCCS MySQLDatabase Admin Tool
6 Copyright (C) Chauncey Thorn
7
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA , USA.
21 **************************************************************************/
22 // updated 10-23-2000 23 // -- moving to a single file for global include files 24
25 require('mysqldb_app_includes.php');
26
27 common_header($_title);
28
29 pageTop("PCCS MySQLAdmin Tool: SYSTEM INFORMATION","600");
30
31
32 $link_array = array(
33 "$str_mainMenu" => "./",
34 "$str_installscriptlink" => "installscript/mysqldb_installscript.php",
35 "$str_createwebacct" => "mysqldb_create_webuser.php",
36 "LOGOUT" => "logout.php"
37 );
38
39 print "<BR>";
40 print "<CENTER>";
41 navBar($link_array);
42 print "</CENTER>";
43 print "<BR>";
44
45 // define dbname for show_query() 46
47 if($action == "getdbname")
48 {
49
50 print "
51 <table><tr><th>New Database</th></tr>
52 <tr>
53 <form action=$PHP_SELF?action=createdb method=post>
54 <td>Database Name</td>
55 <td><input type=text name=_dbname></td>
56 </tr><tr>
57 <td>Database Dump Filename</td>
58 <td><input type=text name=dump_filename></td>
59 </tr><tr>
60 <td>
61 <input type=submit value=\"Create Database\">
62 </form>
63 </td></tr></table>";
64 }
65
66 elseif($action == "upload")
67 {
68 require('incs/upload_function.php');
69 if($task == "upload") {
70 upload_file($the_file);
71 } else {
72 upload_form();
73 }
74 }
75 elseif($action == "createdb")
76 {
77 $qry = "CREATE DATABASE $_dbname";
78 // $dump_filename = "$_date$_time_$dbname.sql";
79 $_admtool = "/usr/local/bin/mysql";
80 $_gzip = "/bin/tar";
81 //
82 // $dump_filename = "$dbname.sql";
83 // Below are the paramaters for mysql
84 $par1 = '';
85 $par2 = '-uroot ';
86 if(file_exists($dump_filename)) {
87 $filesize = filesize("$dump_filename");
88 if($filesize > 0) {
89 $process_file = "$_admtool $par1 $par2 $_dbname < ./$dump_filename";
90 exec ("process_file");
91 } else {
92 echo $dump_filename . " Has ZERO Bytes...";
93 }
94 } else {
95 echo $dump_filename . " Does not EXSIT!. Please Make sure you uploaded it..";
96 }
97 log_this($qry);
98 show_results($qry);
99 echo "<META CONTENT=\"0; URL=mysqldb_admin.php\" HTTP-EQUIV=\"REFRESH\">";
100 }
101 elseif($action == "flush_t")
102 {
103 $qry = "FLUSH TABLES";
104 $result = mysqlquery("mysql","$qry");
105 if (!empty($result)) {
106 log_this($qry,"dblog.txt");
107 echo "TABLES FLUSHED... ";
108 echo "<BR>";
109 echo " <A HREF=./> Back to Main </A>";
110 } else {
111 echo mysql_error()."<BR>\n";
112 echo "$qry";
113 }
114
115 echo "<META CONTENT=\"0; URL=./\" HTTP-EQUIV=\"REFRESH\">";
116 }
117 elseif($action == "flush_h")
118 {
119 $qry = "FLUSH HOSTS";
120 $result = mysqlquery("mysql","$qry");
121 if (!empty($result)) {
122 log_this($qry,"dblog.txt");
123 echo "HOSTS FLUSHED... ";
124 echo "<BR>";
125 echo " <A HREF=./> Back to Main </A>";
126 } else {
127 echo mysql_error()."<BR>\n";
128 echo "$qry";
129 }
130
131 echo "<META CONTENT=\"0; URL=./\" HTTP-EQUIV=\"REFRESH\">";
132 }
133 elseif($action == "flush_l")
134 {
135 $qry = "FLUSH LOGS";
136 $result = mysqlquery("mysql","$qry");
137 if (!empty($result)) {
138 log_this($qry,"dblog.txt");
139 echo "LOGS FLUSHED... ";
140 echo "<BR>";
141 echo " <A HREF=./> Back to Main </A>";
142 } else {
143 echo mysql_error()."<BR>\n";
144 echo "$qry";
145 }
146
147
148 echo "<META CONTENT=\"0; URL=./\" HTTP-EQUIV=\"REFRESH\">";
149 }
150 elseif($action == "flush_s")
151 {
152 $qry = "FLUSH STATUS";
153 log_this($qry,"dblog.txt");
154 $result = mysqlquery("mysql","$qry");
155 if (!empty($result)) {
156 echo "STATUS FLUSHED... ";
157 echo "<BR>";
158 echo " <A HREF=./> Back to Main </A>";
159 } else {
160 echo mysql_error()."<BR>\n";
161 echo "$qry";
162 }
163
164 echo "<META CONTENT=\"0; URL=./\" HTTP-EQUIV=\"REFRESH\">";
165 }
166 elseif($action == "show_var")
167 {
168 $dbname = "mysql";
169
170 $qry = "SHOW VARIABLES";
171 echo "<center>";
172 show_results($qry);
173 echo "</center>";
174 echo "<P>";
175 echo " <A HREF=./> Main Menu </A>";
176
177 }
178 elseif($action == "show_ps")
179 {
180 $dbname = "mysql";
181
182 $qry = "SHOW PROCESSLIST";
183 print "<center>";
184 show_results($qry);
185 print "</center>";
186 echo "<P>";
187 echo " <A HREF=./> Main Menu </A>";
188
189 }
190
191 else
192 {
193 //
194 }
195
196
197 pageBottom();
198 footer();
199 ?>
200
| |