先附上接口php文件完整代码:
<?php
/********密码验证***********/
$password='www.lanniaofei.com'; //这个密码是登陆验证用的.您需要在模块里设置和这里一样的密码....注意一定需要修改.
if($password!=$_GET['pw']) exit('验证密码错误'); //安全检测,密码不符则退出
/****以下代码非专业人员不建议修改***************/
define('EmpireCMSAdmin','1');
require("../class/connect.php");
require("../class/db_sql.php");
require("../class/functions.php");
require LoadLang("pub/fun.php");
require("../class/delpath.php");
require("../class/copypath.php");
require("../class/t_functions.php");
require("../data/dbcache/class.php");
require("../data/dbcache/MemberLevel.php");
//获取分类列表
foreach($class_r as $kv)
{
if($kv['modid']=='1')//这个是分类所在的系统模型id,记得修改
{
$cates[]=array('cname'=>$kv['classname'],'cid'=>$kv['classid'],'pid'=>$kv['bclassid']);
}
}
if(empty($_POST))
{
//这里刷新列表
echo "<select name='list'>";
echo maketree($cates,0,'');
echo '</select>';
exit();
}
$link=db_connect();
$empire=new mysqlquery();
//验证用户
$loginin=$_POST['username'];
$lur=$empire->fetch1("select * from {$dbtbpre}enewsuser where `username`='$loginin'");
if(!$lur) exit('不存在的用户名'.$loginin);
$logininid=$lur['userid'];
$loginrnd=$lur['rnd'];
$loginlevel=$lur['groupid'];
$loginadminstyleid=$lur['adminstyleid'];
$incftp=0;
if($public_r['phpmode'])
{
include("../class/ftp.php");
$incftp=1;
}
require("../class/hinfofun.php");
$vid_name = explode('|||',$_POST['onlinepath']); //发布模块里面表单名是onlinepath
$i = 0;
foreach ($vid_name as $shuzu=>$str){
$i = $i + 1;
$v = explode("::::::",$str);
$_POST['odownname'][] = $v[0];
$_POST['odownpath'][] = $v[1];
$_POST['odownuser'][] = $v[2];
$_POST['ofen'][] = '0';
}
$navtheid=(int)$_POST['filepass'];
AddNews($_POST,$logininid,$loginin);
db_close();
$empire=null;
/***生成目录的一个遍历算法***/
function maketree($ar,$id,$pre)
{
$ids='';
foreach($ar as $k=>$v){
$pid=$v['pid'];
$cname=$v['cname'];
$cid=$v['cid'];
if($pid==$id)
{
$ids.="<option value='$cid'>{$pre}{$cname}</option>";
foreach($ar as $kk=>$vv)
{
$pp=$vv['pid'];
if($pp==$cid)
{
$ids.=maketree($ar,$cid,$pre." ");
break;
}
}
}
}
return $ids;
}
?>
可以看到:
$vid_name = explode('|||',$_POST['onlinepath']); //发布模块里面表单名是onlinepath
$i = 0;
foreach ($vid_name as $shuzu=>$str){
$i = $i + 1;
$v = explode("::::::",$str);
$_POST['odownname'][] = $v[0];
$_POST['odownpath'][] = $v[1];
$_POST['odownuser'][] = $v[2];
$_POST['ofen'][] = '0';
}
这一段代码,
这里要注意:我这里设置的发布模块里表单名是onlinepath,自己根据自己需求修改。
onlinepath采集 规则里的最终格式:
视频地址1::::::URL::::::0||||||下载地址2::::::URL2::::::0
其中0对应的是$_POST[‘odownuser’][] = $v[2]; 也就是游客权限,如需其他权限根据自己需求改动
$_POST[‘ofen’][] = ‘0’; 是下载所需积分