<?php
error_reporting(0); 
include("../../config/wap.php");
session_start();
if(!isset($_SESSION['username'])){echo "<script>alert('请重新登录!')</script><script>top.location.href='/m$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='/m$dshz'</script>";exit;}
if ($shipin=='0'){echo '已关闭功能';exit;}
$sjm=random(200);
$zykey=md5($userid.$sjm.$shijian);
?>
<!DOCTYPE html>
<head>
<meta charset="gb2312" />
<title>添加外链</title>
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<link href="/2019newui/m/css/common.css" rel="stylesheet" type="text/css"/>
<link href="/layui/css/m.css" rel="stylesheet"/>
<script src="/2019newui/js/jquery.min.js"></script>
</head>
<body ontouchstart="" onmouseover="" style="background:#fff;">
<header class="aui-navBar aui-navBar-fixed">
<a href="javascript:;"  onclick="window.history.back(-1);" class="aui-navBar-item"><i class="icon layui-icon" >&#xF060;</i></a>
<div class="aui-center"><span class="aui-center-title">添加外链</span></div>
</header>
<div class="divHeight"></div>
<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">
<select name="zl"    class="layui-input">
<option value="1">打赏观看</option>
<option value="2">免费观看</option>
</select>
</div>
<div class="layui-form-item">
<select name="fl"   style=" width: 150px;" >
<option value='请选择'>请选择</option>
<?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 class="layui-form-item">
<input type="text" name="name" value="" required lay-verify="required" placeholder="请输入视频名称" class="layui-input">
</div>
<div class="layui-form-item">
<input type="text" name="url" value="" required lay-verify="required" placeholder="请输入视频连接" class="layui-input">
</div>
<div class="form-group" id='jg'>
<label  class="control-label">打赏金额</label>
<div class="layui-input-inline" style="width: 33%;">
<input type="text"  name="sj"  class="layui-input" value="3"  required lay-verify="required" >
</div>
元
<div class="layui-input-inline" style="width: 34%;">
<input type="text" name="money"  class="layui-input" value="5"  required lay-verify="required" >
</div>
元
</div>
<div class="layui-form-item"><button class="layui-btn" lay-submit="" lay-filter="FormInfo"  style="width:100%;">添加</button></div>
</form>
</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: '/mpic<?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 : "/mpost<?php echo $dshz?>",
data:$("#FormInfo").serialize(),
dataType:'json',
success:function(result){
if(result.status == '1'){
layer.closeAll('loading');
$('.bgPop2,.pop2').show();
}else){
layer.closeAll('loading');
layer.msg(result.msg);
}
}	
});
return false;
});
});
</script>
<!--遮罩层-->
<div class="bgPop2"></div>
<div class="pop2">
<div class="pop-top2">
<h2>上传封面</h2>
</div>
<div class="pop-content2">
<div class="pop-content-right2"><button type="button" class="layui-btn layui-btn-danger" id="userAvatar"><i class="layui-icon">&#xF01B;</i>上传封面</button>
</div>
</div>
</div>
<footer class="aui-footer aui-footer-fixed">
<a href="/mmain<?php echo $dshz?>" class="aui-tabBar-item"><i class="icon layui-icon" style="font-size: 30px;">&#xF015;</i><span class="aui-tabBar-item-text">首页</span></a>
<a href="/mdingdan<?php echo $dshz?>" class="aui-tabBar-item"><i class="icon layui-icon" style="font-size: 30px;">&#xF123;</i><span class="aui-tabBar-item-text">订单</span></a>
<a href="/muser<?php echo $dshz?>" class="aui-tabBar-item"><i class="icon layui-icon" style="font-size: 30px;">&#xF007;</i><span class="aui-tabBar-item-text">我的</span></a>
</footer>
</body>
</html>