对于以下功能,我希望链接<div class="footervote"><a href="http://www...com/.../footervote.php">Vote</a></div>
仅在登录用户当前出现在editorlist.php上时才会显示。 (一e。如果在功能上loginid
对应于任何目前出现在editorlist.php的username
S的。)如果登录用户出现在动态列表中,仅显示链接
浮出editorlist.php的东西是动态的。
我该怎么做?
由于提前,
约翰
function show_userbox()
{
// retrieve the session information
$u = $_SESSION['username'];
$uid = $_SESSION['loginid'];
// display the user box
echo '<div id="userbox">
<div class="username">'.$u.'</div>
<div class="submit"><a href="http://www...com/.../submit.php">Submit an item.</a></div>
<div class="changepassword"><a href="http://www...com/.../changepassword.php">Change Password</a></div>
<div class="logout"><a href="http://www...com/.../logout.php">Logout</a></div>
<div class="footervote"><a href="http://www...com/.../footervote.php">Vote</a></div>
</div>';
}
在editorlist.php:
$sqlStr = "SELECT
l.loginid,
l.username,
l.created,
DATEDIFF(NOW(), l.created) AS days,
COALESCE(s.total, 0) AS countSubmissions,
COALESCE(c.total, 0) AS countComments,
COALESCE(s.total, 0) * 10 + COALESCE(c.total, 0) AS totalScore,
DATEDIFF(NOW(), l.created) + COALESCE(s.total, 0) * 10 + COALESCE(c.total, 0) AS totalScore2
FROM login l
LEFT JOIN (
SELECT loginid, COUNT(1) AS total
FROM submission
GROUP BY loginid
) s ON l.loginid = s.loginid
LEFT JOIN (
SELECT loginid, COUNT(1) AS total
FROM comment
GROUP BY loginid
) c ON l.loginid = c.loginid
GROUP BY l.loginid
ORDER BY totalScore2 DESC
LIMIT 10";
$result = mysql_query($sqlStr);
$arr = array();
echo "<table class=\"samplesrec1edit\">";
while ($row = mysql_fetch_array($result)) {
echo '<tr>';
echo '<td class="sitename1edit1"><a href="http://www...com/.../members/index.php?profile='.$row["username"].'">'.stripslashes($row["username"]).'</a></td>';
echo '<td class="sitename1edit2">'.($row["countSubmissions"]).'</td>';
echo '<td class="sitename1edit2">'.($row["countComments"]).'</td>';
echo '<td class="sitename1edit2">'.($row["days"]).'</td>';
echo '<td class="sitename1edit2">'.($row["totalScore2"]).'</td>';
echo '</tr>';
}
echo "</table>";