帝国CMS实现判断会员是否登录及登录后才能看到内容的方法

时间:2023年11月27日

/

来源:网络

/

编辑:佚名

本文实例讲述了帝国CMS判断会员是否登录及登录后才能看到内容的方法。分享给大家供大家参考。具体实现方法如下:
适用版本6.6
效果是:会员登录后才能看到手机号码,未登录时显示[登录后可见]
1、新建show.php文件,放到e目录里下面;
2、show.php内容以下: 
复制代码代码如下:
<?php 
require("class/connect.php"); 
include("class/db_sql.php"); 
include("class/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 
if($classid&&$id&&$class_r[$classid][tbname]&&$muserid) 

$r=$empire->fetch1("select id,phone from {$dbtbpre}ecms_".$class_r[$classid][tbname]." where id='$id' and classid='$classid' limit 1"); 
if($r[id]) 

?> 
document.write('<li style="margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; font-size: 12px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden;">
复制代码代码如下:
<script src="[!--news.url--]e/show.php?classid=[!--classid--]&id=[!--id--]"></script>
4、上面的sql语句只是查询phone,其他字段自行修改(注:phone有两处地方的,如果修改要同时进行)
5、若是多字段,请参考:http://bbs.phome.net/showthread-13-89138-6.html
希望本文所述对大家的帝国CMS建站有所帮助。
猜你需要

豫ICP备2021026617号-1  豫公网安备:41172602000185   Copyright © 2021-2028 www.78moban.com/ All Rights Reserved

本站作品均来自互联网,转载目的在于传递更多信息,并不代表本站赞同其观点和对其真实性负责。如有侵犯您的版权,请联系 1565229909#qq.com(把#改成@),我们将立即处理。