<?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]=='超级管理员'   or $adminpd[qx]=='资源管理员'){}else{echo "<script>alert('无权限')</script><script>top.location.href='/$htlj/'</script>";exit;}
$sjm=random(200);
$zykey=md5($sjm.$shijian);
?>
<!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">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<link rel="stylesheet" href="/layui/css/layui.css" media="all" />
<link rel="stylesheet" href="/2019newui/houtai/css/admin.css" media="all">
<link rel="stylesheet" href="/2019newui/houtai/css/peizhi.css" media="all">
<script src='/2019newui/js/jquery.min.js' type="text/javascript"></script>
<script src="/layui/layui.js"></script>
<link rel="stylesheet" type="text/css" href="/2019newui/houtai/css/api.css" />
<link rel="stylesheet" type="text/css" href="/2019newui/houtai/css/style.css" />
</head>
<body>
<body style="padding:10px;">
<div class="tplay-body-div">
<fieldset class="layui-elem-field layui-field-title" style="margin-top:20px;"><legend>添加外链(友情提示：添加外链仅支持MP4和M3U8格式视频文件。)</legend></fieldset>
<div class="layui-tab layui-tab-brief">
<div class="layui-tab-content">
<div class="layui-tab-item layui-show">
<form class="layui-form layui-form-pane" action="" method="post" name="FormInfo" id="FormInfo">
<input type="hidden" name="zykey" value="<?php echo $zykey?>">
<input type="hidden" name="lx" value="tjwl">
<div class="layui-form-item">
<label class="layui-form-label">视频名称</label>
<div class="layui-input-inline" style="width:570px;">
<input type="text" name="name" value="" required lay-verify="required" placeholder="请输入视频名称" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">视频链接</label>
<div class="layui-input-inline" style="width:570px;">
<input type="text" name="url" value="" required lay-verify="required" placeholder="请输入视频连接" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">视频分类</label>
<div class="layui-input-inline" style="width:570px;">
<select name="fl"   style=" width: 150px;" >
<option value='请选择'>请选择分类</option>
<?php 
$result = mysql_query("SELECT * FROM fenlei");
$count = mysql_num_rows($result);
?>
<?php if($count == 0){?><option value='0'>暂无分类</option><?php }?>
<?php
$query = mysql_query("SELECT * FROM fenlei");
while($a = mysql_fetch_array($query)) {
?>  
<option value='<?php echo $a[id]?>'><?php echo $a[name]?></option>
<?php }?>
</select>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">打赏金额</label>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="sj" placeholder="￥" autocomplete="off" class="layui-input" value="2" required lay-verify="required" >
</div>
<div class="layui-form-mid">元  至 </div>
<div class="layui-input-inline" style="width: 200px;">
<input type="text" name="money" placeholder="￥" autocomplete="off" class="layui-input" value="5" required lay-verify="required" >
</div>
<div class="layui-form-mid">元 *如果固定金额 两个填写一样即可</div>
</div>
</div>
<div class="layui-form-item"><button class="layui-btn" lay-submit="" lay-filter="FormInfo"  style="width:770px;">添加</button></div>
</form>
<div style="height:100px;"></div>
</div>
<script>
layui.use(['form', 'layedit', 'laydate', 'element', 'jquery', 'upload', 'layer'], function(){
var form = layui.form
,layer   = layui.layer
,layedit = layui.layedit
,element = layui.element
,upload  = layui.upload
,$= layui.jquery
,laydate = layui.laydate;
upload.render({
elem: '#userAvatar'
,url: '/httpup<?php echo $zykey?><?php echo $dshz?>'
,size: 500
,done: function(res){
if(res.status=='true'){
layer.msg('上传成功');
location.reload();
}else{
layer.msg(res.msg);
}
}
});
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 == '1'){
layer.closeAll('loading');
$('.bgPop,.pop').show();
}else{
layer.closeAll('loading');
layer.msg(result.msg);
//location.reload();
}
}	
});
return false;
});
});
</script>
<!--遮罩层-->
<div class="bgPop"></div>
<div class="pop">
<div class="pop-top">
<h2>上传封面</h2>
</div>
<div class="pop-content">
<div class="pop-content-right"><button type="button" class="layui-btn layui-btn-danger" id="userAvatar"><i class="layui-icon">&#xE64A;</i>上传封面</button>
</div>
</div>
</div>
</body>
</html>