Topic: trubble on main index
He all
I've tryed to set the last forum post on index, on my testsite everything works good.
But on the site the post don't show
hope someone will help me with it.
This what is use
on index
<h2>Last Forum Posts</h2>
<table width=100% border=1 cellspacing=0 cellpadding=10><tr><td align=left>
<table class=main border=1 cellspacing=0 cellpadding=5>
<?
include('http://host.com/punbb/extern.php?action=active');
?>
</table>
</table></div>
in punbb/extern.php
//
// Show recent discussions
//
if ($_GET['action'] == 'active' || $_GET['action'] == 'new')
{
$order_by = ($_GET['action'] == 'active') ? 't.last_post' : 't.posted';
$forum_sql = '';
// Was any specific forum ID's supplied?
if (isset($_GET['fid']) && $_GET['fid'] != '')
{
$fids = explode(',', trim($_GET['fid']));
$fids = array_map('intval', $fids);
if (!empty($fids))
$forum_sql = ' AND f.id IN('.implode(',', $fids).')';
}
// Any forum ID's to exclude?
if (isset($_GET['nfid']) && $_GET['nfid'] != '')
{
$nfids = explode(',', trim($_GET['nfid']));
$nfids = array_map('intval', $nfids);
if (!empty($nfids))
$forum_sql = ' AND f.id NOT IN('.implode(',', $nfids).')';
}
// Should we output this as RSS?
if (isset($_GET['type']) && strtoupper($_GET['type']) == 'RSS')
{
$rss_description = ($_GET['action'] == 'active') ? $lang_common['RSS Desc Active'] : $lang_common['RSS Desc New'];
$url_action = ($_GET['action'] == 'active') ? '&action=new' : '';
// Send XML/no cache headers
header('Content-Type: text/xml');
header('Expires: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
// It's time for some syndication!
echo '<?xml version="1.0" encoding="'.$lang_common['lang_encoding'].'"?>'."\r\n";
echo '<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd">'."\r\n";
echo '<rss version="0.91">'."\r\n";
echo '<channel>'."\r\n";
echo "\t".'<title>'.pun_htmlspecialchars($pun_config['o_board_title']).'</title>'."\r\n";
echo "\t".'<link>'.$pun_config['o_base_url'].'/</link>'."\r\n";
echo "\t".'<description>'.pun_htmlspecialchars($rss_description.' '.$pun_config['o_board_title']).'</description>'."\r\n";
echo "\t".'<language>en-us</language>'."\r\n";
// Fetch 15 topics
$result = $db->query('SELECT t.id, t.poster, t.subject, t.posted, t.last_post, f.id AS fid, f.forum_name FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=3) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.moved_to IS NULL'.$forum_sql.' ORDER BY '.$order_by.' DESC LIMIT 15') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
while ($cur_topic = $db->fetch_assoc($result))
{
if ($pun_config['o_censoring'] == '1')
$cur_topic['subject'] = censor_words($cur_topic['subject']);
echo "\t".'<item>'."\r\n";
echo "\t\t".'<title>'.pun_htmlspecialchars($cur_topic['subject']).'</title>'."\r\n";
echo "\t\t".'<link>./punbb.php?page=viewtopic&id='.$cur_topic['id'].$url_action.'</link>'."\r\n";
echo "\t\t".'<description><![CDATA['.escape_cdata($lang_common['Forum'].': <a href="./punbb/viewforum?id='.$cur_topic['fid'].'">'.$cur_topic['forum_name'].'</a><br />'."\r\n".$lang_common['Author'].': '.$cur_topic['poster'].'<br />'."\r\n".$lang_common['Posted'].': '.date('r', $cur_topic['posted']).'<br />'."\r\n".$lang_common['Last post'].': '.date('r', $cur_topic['last_post'])).']]></description>'."\r\n";
echo "\t".'</item>'."\r\n";
}
echo '</channel>'."\r\n";
echo '</rss>';
}
// Output regular HTML
else
{
$show = isset($_GET['show']) ? intval($_GET['show']) : 15;
if ($show < 1 || $show > 50)
$show = 15;
// Fetch $show topics
$result = $db->query('SELECT t.id, t.num_views, t.last_poster, t.num_replies, t.poster, t.posted, t.last_post, t.subject, f.forum_name FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=3) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.moved_to IS NULL'.$forum_sql.' ORDER BY '.$order_by.' DESC LIMIT '.$show) or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
print("<table border=1 cellspacing=0 align=center class=main cellpadding=5><tr>".
"<td class=tabletitle align=left>Topic Title</td>".
"<td class=tabletitle align=left>Replies</td>".
"<td class=tabletitle align=left>Views</td>".
"<td class=tabletitle align=left>Author</td>".
"<td class=tabletitle align=left>Last Post</td>".
"</tr>");
while ($cur_topic = $db->fetch_assoc($result))
{
if ($pun_config['o_censoring'] == '1')
$cur_topic['subject'] = censor_words($cur_topic['subject']);
if (pun_strlen($cur_topic['subject']) > $max_subject_length)
$subject_truncated = pun_htmlspecialchars(trim(substr($cur_topic['subject'], 0, ($max_subject_length-5)))).' ?';
else
$subject_truncated = pun_htmlspecialchars($cur_topic['subject']);
$res = mysql_query("SELECT id FROM users WHERE username='$cur_topic[poster]'");
$row = @mysql_fetch_array($res);
$ras = mysql_query("SELECT id FROM users WHERE username='$cur_topic[last_poster]'");
$raw = @mysql_fetch_array($ras);
print("<tr class=tableb><td style='padding-right: 5px'><a href=./punbb/viewtopic?id=".$cur_topic['id'].">$subject_truncated</a></td>".
"<td align=right>$cur_topic[num_replies]</td>" .
"<td align=right>$cur_topic[num_views]</td>".
"<td align=left><a href=userdetails.php?id=" . $row['id'] .">$cur_topic[poster]</a></td>" .
"<td align=left>" . gmdate('Y/m/d H:i:s', $cur_topic['last_post']) . " by <a href=userdetails.php?id=" . $raw['id'] .">$cur_topic[last_poster]</a></td>");
}
print("</tr>");
// while
}
return;
}
if i use this on index
# Show users online:
include('http://host.com/punbb/extern.php?action=online');
# Show users online with full listing of users:
include('http://host.com/punbb/extern.php?action=online_full');
# Show board statistics:
include('http://host.com/punbb/extern.php?action=stats');
that show me all with no problem
thanxs in advance
gtz sarges
sorry for the englisch