這功能是top5改出來的
下面是網站上的程式碼,參考看看吧\r
1.熱門前五大\r
代碼: 選擇全部
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html LANG="zh-TW">
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=big5">
<title>Untitled</title>
</head>
<body leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0" bgcolor="#F2F8FF">
<STYLE type="text/css">
td{ font-size: 10pt; font-family: verdana }
</STYLE>
<table align="center" bgcolor="#F2F8FF">
<?
define('FORUMS_TABLE', 'phpbb_forums');
define('TOPICS_TABLE', 'phpbb_topics');
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'config.php');
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'includes/db.'.$phpEx);
//
// Mod setting
//
// Topics text length
$MAX_STR_LEN = 26;
// Topics to display
$MAX_TOPICS = 5;
// 0 => users can see all topics including authorized issue(but they cant read the posts)
// 1 => users can see only authorized topics
function cutStr($str) {
global $MAX_STR_LEN;
$str = (strlen($str) > $MAX_STR_LEN) ? (substr($str, 0, $MAX_STR_LEN - 1) . "...") : $str;
return $str;
}
$sql = "SELECT topic_id, topic_title
FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f
WHERE t.forum_id = f.forum_id
AND t.topic_moved_id = '0' and f.auth_view=0 and t.topic_type = '0'
ORDER BY t.topic_views DESC LIMIT 0, $MAX_TOPICS";
if( !$result = $db->sql_query($sql) )
{
echo '<p align="center"><font color="red"><b>ADV_TOPN_MOD TOPICS QUERY ERROR!!</b></font></p>';
exit;
}
// fetch rows
while( $rows = $db->sql_fetchrow($result) )
{
echo "<tr><td><a href=\"http://www.2233.idv.tw/viewtopic.php?t=".$rows['topic_id']."\" target=\"_blank\">".cutStr($rows["topic_title"])."</a></td></tr>";
}
$db->sql_freeresult($rows);
$db->sql_close();
?>
</table>
2.評價前五大\r
代碼: 選擇全部
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html LANG="zh-TW">
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=big5">
<title>Untitled</title>
</head>
<body leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0" bgcolor="#F2F8FF">
<STYLE type="text/css">
td{ font-size: 10pt; font-family: verdana }
</STYLE>
<table align="center" bgcolor="#F2F8FF">
<?
define('FORUMS_TABLE', 'phpbb_forums');
define('TOPICS_TABLE', 'phpbb_topics');
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'config.php');
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'includes/db.'.$phpEx);
//
// Mod setting
//
// Topics text length
$MAX_STR_LEN = 26;
// Topics to display
$MAX_TOPICS = 5;
// 0 => users can see all topics including authorized issue(but they cant read the posts)
// 1 => users can see only authorized topics
function cutStr($str) {
global $MAX_STR_LEN;
$str = (strlen($str) > $MAX_STR_LEN) ? (substr($str, 0, $MAX_STR_LEN - 1) . "...") : $str;
return $str;
}
$sql_select = 't.topic_title, t.rating_rank_id AS topic_rating, p.rating_rank_id AS post_rating, t.topic_id, ro.points AS label2, SUM(ro.points) AS points';
$sql_from = ' phpbb_rating r, '. TOPICS_TABLE . ' t, phpbb_posts p, ' . FORUMS_TABLE . ' f, phpbb_rating_option ro ';
$sql_where = "r.post_id = p.post_id
AND p.topic_id = t.topic_id
AND t.topic_status = 0
AND t.forum_id = f.forum_id
AND f.auth_view=0
AND r.option_id = ro.option_id
GROUP BY p.post_id ORDER BY points DESC LIMIT 0, $MAX_TOPICS";
$sql ="select " .$sql_select." from ".$sql_from." where ".$sql_where;
if( !$result = $db->sql_query($sql) )
{
echo '<p align="center"><font color="red"><b>ADV_TOPN_MOD TOPICS QUERY ERROR!!</b></font></p>';
exit;
}
// fetch rows
while( $rows = $db->sql_fetchrow($result) )
{
echo "<tr><td><a href=\"http://www.2233.idv.tw/viewtopic.php?t=".$rows['topic_id']."\" target=\"_blank\">".cutStr($rows["topic_title"])."</a></td></tr>";
}
$db->sql_freeresult($rows);
$db->sql_close();
?>
</table>
3.回覆前五大\r
代碼: 選擇全部
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html LANG="zh-TW">
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=big5">
<title>Untitled</title>
</head>
<body leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0" bgcolor="#F2F8FF">
<STYLE type="text/css">
td{ font-size: 10pt; font-family: verdana }
</STYLE>
<table align="center" bgcolor="#F2F8FF">
<?
define('FORUMS_TABLE', 'phpbb_forums');
define('TOPICS_TABLE', 'phpbb_topics');
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'config.php');
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'includes/db.'.$phpEx);
//
// Mod setting
//
// Topics text length
$MAX_STR_LEN = 26;
// Topics to display
$MAX_TOPICS = 5;
// 0 => users can see all topics including authorized issue(but they cant read the posts)
// 1 => users can see only authorized topics
function cutStr($str) {
global $MAX_STR_LEN;
$str = (strlen($str) > $MAX_STR_LEN) ? (substr($str, 0, $MAX_STR_LEN - 1) . "...") : $str;
return $str;
}
$sql = "SELECT topic_id, topic_title
FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f
WHERE t.forum_id = f.forum_id
AND t.topic_moved_id = '0' and f.auth_view=0 and t.topic_type = '0'
ORDER BY t.topic_replies DESC LIMIT 0, $MAX_TOPICS";
if( !$result = $db->sql_query($sql) )
{
echo '<p align="center"><font color="red"><b>ADV_TOPN_MOD TOPICS QUERY ERROR!!</b></font></p>';
exit;
}
// fetch rows
while( $rows = $db->sql_fetchrow($result) )
{
echo "<tr><td><a href=\"http://www.2233.idv.tw/viewtopic.php?t=".$rows['topic_id']."\" target=\"_blank\">".cutStr($rows["topic_title"])."</a></td></tr>";
}
$db->sql_freeresult($rows);
$db->sql_close();
?>
</table>
<body>
4.灌水前五大\r
代碼: 選擇全部
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html LANG="zh-TW">
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=big5">
<title>Untitled</title>
</head>
<body leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0" bgcolor="#F2F8FF">
<STYLE type="text/css">
td{ font-size: 10pt; font-family: verdana }
</STYLE>
<table align="center" bgcolor="#F2F8FF">
<?
define('FORUMS_TABLE', 'phpbb_forums');
define('TOPICS_TABLE', 'phpbb_topics');
define('USERS_TABLE', 'phpbb_users');
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'config.php');
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'includes/db.'.$phpEx);
//
// Mod setting
//
// Topics text length
$MAX_STR_LEN = 30;
// Topics to display
$MAX_TOPICS = 5;
// 0 => users can see all topics including authorized issue(but they cant read the posts)
// 1 => users can see only authorized topics
function cutStr($str) {
global $MAX_STR_LEN;
$str = (strlen($str) > $MAX_STR_LEN) ? (substr($str, 0, $MAX_STR_LEN - 1) . "...") : $str;
return $str;
}
$sql = "SELECT user_id, username,user_posts
FROM " . USERS_TABLE . " t
WHERE t.user_active = 1
ORDER BY user_posts DESC LIMIT 0, $MAX_TOPICS";
if( !$result = $db->sql_query($sql) )
{
echo '<p align="center"><font color="red"><b>ADV_TOPN_MOD TOPICS QUERY ERROR!!</b></font></p>';
exit;
}
// fetch rows
while( $rows = $db->sql_fetchrow($result) )
{
echo "<tr><td><a href=\"http://www.2233.idv.tw/profile.php?mode=viewprofile&u=".$rows['user_id']."\" target=\"_blank\">".$rows["username"]."</a> 發表了 ".$rows["user_posts"]."篇文章</td></tr>";
}
$db->sql_freeresult($rows);
$db->sql_close();
?>
</table>