帝国CMS内容页调用会员组ID 支持静态页生成


avatar
pcwnas 2023-04-21 179

<?php

require(“class/connect.php”);

include(“class/db_sql.php”);

include(“config/config.php”);

include(“data/dbcache/class.php”);

$link=db_connect();

$empire=new mysqlquery();

$classid=intval($_GET[‘classid’]);

$id=intval($_GET[‘id’]);

$muserid=(int)getcvar(‘mluserid’);//用户id

$musername=RepPostVar(getcvar(‘mlusername’));//用户名

$mgroupid=(int)getcvar(‘mlgroupid’);//会员组id

$r=$empire->fetch1(“select id,title from {$dbtbpre}ecms_”.$class_r[$classid][tbname].” where id=’$id’ and classid=’$classid’ limit 1″);

if($mgroupid == 1){?>

document.write(‘会员等级不够’);

<?}

if($mgroupid == 2){?>

document.write(‘标题:<?=$r[title]?>’);

<?

}else{?>

document.write(‘请登录’);

<?php

}

db_close();

$empire=null;

?>

在/e/目录新建文件 show.php 存入以上代码

模板里用 <script src=”[!–news.url–]e/show.php?classid=[!–classid–]&id=[!–id–]”></script> 调用