<?php
$forum = 0;
$count = 0;
$threadid = 0;
$threadname = 0;
if(isset($_GET["f"]))
{
$forum = $_GET["f"];
}
if(isset($_GET["t"]))
{
$sql = "SELECT forumid, threadtitel FROM forenthreads WHERE threadid = ".$_GET["t"].";";
$resource = mysql_query($sql) or die (mysql_error());
$data = mysql_fetch_array($resource);
$forum = $data[0];
mysql_free_result($resource);
$threadid = $_GET["t"];
$threadname = $data[1];
}
if(isset($_GET["p"]))
{
$sql = "SELECT threadid FROM forenposts WHERE postid = ".$_GET["p"];
$resource = mysql_query($sql) or die (mysql_error());
$thread = mysql_fetch_array($resource);
$sql = "SELECT forumid, threadtitel FROM forenthreads WHERE threadid = ".$thread[0].";";
$resource = mysql_query($sql) or die (mysql_error());
$data = mysql_fetch_array($resource);
$forum = $data[0];
mysql_free_result($resource);
$threadid = $thread[0];
$threadname = $data[1];
}
if($forum > 0)
{
$sql = "SELECT forumid, forumname, parentforumid FROM foren WHERE forumid = ".$forum.";";
$result_parent = mysql_query($sql) or die("Error: " . mysql_error());
$forumid = mysql_fetch_array($result_parent);
$breadcrumb[$count][0] = $forumid[0];
$breadcrumb[$count][1] = $forumid[1];
$breadcrumb[$count][2] = $forumid[2];
mysql_free_result($result_parent);
while($breadcrumb[$count][2] != 0)
{
$sql = "SELECT forumid, forumname, parentforumid FROM foren WHERE forumid = ".$breadcrumb[$count][2].";";
$result_parent = mysql_query($sql) or die("Error: " . mysql_error());
$parent = mysql_fetch_array($result_parent);
$count++;
$breadcrumb[$count][0] = $parent[0];
$breadcrumb[$count][1] = $parent[1];
$breadcrumb[$count][2] = $parent[2];
mysql_free_result($result_parent);
}
echo '<table border="0" cellspacing="0" cellpadding="2" width="100%" class="forum"><tr>
<td colspan="5" id="forum-breadcrumb"><a href="index.php?nid='.$nid.'">Forum Home</a>';
for($i = count($breadcrumb)-1; $i >= 0; $i--)
{
if($i == 0 && $threadid == 0 && !isset($_GET["new"]))
{
echo '<br> > <a href="index.php?nid='.$nid.'&f='.$breadcrumb[$i][0].'">'.$breadcrumb[$i][1].'</a>';
}
else
{
echo ' > <a href="index.php?nid='.$nid.'&f='.$breadcrumb[$i][0].'">'.$breadcrumb[$i][1].'</a>';
}
}
if(isset($_GET["new"]))
{
if(isset($_GET["f"]))
echo '<br> > Neues Thema';
if(isset($_GET["t"]))
echo ' > <a href="index.php?nid='.$nid.'&t='.$threadid.'">'.$threadname.'</a><br> > Neuer Beitrag';
}
else if(isset($_GET["t"]))
{
echo '<br> > <a href="index.php?nid='.$nid.'&t='.$threadid.'">'.$threadname.'</a>';
}
else if(isset($_GET["p"]))
{
echo ' > <a href="index.php?nid='.$nid.'&t='.$threadid.'">'.$threadname.'</a><br> > Beitrag editieren';
}
echo '</td>
</tr>';
}
?>