评论者代码:
<?php // 获取评论者等级 function user_level($mail){ $db = Mysqlii::getInstance(); global $web_config; $result = $db->query("SELECT COUNT(*) as count FROM ".DB_PREFIX."comment WHERE mail='".$mail."'"); $count = mysqli_fetch_assoc($result)['count']; $role = ''; // 注意 if($mail == $web_config['admin_email']){ echo '<span class="level level-admin" title="累计发表评论'.$count.'条">站长</span><span class="level level-5">已认证</span>'; return;} if($count < 3){ echo '<span class="level level-1" title="累计发表评论'.$count.'条,还需发表'.(3-$count).'条升级LV2">LV 1</span>'; } elseif ($count < 10) { echo '<span class="level level-2" title="累计发表评论'.$count.'条,还需发表'.(10-$count).'条升级LV3">LV 2</span>'; } elseif ($count < 20) { echo '<span class="level level-3" title="累计发表评论'.$count.'条,还需发表'.(20-$count).'条升级LV4">LV 3</span>'; } elseif ($count < 35) { echo '<span class="level level-4" title="累计发表评论'.$count.'条,还需发表'.(35-$count).'条升级最强王者">LV 4</span>'; } else{ echo '<span class="level level-5" title="累计发表评论'.$count.'条,本站最强王者没有之一">本站最强王者</span>'; } } ?> 调用代码:<?php echo user_level($comment['mail']);?> <?php global $CACHE; $user_cache = $CACHE->readCache('user'); $isGravatar = Option::get('isgravatar'); foreach($commentStacks as $cid): $comment = $comments[$cid]; $user_role=''; foreach($user_cache as $k => $a){ $role = $a["role"]; $name = $a["name"]; $mail = $a["mail"]; if($comment['poster'] == $name && $comment['mail'] == $mail){ if($role == "admin"){$user_role = '<span class="level level-admin">站长</span><span class="level level-5" title="官方认证">已认证</span><span class="level level-ssvip" title="本站终身VIP享受尊贵特权"> SSVIP(终身)</span>';} if($role == "writer"){$user_role = '<span class="level level-user">注册会员</span>';} break; } } if(empty($user_role)){$user_role = '<span class="level level-visitor">游客</span>';}?> 调用代码:<?php echo $user_role;?> css代码: .level{margin-left:6px;font-size:12px;color:#fff!important;background-color:#666;padding:0 4px;border-radius:3px;font-size:12px;cursor:pointer;-webkit-transition:.3s;-moz-transition:.3s;-o-transition:.3s;-ms-transition:.3s;line-height:150%;display:inline-block;vertical-align:middle} .level:hover{filter:alpha(opacity=50);-moz-opacity:.5;-khtml-opacity:.5;opacity:.5} .level-1{background-color:#348be8} .level-2{background-color:#32cd32} .level-3{background-color:#836fff} .level-4{background-color:#ff7f00} .level-5{background-color:#ffb31e} .level-user{background-color:#000} .level-vip{background-color:#05bdfe} .level-svip{background-color:#836fff} .level-ssvip{background-color:#ffb31e} .level-visitor{background:gray} .level-admin{background-color:#fd5d3c}
个人中心代码
文章版权代码: <?php if($copy=="1"){ ?> <span class="post-time"> 版权说明:若无特殊注明,转载请保留文章出处</span> <br>本文链接:<?php echo Url::log($logid); ?> <?php }else{ ?> <span class="post-time"> 版权说明: 本文为转载文章,源自互联网,由本站整编 </span> <br>原文地址:<a href="<?php echo $copyurl ?>" target="_blank"> <?php echo $copyurl ?></a> <?php } ?> 个人中心代码: <?php /** * 个人中心 */ if(!defined('EMLOG_ROOT')) {exit('error!');} $DB = Database::getInstance(); $userData = $DB->once_fetch_array("SELECT * FROM ".DB_PREFIX."user WHERE uid = '$author'"); if(!empty($userData['photo'])){$author_img = BLOG_URL .$userData['photo'];}else{if(strpos($userData['email'],'@qq.com') !== false){$Mail=$userData['email'];$QQ_IMG=str_replace("@qq.com","",$Mail);$author_img = "http://q.qlogo.cn/headimg_dl?bs=qq&dst_uin=".$QQ_IMG."&src_uin=www.wuaif.com&fid=blog&spec=100";}else{$author_img = BLOG_URL . 'avatar/default.png';}} /*累计投稿*/$sql = "SELECT COUNT(*) AS authornum FROM ".DB_PREFIX."blog WHERE type='blog' AND hide='n' and author=".$author."";$res = $DB->query($sql);while($userData1 = $DB->fetch_array($res)){$con1 = $userData1['authornum'];} /*通过数量*/$sql = "SELECT checked, count(*) from ".DB_PREFIX."blog where checked='y' and author='".$author."' Group by checked";$res = $DB->query($sql);$userData2 = $DB->fetch_array($res);if($userData2['count(*)'] != ''){$con2 = $userData2['count(*)'];}else{$con2 = "0";} /*待通过数*/$sql = "SELECT checked, count(*) from ".DB_PREFIX."blog where checked='n' and author='".$author."' Group by checked";$res = $DB->query($sql);$userData2 = $DB->fetch_array($res);if($userData2['count(*)'] != ''){$con3 = $userData2['count(*)'];}else{$con3 = "0";} /*评论总数*/$userData3 = $DB->once_fetch_array("SELECT COUNT(*) AS comnum FROM ".DB_PREFIX."comment WHERE poster='".$userData['nickname']."'");$con4 = $userData3['comnum']; ?> 调用: 头像调用:<?php echo $author_img;?> <?php $Nickname = $userData['nickname'] != '' ? $userData['nickname'] : $userData['username'];echo $Nickname;?><b><?php if($userData['role'] == 'admin'){echo '管理员';}elseif($userData['role'] == 'writer'){echo '投稿作者';}?> 投稿次数:<?php echo $con1;?> 通过次数:<?php echo $con2;?> 待通过数:<?php echo $con3;?> 评论总数:<?php echo $con4;?> <a href="<?php if(!empty($userData['website'])){echo $userData['website'];}else{echo "javascript:alert('作者未填写作者网站')";}?>" target="_blank">作者网站</a>
版权声明:本文为(厌倦)原创文章,转载时请注明出处!
http://wozhidaole.com.cn/
如果同意到本站联系我,
其他网友有意向友链的也可以到本站申请!