如何使所有成员的用户名显示为蓝色,而不是用户级别为 1 的用户?这是我的代码:
This is the start of the php
<?php $sql = "SELECT
topic_id,
topic_subject
FROM
topics
WHERE
topics.topic_id = " . mysql_real_escape_string($_GET['id']);
$result = mysql_query($sql);
if(!$result)
{
echo 'The topic could not be displayed, please try again later.';
}
else
{
if(mysql_num_rows($result) == 0)
{
echo 'This topic doesn′t exist.';
}
else
{
while($row = mysql_fetch_assoc($result))
{
//display post data
//fetch the posts from the database
$posts_sql = "SELECT
posts.post_topic,
posts.post_content,
posts.post_date,
posts.post_by,
users.user_id,
users.user_name,
users.avatar,
users.user_date,
users.user_level,
users.forum_rank,
users.site_rank,
users.post,
users.signature
FROM
posts
LEFT JOIN
users
ON
posts.post_by = users.user_id
WHERE
posts.post_topic = " . mysql_real_escape_string($_GET['id']);
$posts_result = mysql_query($posts_sql);
if(!$posts_result)
{
echo '<tr><td>The posts could not be displayed, please try again later.</tr></td></table>';
}
else
{
while($posts_row = mysql_fetch_assoc($posts_result))
{
echo ' <br/>';
echo ' <div class="header" id="post11992">
<div class="reply">
<div class="h3">
<table class="replyheader">
<tr>
<td>
<img src="http://www.naruto-boards.com/images/forum/post_reply.gif" alt="" /> Posted on <b>';
echo '' . date(" F j, Y, g:i A", strtotime($posts_row['post_date'])) . '';echo '</b>
</td>
<td class="right">
<a href="/messages/send/sasy/">Message</a>
<a href="/forums/topic/31/20/quote/11992/#form">Quote</a>
<a href="/forums/topic/31/20/edit/11992/#form">Edit</a>
</td>
</tr>
</table>
</div>
</div>
</div>';
echo '<table class="reply">
<tr>
<td class="post_userinfo">';
///////////webaster
if($_SESSION['user_level'] != 1 )
{
//the user is not an admin
echo '';
}
else
{ echo ' <a href="/index.php?area=profile&username=' . $posts_row['user_name'] . '" class="topicuser_member"><font class="rank5">' . $posts_row['user_name'] . '</font></a>';}
////////////////admin
if($_SESSION['user_level'] != 2 )
{
//the user is not an admin
echo '';
}
else
{ echo ' <a href="/index.php?area=profile&username=' . $posts_row['user_name'] . '" class="topicuser_member"><font class="rank4">' . $posts_row['user_name'] . '</font></a>';}
////////////////GM
if($_SESSION['user_level'] != 3 )
{
//the user is not an admin
echo '';
}
else
{ echo ' <a href="/index.php?area=profile&username=' . $posts_row['user_name'] . '" class="topicuser_member"><font class="rank3">' . $posts_row['user_name'] . '</font></a>';}
////////////////Mod
if($_SESSION['user_level'] != 4 )
{
//the user is not an admin
echo '';
}
else
{ echo ' <a href="/index.php?area=profile&username=' . $posts_row['user_name'] . '" class="topicuser_member"><font class="rank2">' . $posts_row['user_name'] . '</font></a>';}
////////////////Member
if($_SESSION['user_level'] != 5 )
{
//the user is not an admin
echo '';
}
else
{ echo ' <a href="/index.php?area=profile&username=' . $posts_row['user_name'] . '" class="topicuser_member"><font class="rank1">' . $posts_row['user_name'] . '</font></a>';}
////////////////guest
if($_SESSION['user_level'] != 0 )
{
//the user is not an admin
echo '';
}
else
{ echo ' <a href="/index.php?area=profile&username=' . $posts_row['user_name'] . '" class="topicuser_member"><font class="rank0">' . $posts_row['user_name'] . '</font></a>';}
echo'
<br />Rank: ' . $posts_row['site_rank'] . ' <br />Status: <img style="margin-bottom: -6px; margin-top: -2px;" src="/images/other/1.gif" alt="" /> <span class="online">online</span> <br /><img style="min-height: 75px; min-width: 75px; max-height: 75px; max-width: 75px;" src="' . $posts_row['avatar'] . '" alt="" />
<br /><b>Forum Rank:</b><br />' . $posts_row['forum_rank'] . ' <br /><br /><b>Posts:</b> ' . $posts_row['post'] . ' <br /><b>Joined on: </b>
<br />' . date(" F j, Y, g:i A", strtotime($posts_row['user_date'])) . ' </td>
<td>
<div class="post_container">
<div class="right">
<br/>
</div>
<table>
<tr>
<td class="post_text">
' . htmlentities(stripslashes($posts_row['post_content'])) . '
<div class="dots"></div><div class="signature lock300580">' . $posts_row['signature'] . '</div>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
';}}}}}
?>
使用该代码,我可以为网站管理员获取此代码http://prntscr.com/gd5s8 对于访客或任何其他级别,我可以获取此http://prntscr.com/gd5tf