<?php
error_reporting(0); 
include("../../config/qiantai.php");
session_start();
if(!isset($_SESSION['username'])){echo "<script>alert('请重新登录!')</script><script>top.location.href='/index$dshz'</script>";exit;}
$username=$_SESSION['username'];
$type="where name='$username'";
$user=queryall(user,$type);
$userid=$user['userid'];
if(!$user){echo "<script>alert('请重新登录!')</script><script>top.location.href='/index$dshz'</script>";exit;}
if ($shipin=='0'){echo '已关闭功能';exit;}
$sjm=random(200);
$zykey=md5($userid.$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="/2019newui/qiantai/css/x-admin.css" media="all">
<script src="/2019newui/js/jquery.min.js"></script>
<script type="text/javascript" src="/2019newui/js/jquery1.9.min.js"></script>
<link rel="stylesheet" type="text/css" href="/2019newui/qiantai/css/pcfb1.css" />
<link rel="stylesheet" type="text/css" href="/2019newui/qiantai/css/pcfb2.css" />
</head>
<body>
<div class="x-body">
<blockquote class="layui-elem-quote">
<dl class="apps-filter-tr">
<dt><span  class="xb">添加外链</span> <span style="font-size:14px;color:#ff0000">(友情提示：添加外链仅支持MP4和M3U8格式视频文件。)</span></dt>
</dl>
<span class="x-right" style="margin-top:-24px;line-height:10px"><a class="layui-btn-small" style="line-height:10px;margin-top:-2px;float:right"  href="javascript:location.replace(location.href);" title="刷新"><i class="fa fa-refresh"></i></a></span>
</blockquote>
<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:88%;">
<select name="zl"    class="layui-input">
<option value="1">打赏观看</option>
<option value="2">免费观看</option>
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">视频分类</label>
<div class="layui-input-inline" style="width:88%;">
<select name="fl"     class="layui-input">
<option value='请选择'>请选择分类</option>
<?php 
$result = mysql_query("SELECT * FROM  dlfl where userid='$userid'");
$count = mysql_num_rows($result);
?>
<?php if($count == 0){?><option value='0'>暂无分类</option><?php }?>
<?php
$query = mysql_query("SELECT * FROM  dlfl where userid='$userid'");
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">
<label class="layui-form-label">视频名称</label>
<div class="layui-input-inline" style="width:88%;">
<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:88%;">
<input type="text" name="url" value="" required lay-verify="required" placeholder="请输入视频连接" class="layui-input">
</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:100%;">添加</button></div>
</form>
<div style="height:100px;"></div>
</div>
<script src="/layui/layui.js"></script>
<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: '/pic<?php echo $zykey?><?php echo $dshz?>'
,size: 500
,done: function(res){
if(res.status=='true'){
layer.msg("上传成功！");
$("#userAvatar").html('<i class="layui-icon">&#xF01B;</i>上传成功');
$("#userAvatar").attr("disabled","disabled");
$("#userAvatar").addClass("layui-btn-disabled");
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 : "/post<?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);
}
}	
});
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="fa fa-picture-o"></i>上传封面</button>
</div>
</div>
</div>
</body>
</html>