<?
include("host.php"); 
$llym = $_SERVER["HTTP_REFERER"];


$link=mysql_connect($host,$user,$password);
mysql_query("SET NAMES 'gb2312'",$link);


mysql_select_db($dbname,$link);
set_time_limit(0); //设置超时时间为0，

/////数据库
/////恢复代码

$oldname = $_POST['oldname']; 

$sqlfile=fopen($oldname,'rb');
$str=fread($sqlfile,filesize($oldname));
$str=str_replace("\r","\n",$str);
$sqlarr=explode(";\n",trim($str));
foreach($sqlarr as $key => $values)
{
foreach(explode("\n",trim($values)) as $rows)
$queryarr[$key].= $rows[0]=='#' || $rows[0].$rows[1] == '--' ? '' : $rows;
}


foreach($queryarr as $values)
{
if(!mysql_query($values,$link))
{
echo $values."--".$link."<br>";
   exit();
}
}
echo "<script>alert('成功');</script>";
echo "<meta http-equiv=refresh content=0.1;url=".$llym." >";
?>