Merge revisions:
[phpbb.git] / phpBB / develop / nuke-db.php
blobd7329c3f562a91a3b153b2dc64d024a162b44d0b
1 <?php
3 //
4 // Security message:
5 //
6 // This script is potentially dangerous.
7 // Remove or comment the next line (die(".... ) to enable this script.
8 // Do NOT FORGET to either remove this script or disable it after you have used it.
9 //
10 die("Please read the first lines of this script for instructions on how to enable it");
13 // Do not change anything below this line.
17 // Just a handy script to completely wipe out the contents of a
18 // database.. Use with caution :)
21 if(!isset($submit))
24 <FORM ACTION="<?php echo $PHP_SELF?>" METHOD="post" >
25 <table>
26 <tr>
27 <td>DB host:</td>
28 <td><INPUT TYPE="text" name="dbhost" value="localhost"></td>
29 </tr><tr>
30 <td>DB name:</td>
31 <td><INPUT TYPE="text" name="dbname" value="phpBB"></td>
32 </tr><tr>
33 <td>DB username:</td>
34 <td><INPUT TYPE="text" name="dbuser" value="root"></td>
35 </tr><tr>
36 <td>DB password:</td>
37 <td><INPUT TYPE="password" name="dbpass"></td>
38 </tr></table>
39 <INPUT TYPE="submit" name="submit" value="Submit">
40 </FORM>
41 <?php
43 else
45 mysql_connect($dbhost, $dbuser, $dbpass) || die(mysql_error());
46 mysql_select_db($dbname);
48 $result = mysql_query("SHOW TABLES");
49 while($row = mysql_fetch_row($result)){
50 $table = $row[0];
51 print "Going to drop $table...";
52 mysql_query("DROP TABLE $table") || die();
53 print "Done.<br>\n";
54 flush();