精華 帝國PHP系統(tǒng)CMS如何靜態(tài)頁面中判斷會員組不同權(quán)限
<p>帝國php系統(tǒng)不同會員組查看文章權(quán)限判斷在靜態(tài)頁面的實(shí)現(xiàn)方法</p>
<?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']);//當(dāng)前信息所屬欄目ID
$id=intval($_GET['id']);//當(dāng)前信息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('標(biāo)題:<?=$r[title]?>');//這里自行修改提示文字、要展示的內(nèi)容等
<?php
}elseif($tmgetgroupid==1) //判斷會員組id為1
?>
document.write('此信息需要VIP權(quán)限才可以查看');//這里自行修改提示文字、要展示的內(nèi)容等
<?php
}else{
?>
document.write('登錄后才能查看');//這里自行修改提示文字、要展示的內(nèi)容等
<?php
}
db_close();
$empire=null;
?>
把以上代碼存為show.php文件,把show.php放到e目錄里。
內(nèi)容模板顯示調(diào)用
<script src="http://www.viagraonlinego.com/[!--news.url--]e/show.php?classid=[!--classid--]&id=[!--id--]"></script>
上面的sql語句只是查詢title,其他字段自行修改