20.04.2006, 13:37
Ähm, also ich möchte auf einer von mir selbst erstellen Seite den Inhalt und den Titel der neusten 5 Themen (also nicht die Beiträge) aus dem Forum mit der id 2 anzeigen lassen.
<?php
// Pfad zur global.php des Forums
chdir("./forum/");
// Anzahl der Themen
$limit = "5";
// Nicht in der Wer ist online? Liste
define("NO_ONLINE", 1);
require("./global.php");
require("./inc/functions_post.php");
// Letzte Themen auslesen
$query = $db->query("SELECT subject,tid,dateline FROM ".TABLE_PREFIX."threads WHERE visible='1' AND fid = '2' ORDER BY tid DESC LIMIT 0,".$limit."");
while ($newest_threads = $db->fetch_array($query))
{
// Beitrag auslesen
$query2 = $db->query("SELECT message FROM ".TABLE_PREFIX."posts WHERE visible = '1' AND tid = '".$newest_threads['tid']."' ORDER BY pid ASC LIMIT 0,1");
$postmessage = $db->fetch_array($query2);
echo "<p id='news'><a href=\"".$mybb->settings['boardurl']."/showthread.php?tid=".$newest_threads['tid']."\" target=\"_blank\">".$newest_threads['subject']."</a><br />Gepostet am: ".date("d.m.Y, H:i", $newest_threads['dateline'])." Uhr<br />".postify($postmessage['message'], no, yes, yes, yes)."</p>";
}
?>
Zitat:Warning: chdir() [function.chdir]: SAFE MODE Restriction in effect. The script whose uid is 739 is not allowed to access /home/htdocs/web84/html/content owned by uid 0 in /home/htdocs/web84/html/content/test.php on line 31
Warning: main() [function.main]: Unable to access ./forum/global.php in /home/htdocs/web84/html/content/test.php on line 39
Warning: main(./forum/global.php) [function.main]: failed to open stream: No such file or directory in /home/htdocs/web84/html/content/test.php on line 39
Warning: main() [function.main]: Unable to access ./forum/global.php in /home/htdocs/web84/html/content/test.php on line 39
Warning: main(./forum/global.php) [function.main]: failed to open stream: No such file or directory in /home/htdocs/web84/html/content/test.php on line 39
Fatal error: main() [function.require]: Failed opening required './forum/global.php' (include_path='.') in /home/htdocs/web84/html/content/test.php on line 39
// Pfad zur global.php des Forums
chdir("./forum/");
Zitat:Warning: chdir() [function.chdir]: No such file or directory (errno 2) in /home/htdocs/web84/html/content/test.php on line 31
Direct initialization of this file is not allowed.
Fatal error: Call to a member function on a non-object in /home/htdocs/web84/html/content/test.php on line 43
<?php
// Daten für Verbindung zur Datenbank
$dbhost = "Localhost";
$dbuser = "Benutzername";
$dbpassword = "Passwort";
$dbdatabase = "Datenbankname";
// Präfix
$prefix = "mybb_";
// URL zum Forum
$url = "http://www.deinedomain.de/forum";
// Anzahl der Themen
$limit = "5";
// Pfad zur inc/functions_post.php zur MyCode-Umwandlung
require("./forum/inc/functions_post.php");
// Verbindung zur Datenbank aufnehmen
$db = mysql_connect($dbhost,$dbuser,$dbpassword) or die ("Verbindung fehlgeschlagen");
mysql_select_db($dbdatabase,$db);
// Letzte Themen auslesen
$query = mysql_query("SELECT subject,tid,dateline FROM ".$prefix."threads WHERE visible='1' AND fid = '2' ORDER BY tid DESC LIMIT 0,".$limit."");
while ($newest_threads = mysql_fetch_array($query))
{
// Beitrag auslesen
$query2 = mysql_query("SELECT message FROM ".$prefix."posts WHERE visible = '1' AND tid = '".$newest_threads['tid']."' ORDER BY pid ASC LIMIT 0,1");
$postmessage = mysql_fetch_array($query2);
echo "<p id='news'><a href=\"".$url."/showthread.php?tid=".$newest_threads['tid']."\" target=\"_blank\">".$newest_threads['subject']."</a><br />Gepostet am: ".date("d.m.Y, H:i", $newest_threads['dateline'])." Uhr<br />".postify($postmessage['message'], no, yes, yes, yes)."</p>";
}
?>
Zitat:Fatal error: Call to undefined function: postify() in /home/htdocs/web84/html/content/test.php on line 49
echo "<p id='news'><a href=\"".$url."/showthread.php?tid=".$newest_threads['tid']."\" target=\"_blank\">".$newest_threads['subject']."</a><br />Gepostet am: ".date("d.m.Y, H:i", $newest_threads['dateline'])." Uhr<br />".postify($postmessage['message'], no, yes, yes, yes)."</p>";
// Pfad zur inc/functions_post.php zur MyCode-Umwandlung
require("./forum/inc/functions_post.php");
require("forum/inc/functions_post.php");
Zitat:Fatal error: Call to a member function on a non-object in /home/htdocs/web84/html/forum/inc/functions_post.php on line 156