A simple php code can easily delete all data tables in the entire database. Isn’t this too dangerous? Let’s take a look at the deletion method.
The code is as follows
代码如下 |
复制代码 |
$hostname ='localhost';
$user = 'user';
$password = 'password';
$dbname = 'dbname';
$connect = mysql_connect($hostname,$user,$password);
mysql_select_db($dbname);
$result = mysql_query("show table status from ".$dbname,$connect);
echo 'ing.... ';
while($data=mysql_fetch_array($result)) {
echo $data["Name"].' ';
mysql_query("drop table ". $data["Name"]);
}
echo 'finished';
?>
|
|
Copy code
|
|
$hostname ='localhost';
$user = 'user';
$password = 'password';
$dbname = 'dbname';
$connect = mysql_connect($hostname,$user,$password);
mysql_select_db($dbname);
$result = mysql_query("show table status from ".$dbname,$connect);
echo 'ing....
';
while($data=mysql_fetch_array($result)) {
echo $data["Name"].'
';
mysql_query("drop table ". $data["Name"]);
}
echo 'finished';
?>
Note: After reading this code, should you guys deal with the security and user permissions of your mysql server?
http://www.bkjia.com/PHPjc/631315.htmlwww.bkjia.comtrue
http: //www.bkjia.com/PHPjc/631315.htmlA simple php code can easily delete all data tables in the entire database. Isn’t this too dangerous? , let’s take a look at the deletion method. The code is as follows Copy the code ?...