温馨提醒

如果文章内容或图片资源失效,请留言反馈,我们会及时处理,谢谢!

本文最后更新于2020年12月7日,已超过 30天没有更新

帝国CMS不同会员组查看文章权限判断在静态页面的实现方法

  <?php  require("class/connect.php");    include("class/db_sql.php");    include("class/config/config.php");    include("data/dbcache/class.php");    $link=db_connect();    $empire=new mysqlquery();    $classid=intval($_GET['classid']);//当前信息所属栏目ID    $id=intval($_GET['id']);//当前信息ID    $muserid=(int)getcvar('mluserid');//用户id    $musername=RepPostVar(getcvar('mlusername'));//用户名    $mgroupid=(int)getcvar('mlgroupid');//会员组id    if($classid&&$id&&$class_r[$classid][tbname]&&$muserid){    $r=$empire->fetch1("select id,title from {$dbtbpre}ecms_".$class_r[$classid][tbname]." where id='$id' and classid='$classid' limit 1");    if($mgroupid==2){//判断会员组id为2    ?>    document.write('标题:<?=$r[title]?>');//这里自行修改提示文字、要展示的内容等    <?php    }elseif($tmgetgroupid==1) //判断会员组id为1    ?>    document.write('此信息需要VIP权限才可以查看');//这里自行修改提示文字、要展示的内容等    <?php    }else{    ?>    document.write('登录后才能查看');//这里自行修改提示文字、要展示的内容等    <?php    }    db_close();    $empire=null;    ?>

把以上代码存为show.php文件,把show.php放到e目录里。

内容模板显示调用

  <script src="[!--news.url--]e/show.php?classid=[!--classid--]&id=[!--id--]"></script>

上面的sql语句只是查询title,其他字段自行修改

历史上的今天
12月
7
    抱歉,历史上的今天作者很懒,什么都没写!
版权声明:原创作品,未经允许不得转载,否则将追究法律责任。
本站资源有的自互联网收集整理,如果侵犯了您的合法权益,请联系本站我们会及时删除。
本站资源仅供研究、学习交流之用,若使用商业用途,请购买正版授权,否则产生的一切后果将由下载用户自行承担。
本文链接:悟空资源网https://www.wkzyw.com/2675.html
许可协议:《署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)》许可协议授权