<?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" />
 <link rel="stylesheet" href="css/style2.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="100%" border="0" align="center" cellpadding="1" cellspacing="1">
  <tr>
      <td height="18" style="border-bottom:2px solid #00c0ef; padding-bottom:5px;"><div align="center"><font color="#3c8dbc" style="font-size:16px;">恢复数据库</font></div>
				</td>
  </tr>
  <tr>
	<td height="213" valign="top"><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">
		  <tr>
			<td height="37" colspan="2" align="center">请填写数据库参数</td>
		  </tr>
		  <tr>
			<td width="30%" height="38" align="center" style='padding-left:50px;'><div align="left">安装主机</div></td>
			<td width="30%" align="center"><label>
			  <input name="host" type="text" id="textfield" value="<?=$initHost?>" />
			</label></td>
		  </tr>
		  <tr>
			<td height="28" align="center"style='padding-left:50px;'><div align="left">数据库</div></td>
			<td align="center"><input name="dbname" type="text" id="textfield2" value="<?=$initDBName?>" /></td>
		  </tr>
		  <tr>
			<td height="28" align="center"  style='padding-left:50px;'><div align="left">数据库用户名</div></td>
			<td align="center" ><input name="dbusername" type="text" id="textfield3" value="<?=$initDBUserName?>" /></td>
		  </tr>
		  <tr>
			<td height="28" align="center"  style='padding-left:50px;'><div align="left">数据库密码</div></td>
			<td align="center" ><input name="dbpassword" type="text" id="textfield4" value="<?=$initDBPassword?>" /></td>
		  </tr>
		  <tr>
			<td height="28" align="center"><div align="left"></div></td>
			<td align="center">&nbsp;</td>
		  </tr>
		  <tr>
			<td height="28" colspan="2" align="center"><label>
			  <button type="submit" name="restore" id="button" value="开始恢复数据库" />开始恢复数据库</button>
			</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>
