<?php include("dh.php"); 
include("../sql/conn.php");
include("yz.php"); 

$llym = $_SERVER["HTTP_REFERER"];

///$mulu=dirname(__FILE__);
$mulu = '../sql/';
?>


<?php
if ($_GET['id']=="rename")
{
$oldname = $_POST['oldname']; 
echo $oldname;
echo "<br>"; 
$newname = $mulu."/".$_POST['newname']; 
echo $newname;
rename($oldname,$newname) ;
echo "<br>".$llym;
?>
<script language="javascript">setTimeout(function (){location.href='<?php echo $llym; ?>';},2);</script>
<?
exit;
}
?>

<?php
if ($_GET['id']=="del")
{
$oldname = $_POST['oldname']; 
unlink($oldname);
echo "<br>".$llym;
?>
<script language="javascript">setTimeout(function (){location.href='<?php echo $llym; ?>';},2);</script>
<?
 exit;
}
?>

<br />
<strong>创建</strong>当前所有数据的备份！　[<a href="../sql/zbak.php" onClick="return confirm('备份所操作库当中所有的数据表！？')">备份数据库</a>]
备份前请注意，将采集的ＡＤ全部删除，否则无法恢复<br />
<hr>


<?php
$sz = ListFiles($mulu);
////$sz = glob($mulu.'\*.sql'); // 其他文件做类似修改，比如 *.png, *.txt等。。有目录请添加绝对目录。比如：c:/album/*.jpg 



echo "<form action=?id=rename method=post>选择需<strong>更名</strong>的备份<SELECT  name=oldname ><OPTION></OPTION>";
foreach($sz as $v)
{
echo "  <OPTION  value=".$v." >";
echo str_replace($mulu,"",$v);
echo "</OPTION>";
}
echo "</SELECT>";
echo "新名字: <input type=text value=";
$nnoww = date('Ymd');
echo $nnoww;
echo ".sql name=newname />";
echo "<input type=submit value=数据备份重命名  /></form>";
////数据备份重命名
?>
<hr>
<?php

echo "<form action=?id=del method=post>选择需<strong>删除</strong>的备份<SELECT  name=oldname ><OPTION></OPTION>";
foreach($sz as $v)
{
echo "  <OPTION  value=".$v." >";
echo str_replace($mulu,"",$v);
echo "</OPTION>";
}
echo "</SELECT>";

echo "<input type=submit value=删除数据备份  /></form>";

////echo $mulu;
?>
<hr>


<?php

echo "<form action=../sql/zhy.php method=post>选择需<strong>恢复</strong>的备份<SELECT  name=oldname ><OPTION></OPTION>";
foreach($sz as $v)
{
echo "  <OPTION  value=".$v." >";
echo str_replace($mulu,"",$v);
echo "</OPTION>";
}
echo "</SELECT>";

echo "<input type=submit value=恢复数据备份 ";
?>onClick="return confirm('恢复数据备份要小心！？')"<?php
echo" /></form>确定之后，请耐心等待网页提示！";
////echo $mulu;
?>恢复将强行更改adm\friend\sfk\text\url\user\webk\wz等表的数据至备份日期，请慎重！


<hr>
<textarea name="textarea" cols="88" rows="3">备份和恢复工具，使用时请注意，您服务器现所操作的所有的库和表，都将因此备份工作而被保存，同理，恢复时，整个正在操作的库表都将受到影响，请小心使用。可以到后台sql文件夹下将您的备份下载下来。
</textarea>

<?php include("../sql/close.php"); ?>
