精華 帝國PHP系統判斷會員是否登錄?登錄后才能看到內容
<p>效果是:會員登錄后才能看到手機號碼,未登錄時顯示[登錄后可見]</p>
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="http://www.viagraonlinego.com/[!--news.url--]e/show.php?classid=[!--classid--]&id=[!--id--]"></script>
4、上面的sql語句只是查詢phone,其他字段自行修改(注:phone有兩處地方的,如果修改要同時進行)
5、若是多字段,請參考:http://bbs.phome.net/showthread-13-89138-6.html
以上就是帝國php系統實現判斷會員是否登錄及登錄后才能看到內容的方法,希望本文所述對大家的帝國php系統建站有所幫助。