11.05.2004, 13:42
Die Datei extern: http://vc.yourboardhosting.de/lastposts.php
Hoster hat PHP und ist nicht auf meinem Account gesperrt!
Hoster hat PHP und ist nicht auf meinem Account gesperrt!
PHP-Code:
<?php
$verbindung = @mysql_connect("localhost","xxxx","xxxx");
$db = "usr_web102_1";
$htmlout = "";
/* Anzahl der zu zeigenden Posts
* wenn mehr oder weniger asl 5 dargestellt werden sollen
* den Wert verändern.
*/
$anzahl_posts = 10;
/* Url zu deinem Board ohne / am ende */
$boardpath = "http://vc.yourboardhosting.de";
$query = "
select
bb1_posts.*,
bb1_threads.threadname,
bb1_user_table.username
from
bb1_posts,
bb1_threads,
bb1_user_table
where
bb1_threads.threadid = bb1_posts.threadparentid
and
bb1_user_table.userid = bb1_posts.userid
and
bb1_threads.boardparentid != '11'
group by
bb1_posts.threadparentid
order by
bb1_posts.posttime
desc
limit
0,$anzahl_posts
";
function short_topic($text){
/* max = maximale anzahl von Zeichen im Topic
* ggf ändern.
*/
$max = 20;
if (strlen($text) > $max-3){
$text = substr($text,0,$max)."...";
}
return $text;
}
$result = mysql_db_query($db,$query,$verbindung) or die("Fehler startseite");
while ( $row = mysql_fetch_array($result)) {
$datum = formatdate($row['posttime'],"DD.MM.YYYY, HH:II");
$threadname = $row['threadname'];
$boardid = $row['boardparentid'];
$threadid = $row['threadparentid'];
$autor = $row['username'];
$link = "<A TARGET=\"_blank\" HREF=\"$boardpath/action.php?action=getlastmain&boardid=$boardid\">$threadname</A>";
$htmlout .= "$link <br>";
}
echo $htmlout;
function formatdate($time,$format,$replacetoday=0) {
global $db_zugriff, $n, $timetype, $timeoffset, $today;
$time = $time+(3600*$timeoffset);
if(date("dmY", time()+(3600*$timeoffset))==date("dmY", $time) && $replacetoday) {
$position = strpos($today, "=");
if($position!==false) {
$pcover = substr($today, $position+1);
$val = substr($today, 0, $position);
$format = str_replace($val,$pcover, $format);
}
}
$out = str_replace("DD",date("d", $time), $format);
$out = str_replace("MM",date("m", $time), $out);
$out = str_replace("YYYY",date("Y", $time), $out);
$out = str_replace("YY",date("y", $time), $out);
$out = str_replace("MN",get_month_name(date("n", $time)), $out);
if($timetype) { #12 Stunden
$out = str_replace("II","II ".date("A", $time), $out);
$out = str_replace("HH",date("h", $time), $out);
}
else $out = str_replace("HH",date("H", $time), $out);
$out = str_replace("II",date("i", $time), $out);
return $out;
}
function get_month_name($month_number) {
$name_monat[1] = "Januar";
$name_monat[2] = "Februar";
$name_monat[3] = "März";
$name_monat[4] = "April";
$name_monat[5] = "Mai";
$name_monat[6] = "Juni";
$name_monat[7] = "Juli";
$name_monat[8] = "August";
$name_monat[9] = "September";
$name_monat[10] = "Oktober";
$name_monat[11] = "November";
$name_monat[12] = "Dezember";
return $name_monat[$month_number];
}
?>