Seite 1 von 2
Problem mit Zugriff auf das phpBB von außerhalb des phpBB
Verfasst: 15.09.2005 10:58
von Martin Truckenbrodt
Hallo,
ich nutze folgendes Script um außerhalb des phpBB auf der Startseite von
www.killi.org zufällig generierte Bilder aus Smartor's Photo Album anzeigen zu lassen:
Code: Alles auswählen
<?
$dbhost = '; //set it
$dbname = ''; //set it
$dbuser = ''; //set it
$dbpasswd = ''; //set it
$table_prefix = 'phpbb_'; // perhhaps you have to change ist
$phpbb_root_path = './cgi/phpBB2/'; //set your path
$album_table = $table_prefix.'album';
$dbcon = mysql_connect($dbhost,$dbuser,$dbpasswd);
mysql_select_db($dbname);
?>
<table>
<?php
$sql="SELECT pic_id, pic_title, pic_desc FROM $album_table ORDER BY RAND() LIMIT 1";
$result = mysql_query($sql) or die;
$row = mysql_fetch_array($result);
print "<TR><TD class='klein' align='center'>" . $row['pic_title'] . "<BR></TD></TR><TR><td align='center'><a href='". $phpbb_root_path ."album_page.php?pic_id=" . $row['pic_id'] . "'><img alt='" . $row['pic_desc'] . "' src='". $phpbb_root_path ."album_thumbnail.php?pic_id=" . $row['pic_id'] . "'></a></td></TR>";
?>
</table>
Nun ist uns aufgefallen, dass im Forum das Anzeigen der neuesten Beiträge seit dem letzten Besuch nicht mehr klappt, wenn man vorher erst die Startseite von
www.killi.org aufgerufen hatte. Geht man sofort direkt ins Forum ist alles i.O..
Wie kann ich dieses Problem lösen?
Danke und Gruß Martin
Verfasst: 15.09.2005 14:00
von Martin Truckenbrodt
Hallo,
ich habe eine komplett neue Version erstellt:
Code: Alles auswählen
<?
define('IN_PHPBB', true);
$phpbb_root_path = './cgi/phpBB2/'; //set the setting correct - I have put the file into admin_mod subfolder
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
print "<table>";
print "<tr><th colspan='3'>zufällige Fotos aus der Fotogalerie</th></tr>"; // make your own text
print "<TR>";
for ($i=0;$i<3;$i++) //set number of pictures for the displayed line
{
$sql="SELECT pic_id, pic_title, pic_desc FROM ". ALBUM_TABLE ." ORDER BY RAND() LIMIT 1";
$result = mysql_query($sql) or die;
$row = mysql_fetch_array($result);
print "<TD valign='top'><TABLE><TR><TD class='klein' align='center'>" . $row['pic_title'] . "<BR></TD></TR><TR><td align='center'><a href='". $phpbb_root_path ."album_page.php?pic_id=" . $row['pic_id'] . "'><img alt='" . $row['pic_desc'] . "' src='". $phpbb_root_path ."album_thumbnail.php?pic_id=" . $row['pic_id'] . "'></a></td></TR></TABLE></TD>";
}
print "</TR>";
print "</table>";
?>
Bin mir jetzt aber nicht ganz sicher, ob ich das Problem damit gelöst habe. Ist noch
notwendig?
Wenn ja, wie baue ich es ein?
Gruß Martin
Verfasst: 15.09.2005 15:24
von fanrpg
Code: Alles auswählen
<a href='". append_sid( .". $phpbb_root_path ."album_page.php?pic_id=" . $row['pic_id'] . ) ."'><img alt='" . $row['pic_desc'] . "' src='". $phpbb_root_path ."album_thumbnail.php?pic_id=" . $row['pic_id'] . "'></a>
Verfasst: 15.09.2005 15:36
von Martin Truckenbrodt
Hallo fanrpg,
Parse error: parse error, unexpected '.', expecting ')' in /homepages/23/d127406072/htdocs/www/cgi/phpBB2/album_mod/album_randompic.php on line 20
Gruß Martin
Verfasst: 15.09.2005 15:47
von Martin Truckenbrodt
Hallo,
ich schaffe es irgendwie nicht die Informationen zu append_sid unter
http://www.phpbb.de/doku/kb/artikel.php?artikel=72 sinnvoll zu verwenden.
Gruß Martin
Verfasst: 15.09.2005 15:54
von easygo
Versuchs mal so -->
Code: Alles auswählen
<a href='". append_sid($phpbb_root_path ."album_page.php?pic_id=" . $row['pic_id']) ."'><img alt='" . $row['pic_desc'] . "' src='". $phpbb_root_path ."album_thumbnail.php?pic_id=" . $row['pic_id'] . "'></a>
Verfasst: 15.09.2005 15:56
von fanrpg
Code: Alles auswählen
<?
define('IN_PHPBB', true);
$phpbb_root_path = './cgi/phpBB2/'; //set the setting correct - I have put the file into admin_mod subfolder
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
print "<table>";
print "<tr><th colspan='3'>zufällige Fotos aus der Fotogalerie</th></tr>"; // make your own text
print "<TR>";
for ($i=0;$i<3;$i++) //set number of pictures for the displayed line
{
$sql="SELECT pic_id, pic_title, pic_desc FROM ". ALBUM_TABLE ." ORDER BY RAND() LIMIT 1";
$result = mysql_query($sql) or die;
$row = mysql_fetch_array($result);
print "<TD valign='top'><TABLE><TR><TD class='klein' align='center'>" . $row['pic_title'] . "<BR></TD></TR><TR><td align='center'><a href='". append_sid( . $phpbb_root_path ."album_page.php?pic_id=" . $row['pic_id'] . ) ."'><img alt='" . $row['pic_desc'] . "' src='". $phpbb_root_path ."album_thumbnail.php?pic_id=" . $row['pic_id'] . "'></a></td></TR></TABLE></TD>";
}
print "</TR>";
print "</table>";
?>
EDIT: easygo du bist schlimm >.<
Verfasst: 15.09.2005 16:00
von easygo
Jaja...

Verfasst: 15.09.2005 16:10
von Martin Truckenbrodt
easygo hat geschrieben:Versuchs mal so -->
Code: Alles auswählen
<a href='". append_sid($phpbb_root_path ."album_page.php?pic_id=" . $row['pic_id']) ."'><img alt='" . $row['pic_desc'] . "' src='". $phpbb_root_path ."album_thumbnail.php?pic_id=" . $row['pic_id'] . "'></a>
Hallo easygo,
scheint zu passen.
fanrpg's ging schon wieder nicht! Böser!
Gruß Martin
Verfasst: 15.09.2005 16:18
von fanrpg
war ein Punkt zu viel >.<