Pagina 1 van 1

Laatste 5 posts op site

Geplaatst: 31 mar 2005, 17:26
door Yellow
Ik dacht dat deze mod wel goed te vinden was, maar kan hem op dit forum niet vinden. En die van anouksweb is de laatste topics en die doet het niet.
Ik wil dus zoiets als op deze site: http://www.owns.nl
Daar staan 5 links op de site naar de laatste posts op het phpbb forum.

EDIT: Ik heb nu een mod van phpbbhacks, maar krijg deze fout:

SecureSSI: Das Script (/usr/export/www/vhosts/funnetwork/hosting/forums/laatsteposts.php) hat versucht ausserhalb von ihrem Userverzeichniss auf die Datei /Forum/config.php zuzugreifen.
Dies ist nicht erlaubt!

Warning: main(): Sicherheitsverletzung: in /usr/export/www/vhosts/funnetwork/hosting/forums/laatsteposts.php on line 11

Warning: main(/Forum/config.php): failed to open stream: Operation not permitted in /usr/export/www/vhosts/funnetwork/hosting/forums/laatsteposts.php on line 11

Warning: main(): Failed opening '/Forum/config.php' for inclusion (include_path='.:') in /usr/export/www/vhosts/funnetwork/hosting/forums/laatsteposts.php on line 11
here we die at connection

Dit is mijn code:

Code: Selecteer alles

<? 
$urlPath = "/Forum";	//example: if your forum URL looks like http://kocky-online.cz/forum, this should be "/forum"
$serverPath = "/Forum/config.php";			//example: when this file is in URL path /forum/mod, this should be ../config.php
if(empty($count))
	$count = "3";									//default value of how many posts/topics to show
if(empty($type))
	$type = "posts";		//default value of whether to show 'posts' or 'topics' 
$titleLimit = 30;			//this is max.length of 'title' of topic/post
$moreLimit = 20;			//this is max.length of 'more' (used in posts)

include_once("$serverPath"); 
$db = @mysql_connect("$dbhost", "$dbuser", "$dbpasswd") or die("here we die at connection"); 
@mysql_select_db("$dbname",$db) or die("here we die"); 

if($type == "posts") 
{
	$prefix = 'p';
   $sql = "SELECT x.post_subject as title, p.post_id as id, f.forum_id, t.topic_title as more "
   		."FROM ${table_prefix}topics t, ${table_prefix}forums f, ${table_prefix}posts p, ${table_prefix}posts_text x "
   		."WHERE t.topic_id = p.topic_id AND f.forum_id = t.forum_id AND p.post_id = x.post_id "
   		."ORDER BY p.post_id DESC "
   		."LIMIT $count"; 
}
else 
{
	$prefix = 't';
   $sql = "SELECT t.topic_title as title, t.topic_id as id, f.forum_id, '' as more "
   		."FROM ${table_prefix}topics t, ${table_prefix}forums f "
   		."WHERE f.forum_id = t.forum_id "
   		."ORDER BY topic_time DESC "
   		."LIMIT $count"; 
}

//echo $sql;

if($r = mysql_query($sql, $db)) { 
	while($m = mysql_fetch_array($r)) { 
		$j = stripslashes($m[title]); 
		$k = substr($j, 0, $titleLimit) . "..."; 
		if(!empty($m[more]))
			$m[more] = '('.substr($m[more], 0, $moreLimit) . '...)'; 
		if ($type == 'posts') {
			$anchor = '#'.$m[id];
		}
		//-------------------[ THIS IS ONLY LINE YOU COULD CHANGE ]--------------------------
		echo "<a title=\"$m[title]\" href=\"$urlPath/viewtopic.php?${prefix}=$m[id]&sid=$m[forum_id]${anchor}\">$k</a> $m[more]<br>"; 
	} 
} 

?>