2011-12-17, 02:58 PM
((Google Translation))
hello all
i want display latest "5" threads on my home page
forum dir --> "forum"
and i want make new file called " latest.php" to use it for display latest threads
I'm sorry because my English is bad
i used this code
But show this messages
Please help me
hello all
i want display latest "5" threads on my home page
forum dir --> "forum"
and i want make new file called " latest.php" to use it for display latest threads
I'm sorry because my English is bad
i used this code
<?php
echo "<meta http-equiv='content-type' content='text/html; charset=utf-8' />";
//Connect to mybb db
chdir('forum'); // path to MyBB
define("IN_MYBB", 1);
require '/global.php';
mysql_set_charset('utf8');
//query to get latest 5 threads
$query = mysql_query("SELECT * FROM mybb_threads t LEFT JOIN mybb_users u ON (u.uid=t.uid) ORDER BY t.lastpost DESC LIMIT 0, 5");
$list = '';
while($fetch = mysql_fetch_array($query))
{
$list .= " | <strong><a href=\"forum/showthread.php?tid={$fetch['tid']}\" target=\"_blank\">".htmlspecialchars_uni($fetch['subject'])."</a></strong>";
}
//output
//echo $list;
//MyBB htmlspecialchars function
function htmlspecialchars_uni($message)
{
$message = preg_replace("#&(?!\#[0-9]+;)#si", "&", $message); // Fix & but allow unicode
$message = str_replace("<","<",$message);
$message = str_replace(">",">",$message);
$message = str_replace("\"",""",$message);
$message = str_replace(" ", " ", $message);
return $message;
}
echo "<marquee direction='right' scrollamount='3'>";
echo $list;
echo "</marquee></p> ";
?>
But show this messages
Fatal error: Cannot redeclare htmlspecialchars_uni() (previously declared in C:\wamp\www\latest.php:30) in C:\wamp\www\forum\inc\functions.php on line 4037
Please help me