首先在module.php中添加以下代码:
<?php function echo_levels($comment_author_email,$comment_author_url){ $DB = MySql::getInstance(); global $CACHE; $user_cache = $CACHE->readCache('user'); $adminEmail = '"'.$user_cache[1]['mail'].'"'; if($comment_author_email==$adminEmail) { echo '<a class="vip" title="管理员认证"></a><a class="vip7" title="特别认证"></a>'; } $sql = "SELECT cid as author_count,mail FROM ".DB_PREFIX."comment WHERE mail != '' and mail = $comment_author_email and hide ='n'"; $res = $DB->query($sql); $author_count = mysql_num_rows($res); if($author_count>=2 && $author_count<10 && $comment_author_email!=$adminEmail) echo '<a class="vip1" title="路过酱油 LV.1"></a>'; else if($author_count>=10 && $author_count<20 && $comment_author_email!=$adminEmail) echo '<a class="vip2" title="偶尔光临 LV.2"></a>'; else if($author_count>=20 && $author_count<40 && $comment_author_email!=$adminEmail) echo '<a class="vip3" title="常驻人口 LV.3"></a>'; else if($author_count>=40 && $author_count<80 && $comment_author_email!=$adminEmail) echo '<a class="vip4" title="以博为家 LV.4"></a>'; else if($author_count>=80 &&$author_count<160 && $comment_author_email!=$adminEmail) echo '<a class="vip5" title="情牵小博 LV.5"></a>'; else if($author_count>=160 && $author_coun<320 && $comment_author_email!=$adminEmail) echo '<a class="vip6" title="为博终老 LV.6"></a>'; else if($author_count>=50 && $author_coun<60 && $comment_author_email!=$adminEmail) echo '<a class="vip7" title="三世情牵 LV.7"></a>'; } ?>
调用代码:
<?php $mail_str="\"".strip_tags($comment['mail'])."\"";echo_levels($mail_str,"\"".$comment['url']."\"");?>
在css添加以下代码:
.vip,.vip1,.vip2,.vip3,.vip4,.vip5,.vip6,.vip7{background: url(../images/vip.png) no-repeat;display: inline-block;overflow: hidden;border: none;}.vip{background-position:-494px -3px;width: 16px;height: 16px;margin-bottom: -3px;}.vip:hover{background-position:-515px -22px;width: 16px;height: 16px;margin-bottom: -3px;}.vip1{background-position:-1px -2px;width: 46px;height: 14px;margin-bottom: -1px;}.vip1:hover{background-position:-1px -22px;width: 46px;height: 14px;margin-bottom: -1px;}.vip2{background-position:-63px -2px;width: 46px;height: 14px;margin-bottom: -1px;}
.vip2:hover{background-position:-63px -22px;width: 46px;height: 14px;margin-bottom: -1px;}.vip3{background-position:-144px -2px;width: 46px;height: 14px;margin-bottom: -1px;}.vip3:hover{background-position:-144px -22px;width: 46px;height: 14px;margin-bottom: -1px;}.vip4{background-position:-227px -2px;width: 46px;height: 14px;margin-bottom: -1px;}.vip4:hover{background-position:-227px -22px;width: 46px;height: 14px;margin-bottom: -1px;}.vip5{background-position:-331px -2px;width: 46px;height: 14px;margin-bottom: -1px;}.vip5:hover{background-position:-331px -22px;width: 46px;height: 14px;margin-bottom: -1px;}.vip6{background-position:-441px -2px;width: 46px;height: 14px;margin-bottom: -1px;}.vip6:hover{background-position:-441px -22px;width: 46px;height: 14px;margin-bottom: -1px;}.vip7{background-position:-611px -2px;width: 46px;height: 14px;margin-bottom: -1px;}.vip7:hover{background-position:-611px -22px;width: 46px;height: 14px;margin-bottom: -1px;}
把以下vip.png复制到images文件夹:
本文共 73 个字数,平均阅读时长 ≈ 1分钟
评论 (0)