|
#!/usr/local/bin/php |
|
| 1 |
<? |
<? |
| 2 |
if (!isset($_SERVER["argc"])) |
if (!isset($_SERVER["argc"])) |
| 3 |
$_SERVER["argc"] = 0; |
$_SERVER["argc"] = 0; |
| 11 |
" \033[1;34m-----\033[37m=====\033[41;37m 本站十大热门话题 \033[40m=====\033[34m-----\033[m\r\n\r\n"; |
" \033[1;34m-----\033[37m=====\033[41;37m 本站十大热门话题 \033[40m=====\033[34m-----\033[m\r\n\r\n"; |
| 12 |
|
|
| 13 |
$db_conn = include "./db_open.inc.php"; |
$db_conn = include "./db_open.inc.php"; |
| 14 |
|
|
| 15 |
$rs = mysql_query( |
$rs = mysql_query( |
| 16 |
" select bbs.title, sname, username, sub_dt". |
" select bbs.title, sname, username, sub_dt". |
| 17 |
" from bbs inner join section_config on". |
" from bbs inner join section_config on". |
| 18 |
" bbs.SID=section_config.SID inner join user_list on". |
" bbs.SID=section_config.SID where section_config.recommend". |
|
" user_list.UID=bbs.UID where section_config.recommend". |
|
| 19 |
" and bbs.TID=0 and bbs.visible and bbs.view_count>=10". |
" and bbs.TID=0 and bbs.visible and bbs.view_count>=10". |
| 20 |
" and (bbs.sub_dt >= subdate(now(),interval '7' day))". |
" and (bbs.sub_dt >= subdate(now(),interval '7' day))". |
| 21 |
" order by bbs.excerption desc,bbs.view_count+bbs.reply_count desc,". |
" order by bbs.excerption desc,bbs.view_count+bbs.reply_count desc,". |
| 22 |
"bbs.transship limit 10",$db_conn); |
"bbs.transship limit 10",$db_conn) |
| 23 |
|
or die ("Query data error"); |
| 24 |
|
|
| 25 |
$i = 1; |
$i = 1; |
| 26 |
while ($row=mysql_fetch_array($rs)) |
while ($row=mysql_fetch_array($rs)) |
| 31 |
$i++, $row["sname"], str_repeat(" ", 20 - strlen($row["sname"])), |
$i++, $row["sname"], str_repeat(" ", 20 - strlen($row["sname"])), |
| 32 |
strftime("%b %d %H:%M:%S", strtotime($row["sub_dt"])), |
strftime("%b %d %H:%M:%S", strtotime($row["sub_dt"])), |
| 33 |
str_repeat(" ", 16 - strlen($row["username"])), |
str_repeat(" ", 16 - strlen($row["username"])), |
| 34 |
$row["username"], substr($row["title"],0,60), |
$row["username"], substr($row["title"],0,60), |
| 35 |
str_repeat(" ", 60 - strlen($row["title"])) |
str_repeat(" ", 60 - strlen($row["title"]) >=0 ? 60 - strlen($row["title"]) : 0) |
| 36 |
); |
); |
| 37 |
} |
} |
| 38 |
|
|
| 39 |
mysql_free_result($rs); |
mysql_free_result($rs); |
| 40 |
|
|
| 41 |
mysql_close($db_conn); |
mysql_close($db_conn); |
| 45 |
fwrite($fp,$buffer); |
fwrite($fp,$buffer); |
| 46 |
fclose($fp); |
fclose($fp); |
| 47 |
} |
} |
| 48 |
|
|
| 49 |
return 0; |
return 0; |
| 50 |
?> |
?> |