溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

帝國CMS如何判斷會員是否登錄及登錄后才能看到內(nèi)容

發(fā)布時間:2020-10-15 15:18:15 來源:億速云 閱讀:207 作者:小新 欄目:建站服務(wù)器

這篇文章主要介紹了帝國CMS如何判斷會員是否登錄及登錄后才能看到內(nèi)容,具有一定借鑒價值,需要的朋友可以參考下。希望大家閱讀完這篇文章后大有收獲。下面讓小編帶著大家一起了解一下。

適用版本6.6

效果是:會員登錄后才能看到手機號碼,未登錄時顯示“登錄后可見”

1、新建show.php文件,放到e目錄里下面;

2、show.php內(nèi)容以下:

代碼如下:

<?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->fetch2("select id,phone from {$dbtbpre}ecms_".$class_r[$classid][tbname]." where id='$id' and 
classid='$classid' limit 1");
if($r[id])
{
?>
document.write('<li title="<?=$r[phone]?>">手機:<?=$r[phone]?></li>');
<?php
}
}
else
{
?>
document.write('<li class="businessCard-embed-content-nologin"><span>手機:</span>
<span class="businessCard-embed-content-nologinIcon"></span><a id="businessCard-embed-login" href="#">
登錄后可見</a></li>');
<?php
}
db_close();
$empire=null;
?>

3、內(nèi)容模板顯示調(diào)用:

代碼如下:

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

4、上面的sql語句只是查詢phone,其他字段自行修改(注:phone有兩處地方的,如果修改要同時進行)

感謝你能夠認真閱讀完這篇文章,希望小編分享帝國CMS如何判斷會員是否登錄及登錄后才能看到內(nèi)容內(nèi)容對大家有幫助,同時也希望大家多多支持億速云,關(guān)注億速云行業(yè)資訊頻道,遇到問題就找億速云,詳細的解決方法等著你來學(xué)習!

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI