<?php
error_reporting(0); 
include("../../config/ht.php");
session_start();
if(!isset($_SESSION['adminname'])){echo "<script>alert('请重新登录!')</script><script>top.location.href='/$htlj/'</script>";exit;}
$adminname=$_SESSION['adminname'];
$type="where name='$adminname'";
$adminpd=queryall(admin,$type);
if(!$adminpd){echo "<script>alert('请重新登录!')</script><script>top.location.href='/$htlj/'</script>";exit;}
if($adminpd[qx]=='超级管理员'){}else{echo "<script>alert('无权限')</script><script>top.location.href='/$htlj/'</script>";exit;}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="gb2312">
<title>备份数据</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="/layui/css/layui.css" media="all" />
<link rel="stylesheet" href="/2019newui/houtai/css/font-awesome.min.css" media="all" />
<link rel="stylesheet" href="/2019newui/houtai/css/admin.css" media="all">
<script src="/layui/layui.js"></script>
<script src="/2019newui/js/jquery.min.js"></script>
</head>
<body style="padding:10px;">
<div class="tplay-body-div">
<div style="margin-top: 20px;">
</div>
<form class="layui-form" action="" method="post" name="FormInfo" id="FormInfo">
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;"><legend>备份数据</legend></fieldset>
<input type="hidden"  value="beifen"   name='lx'>
<div class="layui-form-item">
<label class="layui-form-label">数据库地址</label>
<div class="layui-input-block">
<input type="text" name="host" value="<?php echo $localhost?>" required lay-verify="required" placeholder="数据库地址" class="layui-input" onkeyup="value=value.replace(/[^\w\.\/]/ig,'')">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">数据库用户</label>
<div class="layui-input-block">
<input type="text" name="user" value="<?php echo $root?>" required lay-verify="required" placeholder="数据库用户" class="layui-input" onkeyup="value=value.replace(/[^\w\.\/]/ig,'')">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">数据库密码</label>
<div class="layui-input-block">
<input type="text" name="password" value="<?php echo $password?>" required lay-verify="required" placeholder="数据库密码" class="layui-input" onkeyup="value=value.replace(/[^\w\.\/]/ig,'')">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">数据库名称</label>
<div class="layui-input-block">
<input type="text" name="database" value="<?php echo $database?>" required lay-verify="required" placeholder="数据库名称" class="layui-input" onkeyup="value=value.replace(/[^\w\.\/]/ig,'')">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">备份路径</label>
<div class="layui-input-block">
<input type="text" name="lj" value="backup" placeholder="备份路径"  required lay-verify="required"  class="layui-input"  onkeyup="value=value.replace(/[^\w\.\/]/ig,'')">
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button  class="layui-btn" lay-submit="" lay-filter="FormInfo">提交</button>
</div>
</div>
</form>
</div>

<script>
layui.use(['form', 'layedit', 'laydate', 'element', 'jquery', 'layer'], function(){
var form = layui.form
,layer   = layui.layer
,layedit = layui.layedit
,element = layui.element
,$= layui.jquery
,laydate = layui.laydate;
form.on('submit(FormInfo)', function (data) {
var index = layer.load(3, {
shade: [0.1,'#fff'] 
});
$.ajax({
type:'POST',
url : "/htpost<?php echo $dshz?>",
data:$("#FormInfo").serialize(),
dataType:'json',
success:function(result){
if(result.status == 'true'){
layer.closeAll('loading');
layer.open({
type: 1
,offset: 'auto'
,id: 'layerMsg'
,content: '<div style="padding: 20px 100px;">备份成功</div>'
,btn: '确定'
,btnAlign: 'c'
,shade: 0
,closeBtn: 0
,yes: function(index){
location.reload();
}
});
}
}	
});
return false;
});
});
</script>
</body>
</html>