ob_start();
session_start();
include("config.php");
include("include/function.php");
$data=$path.$data;
?>
body{
margin:10px;
background:#fff;
font:16px verdana;
color:#666;}
input{
width:100px;
font:16px verdana;
color:#666;}
a{
color:#666;}
a:hover{
color:blue;}
input{
width:160px;}
table.back{
border-collapse:collapse;
border:1px solid #333;}
table.back tr,td{
padding:3px;
border:1px dashed #666;}
table.back .putin{
font:12px verdana;
width:80px;}
function putin(file){
question=confirm("是否真的要将备份"+file+"-data.txt覆盖原数据库?");
if(question==true){window.location.href="?action=putin&back="+file+"-data.txt";}
}
if(isset($_GET["login"])){
if($_GET["login"]=="check"){//________进行验证
if($_POST['user']!=$administrator||$_POST['pass']!=$adminer)die("验证错误,返回");
$pass=$adminer;
session_register("pass");
echo "window.location.href='admin.php'";
}
}
if($_SESSION["pass"]!=$adminer){//________登陆表单输出
echo "\n";
echo "user:\n";
echo "pass:\n";
echo "\n";
echo "";
echo "\nindex.php";
die(" ");
}
if(isset($_GET["del"])){//________进行删除
$del=$_GET["del"];
$file=file($data);
$file[$del]="";
write_file($data,join("",$file),"w");
echo "删除成功.\nindex.php admin.php\n\n\n";
}
if(isset($_GET["promise"])){//________进行审批
$promise=$_GET["promise"];
$file=@file($data);
list($hidden,$name,$icon,$message,$ip,$time,$reply)=explode("||",$file[$promise]);
$hidden=1;
$file[$promise]=$hidden."||".$name."||".$icon."||".$message."||".$ip."||".$time."||".$reply;
write_file($data,join("",$file),"w");
echo "审批成功.\nindex.php admin.php\n\n\n";
}
if(isset($_GET["re"])){//________回复表单输出开始
$re=$_GET["re"];
$file=@file($data);
list($hidden,$name,$icon,$message,$ip,$time,$reply)=explode("||",$file[$re]);
?>
}//________回复表单输出结束
if(isset($_GET["action"])){//________回复留言处理
$action=$_GET["action"];
if($action=="reply"){
$remsg=blackbox($_POST["remsg"]);
$remsg.="\n";
$file=file($data);
list($hidden,$name,$icon,$message,$ip,$time,$reply)=explode("||",$file[$number]);
$file[$number]=$hidden."||".$name."||".$icon."||".$message."||".$ip."||".$time."||".$remsg;
write_file($data,join("",$file),"w");
echo "回复成功!\nindex.php admin.php\n\n\n";
}
if($action=="backup"){//________备份数据文件
$t=time();
$new=$path.$t."-data.txt";
copy($data,$new);
echo "备份完毕";
echo "".$new."\n备份管理 index.php\n\n";
}
if($action=="delitems"){//________进行批量删除
$file=file($data);
for($i=0;$i $delnum=$_POST["items"][$i]-1;
echo "删除第".$_POST["items"][$i]."条留言...\n";
$file[$delnum]="";
}
write_file($data,join("",$file),"w");
echo "批量删除成功!\nindex.php admin.php\n\n\n";
}
if($action=="date"){//________数据管理表单输出
echo "\n";
echo "此项功能用于直接对数据进行修改,要使用这项功能时请先备份数据";
echo "\n";
$file=file($data);
$content="";
for($i=0;$i echo $content;
echo "\n";
echo "\n\n";
echo "\n";
}
if($action=="normal"){//________常规修改表单输出
$data=explode("/",$data);
$data=end($data);
echo "\n";
echo "选择样式表:\n";
echo "\n";
$handle=opendir("style");
while ($file = readdir($handle)) {
if(ereg(".css$",$file)){
$style_info=get_style_info("style/".$file);
echo " if("style/".$file==$style)echo "selected";
echo ">".$style_info[0]."\n";
}
}
echo "\n";
echo "留言本标题:\n";
echo "数据地址:\n";
echo "数据文件名:\n";
echo "每页留言数:\n";
echo "最大留言数:\n";
echo "防灌水时间间隔:秒\n";
echo "管理用户:\n";
echo "管理密码:\n";
echo "留言验证开关:0为关闭,1为开启\n";
echo "\n";
echo "\n";
}
if($action=="save"){//________进行数据管理处理
$fp=@fopen($data,"w");
fwrite($fp,$_POST["data"]);
fclose($fp);
echo "修改成功!\n\n";
}
if($action=="delback"){
if(isset($_GET["back"])&&ereg("-data.txt",$_GET["back"])){
if(@unlink($path.$_GET["back"])){
echo "删除成功备份管理 admin.php\n\n\n";}
else{echo "删除失败,可能是文件属性权限不够造成此原因.";}
}
else{echo "不恰当的操作,要删除的备份未被指定或名称错误!\n\n";}
}
if($action=="putin"){
if(isset($_GET["back"])&&ereg("-data.txt",$_GET["back"])){
$file=file($path.$_GET[back]);
write_file($data,join($file),"w");
echo "导入成功备份管理 index.php\n\n\n";}
else{echo "不恰当的操作,要导入的备份未被指定或名称错误!\n\n";}
}
if($action=="showback"){
echo "\n名称备份时间删除导入数据库\n";
$handle=opendir($path);
while ($file = readdir($handle)) {
if(ereg("-data.txt",$file)){
$time=explode("-",$file);
echo "".$file."".date("y年m月d日 H点i分",$time[0])."删除\n";}
}
closedir($handle);
echo "\n";
echo "";
}
if($action=="modify"){//________进行常规设置处理
$input="";
write_file("config.php",$input,"w");
echo "修改成功!\nindex.php admin.php\n\n\n";
}
if($action=="out"){//________注销退出
session_unregister("pass");
echo "注销完毕.index.php admin.php\n";
}
}
if($_SESSION["pass"]==$adminer){//________输出管理项目
echo "常规设置\n";
echo "备份管理\n";
echo "数据管理\n";
echo "首页管理\n";
echo "注销\n";
}
?>