<?php
require("class/connect.php");
include("class/config.php");
include("class/db_sql.php");
include("class/functions.php");
@include LoadLang('f.php');
$phome=$_GET['phome'];
if(empty($phome))
{$phome=$_POST['phome'];}
//登陆
if($phome=="login"||$phome=="ChangeLanguage")
{}
else
{
	$loginin=getcvar('bakusername');
	$rnd=getcvar('bakrnd');
	islogin($loginin,$rnd);
}
if($phome=="SetDb"||$phome=="DoRep"||$phome=="DoOpi"||$phome=="DoDrop"||$phome=="DropDb"||$phome=="CreateDb"||$phome=="EmptyTable"||$phome=="DoSave"||$phome=="DoDelSave"||$phome=="DelBakpath"||$phome=="DelZip"||$phome=="DoExecSql"||$phome=="DoTranExecSql"||$phome=="RepPathFiletext")
{
	include("class/combakfun.php");
}
if($phome=="SetDb"||$phome=="login"||$phome=="exit"||$phome=="ChangeLanguage")
{}
else
{
	$link=db_connect();
	$empire=new mysqlquery();
}
//参数设置
if($phome=="SetDb")
{
	Ebak_SetDb($_POST);
}
//修复表
elseif($phome=="DoRep")
{
	$tablename=$_POST['tablename'];
	$mydbname=$_POST['mydbname'];
	Ebak_Rep($tablename,$mydbname);
}
//忧化表
elseif($phome=="DoOpi")
{
	$tablename=$_POST['tablename'];
	$mydbname=$_POST['mydbname'];
	Ebak_Opi($tablename,$mydbname);
}
//删除表
elseif($phome=="DoDrop")
{
	$tablename=$_POST['tablename'];
	$mydbname=$_POST['mydbname'];
	Ebak_Drop($tablename,$mydbname);
}
//删除数据库
elseif($phome=="DropDb")
{
	$mydbname=$_GET['mydbname'];
	Ebak_DropDb($mydbname);
}
//建立数据库
elseif($phome=="CreateDb")
{
	$mydbname=$_POST['mydbname'];
	$mydbchar=$_POST['mydbchar'];
	Ebak_CreatDb($mydbname,$mydbchar);
}
//清空表
elseif($phome=="EmptyTable")
{
	$tablename=$_POST['tablename'];
	$mydbname=$_POST['mydbname'];
	Ebak_EmptyTable($tablename,$mydbname);
}
//初使化备份表
elseif($phome=="DoEbak")
{
	Ebak_DoEbak($_POST);
}
//备份表(按文件)
elseif($phome=="BakExe")
{
	$t=$_GET['t'];
	$s=$_GET['s'];
	$p=$_GET['p'];
	$mypath=$_GET['mypath'];
	$alltotal=$_GET['alltotal'];
	$thenof=$_GET['thenof'];
	$fnum=$_GET['fnum'];
	$stime=$_GET['stime'];
	Ebak_BakExe($t,$s,$p,$mypath,$alltotal,$thenof,$fnum,$stime);
}
//备份表(按记录)
elseif($phome=="BakExeT")
{
	$t=$_GET['t'];
	$s=$_GET['s'];
	$p=$_GET['p'];
	$mypath=$_GET['mypath'];
	$alltotal=$_GET['alltotal'];
	$thenof=$_GET['thenof'];
	$fnum=$_GET['fnum'];
	$auf=$_GET['auf'];
	$aufval=$_GET['aufval'];
	$stime=$_GET['stime'];
	Ebak_BakExeT($t,$s,$p,$mypath,$alltotal,$thenof,$fnum,$auf,$aufval,$stime);
}
//恢复数据
elseif($phome=="ReData")
{
	$add=$_POST['add'];
	$mypath=$_POST['mypath'];
	Ebak_ReData($add,$mypath);
}
//退出系统
elseif($phome=="exit")
{
	LoginOut();
}
//登陆
elseif($phome=="login")
{
	$lusername=$_POST['lusername'];
	$lpassword=$_POST['lpassword'];
	$key=$_POST['key'];
	login($lusername,$lpassword,$key,$lifetime);
}
//删除备份目录
elseif($phome=="DelBakpath")
{
	$path=$_GET['path'];
	Ebak_DelBakpath($path);
}
//删除压缩包
elseif($phome=="DelZip")
{
	$f=$_GET['f'];
	Ebak_DelZip($f);
}
//压缩目录
elseif($phome=="DoZip")
{
	$p=$_GET['p'];
	Ebak_Dozip($p);
}
//执行sql
elseif($phome=="DoExecSql")
{
	Ebak_DoExecSql($_POST);
}
//上传执行sql
elseif($phome=="DoTranExecSql")
{
	$file=$_FILES['file']['tmp_name'];
    $file_name=$_FILES['file']['name'];
    $file_type=$_FILES['file']['type'];
    $file_size=$_FILES['file']['size'];
	Ebak_DoTranExecSql($file,$file_name,$file_type,$file_size,$_POST);
}
//保存设置
elseif($phome=="DoSave")
{
	Ebak_SaveSeting($_POST);
}
//删除设置
elseif($phome=="DoDelSave")
{
	Ebak_DelSeting($_GET);
}
//设置转向
elseif($phome=="SetGotoBak")
{
	$savename=$_GET['savename'];
	Ebak_SetGotoBak($savename);
}
//目录转向
elseif($phome=="PathGotoRedata")
{
	$mypath=$_GET['mypath'];
	Ebak_PathGotoRedata($mypath);
}
//选择语言
elseif($phome=="ChangeLanguage")
{
	Ebak_ChangeLanguage($_GET);
}
//替换目录文件
elseif($phome=="RepPathFiletext")
{
	Ebak_RepPathFiletext($_POST);
}
else
{
	printerror("ErrorUrl","history.go(-1)");
}
?>