<?php
//段落标志是``~`ls_mysqlend`~``
	session_start(); 
	echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
?>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link type="text/css" rel="stylesheet" href="css/admin.css" />

<?
	require_once('inc/constant.php');
	require_once('inc/ls_syscode.php');
	require_once('inc/ls_inccode.php');
	require_once('inc/check.php');
	//$restoredb=$restoreDBName;
	
	$host=$_POST['host'];
	$restoredb =$_POST['dbname'];
	$username=$_POST['dbusername'];
	$password=$_POST['dbpassword'];
	$ls=$_GET['ls'];
	
if(!isset($_POST['restore']))
{
	$filename="inc/conn_var.php";
	$handle = fopen ($filename,"r");
	while (!feof ($handle)) 
	{
		$partstr0 =  fgets ($handle, 3000);
		echo $partstr0;
		if(strpos($partstr0,"host=")>0){$initHost=trim(str_replace("';","",str_replace("\$host='","",$partstr0)));}											
		if(strpos($partstr0,"dbname=")>0){$initDBName=trim(str_replace("';","",str_replace("\$dbname='","",$partstr0)));}										
		if(strpos($partstr0,"username=")>0){$initDBUserName=trim(str_replace("';","",str_replace("\$username='","",$partstr0)));}											
		if(strpos($partstr0,"password=")>0){$initDBPassword=trim(str_replace("';","",str_replace("\$password='","",$partstr0)));}	

	}
	//echo strlen($partstr);
	fclose ($handle);
	
}
else
{
	restorelsdb($host,$username,$password,$restoredb,$backupSQLFile,$maxLenSQLStr);
	die("");
}
?>

<head>
<title><?=$engineName?>数据库恢复</title>
</head>

<body>
<table width="96%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#6396d6">
  <tr>
	<td height="18" background="images/admin_bg.gif"><div align="center"><font color="#ffffff"><strong>
	  恢复数据库</strong></font></div></td>
  </tr>
  <tr>
	<td height="213" valign="top" bgcolor="#dee7ff"><br>
	  <form action="restore.php" method="post" enctype="multipart/form-data" name="install" id="form1">
		<table width="500" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#FFFFFF">
		  <tr bgcolor="#B9DAFF">
			<td height="28" colspan="2" align="center">请填写数据库参数</td>
		  </tr>
		  <tr bgcolor="#E8F2FF">
			<td width="30%" height="28" align="center" bgcolor="#E1EEFF"  style='padding-left:50px;'><div align="left">安装主机</div></td>
			<td width="30%" align="center" bgcolor="#E1EEFF"><label>
			  <input name="host" type="text" id="textfield" value="<?=$initHost?>" />
			</label></td>
		  </tr>
		  <tr bgcolor="#E8F2FF">
			<td height="28" align="center" bgcolor="#E1EEFF"  style='padding-left:50px;'><div align="left">数据库</div></td>
			<td align="center" bgcolor="#E1EEFF"><input name="dbname" type="text" id="textfield2" value="<?=$initDBName."_"?>" /></td>
		  </tr>
		  <tr bgcolor="#E8F2FF">
			<td height="28" align="center" bgcolor="#E1EEFF"  style='padding-left:50px;'><div align="left">数据库用户名</div></td>
			<td align="center" bgcolor="#E1EEFF"><input name="dbusername" type="text" id="textfield3" value="<?=$initDBUserName?>" /></td>
		  </tr>
		  <tr bgcolor="#E8F2FF">
			<td height="28" align="center" bgcolor="#E1EEFF" style='padding-left:50px;'><div align="left">数据库密码</div></td>
			<td align="center" bgcolor="#E1EEFF"><input name="dbpassword" type="text" id="textfield4" value="<?=$initDBPassword?>" /></td>
		  </tr>
		  <tr bgcolor="#E8F2FF">
			<td height="28" align="center" bgcolor="#E1EEFF"><div align="left"></div></td>
			<td align="center" bgcolor="#E1EEFF">&nbsp;</td>
		  </tr>
		  <tr bgcolor="#E8F2FF">
			<td height="28" colspan="2" align="center" bgcolor="#E1EEFF"><label>
			  <input type="submit" name="restore" id="button" value="开始恢复数据库" />
			</label></td>
		  </tr>
		</table>
		<p>&nbsp;</p>
		<table border="0" width="90%" align="center">
		  <tr>
		    <td><div align="center">恢复数据库将覆盖现有数据库的的所有内容</div></td>
	      </tr>
	    </table>
		<p>&nbsp;</p>
      </form>
	</td>
  </tr>
</table>
</body>
</html>
