Hey,
Ich wieder.
Habe jetzt das Script weiter gemacht und stosse jetzt auf einmal auf eine unschöne Sache.
Siehe Bild
Ich wieder.
![Big Grin](https://www.php-resource.de/forum/core/images/smilies/biggrin.gif)
Habe jetzt das Script weiter gemacht und stosse jetzt auf einmal auf eine unschöne Sache.
Siehe Bild
PHP-Code:
<?php
include_once("../inc/db_data.inc.php");
include_once("../inc/function.inc.php");
include_once("../inc/db.inc.php");
if($forumid == h)
{
header("Location: index.php");
}
function getmicrotime()
{
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
$startzeit = getmicrotime(); //Anfang der Zeitmessung
$t_gif = "<img src=\"images/forum/t.gif\" width=\"12\" height=\"21\" border=\"0\" align=\"top\">";
$l_gif = "<img src=\"images/forum/l.gif\" width=\"12\" height=\"21\" border=\"0\" align=\"top\">";
$m_gif = "<img src=\"images/forum/m.gif\" width=\"9\" height=\"21\" border=\"0\" align=\"top\">";
$c_gif = "<img src=\"images/forum/c.gif\" width=\"9\" height=\"21\" border=\"0\" align=\"top\">";
$i_gif = "<img src=\"images/forum/i.gif\" width=\"12\" height=\"21\" border=\"0\" align=\"top\">";
$n_gif = "<img src=\"images/forum/n.gif\" width=\"9\" height=\"21\" border=\"0\" align=\"top\">";
$space_gif = "<img src=\"images/forum/trans.gif\" width=\"12\" height=\"21\" border=\"0\" align=\"top\">";
$s_gif = "<img src=\"images/forum/trans.gif\" width=\"5\" height=\"21\" border=\"0\" align=\"top\">";
$key_gif = "<img src=\"images/symbole/key.gif\" alt=\"Betrage geschlossen\">";
?>
<html>
<head>
<meta http-equiv="Content-Language" content="de">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="PFE 32">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<title>Forum by Webdesign - CCT</title>
<style>
<?php
if(file_exists("../inc/forum.css")){
include "../inc/forum.css";
}
?>
</style>
</head>
<body>
<?php
include("header/header_home.php");
?>
<?php
$table = forum_post;
forum1($forumid);
while($forum_row = mysql_fetch_array($forum))
{
?>
<table>
<tr>
<td><font class="navigation"><a href="index.php">Frettchen-Club Berlin e.V.</a> => <a href="forum.php?forumid=<?php echo"$forumid";?>"><?php echo"$forum_row[forum_name]";?></a></font></td>
</tr>
</table>
<?php
}
include_once("header/log.inc.php");
include_once("header/thema.inc.php");
?>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td colspan="2" width="68%" bgcolor="#000000"><font color="#FFFFFF"><b>Beitrag</b></font></td>
<td width="13%" bgcolor="#000000"><font color="#FFFFFF"><b>Author</b></font></td>
<td width="19%" bgcolor="#000000"><font color="#FFFFFF"><b>Datum</b></font></td>
</tr>
<?php
function output_threaded ($forumid, $parent, $level,$offset)
{
global $d_prev, $d_next,$d_off,$d_diff;
global $table,$forumid;
global $t_gif,$l_gif,$p_gif,$m_gif,$c_gif,$i_gif,$n_gif,$space_gif,$s_gif,$key_gif;
static $letztes = array();
static $row_color_cnt=0;
if (!$offset || $offset<0) $offset = 0;
$diff = 4;
$rev = mysql_query("SELECT count(*) FROM $table WHERE post_parent='0' AND post_forumid='$forumid'");
$sql_id = mysql_query ("SELECT a.*, count(b.id) AS hatantwort FROM $table AS a LEFT JOIN $table AS b ON b.post_parent=a.id WHERE a.post_forumid='$forumid' AND a.post_parent='$parent' GROUP BY a.id ORDER BY a.post_date DESC LIMIT $offset,$diff")or die(mysql_error());
$n = mysql_num_rows($sql_id);
$anz = mysql_result($rev,0);
if (!$offset || $offset<0) { $offset = 0; $disabled[prev] = TRUE; }
if (($offset + $diff) >= $anz) {$diff = $anz - $offset;$disabled[next] = TRUE; }
$letztes[$level-1] = $n;
for ($count=0; $msg = mysql_fetch_assoc($sql_id); $count++)
{
if(($row_color_cnt%2)==0)// Farbwechsler
{
$bg="#dfdfdf";
}
else
{
$bg="#cfcfcf";
}
$row_color_cnt++;
echo "<tr>
<td bgcolor=\"$bg\" width=\"1%\">";
if($msg[post_close] == 1 && $msg[post_parent] == 0)
{
echo"$key_gif";
}
else
{
echo"$s_gif";
}
echo"</td>
<td bgcolor=\"$bg\">";
for ($m=0; $m<$level-1; $m++)
{
if (!$letztes[$m])
{
echo $space_gif;
}
else
{
if($letztes[$m]==1)
{
echo $space_gif;
}
else
{
echo $i_gif;
}
}
}
if ($m<$level)
{
if ($letztes[$m]==1)
{
echo ($l_gif);
}
else
{
echo ($t_gif);
}
}
if ($msg["hatantwort"])
{
echo $m_gif;
}
else
{
if ($level || !$count)
{
echo $c_gif;
}
else
{
echo $n_gif;
}
}
echo "<font> <a href=\"thread_see.php?forumid=".$forumid."&post_topic=".$msg[post_thread]."&post_id=".$msg[id]."\">".$msg["post_subject"]."</font></a></td>
<td bgcolor=\"$bg\"><font>";
$user = mysql_query("SELECT * FROM forum_user WHERE id='$msg[post_userid]'");
while($use =mysql_fetch_array($user))
{
echo $use["user_name"];
}
echo"</font></td><td bgcolor=\"$bg\"><font>".$msg["post_date"]."</font></td>
</tr>\n";
output_threaded ($forumid, $msg[id], $level+1,$tat);
$letztes[$level-1]--;
if (!$disabled[prev])
{
$d_prev = "1";
$d_off = "$offset";
$d_diff = "4";
}
else
{
$d_prev = "0";
$d_off = "$offset";
$d_diff = "4";
}
if (!$disabled[next])
{
$d_next = "1";
$d_off = "$offset";
$d_diff = "4";
}
else
{
$d_next = "0";
$d_off = "$offset";
$d_diff = "4";
}
}
}
output_threaded($forumid, 0, 0,$tat);
?>
</table>
<?php
//echo"$d_prev = d_prev<br>$d_next = d_next<br>$d_off = d_off<br>$d_diff = d_diff<br>";
?>
<table width="100%" cellspcaing="0" cellpadding="0">
<tr>
<td width="98%"> </td>
<td width="1%" algin="left">
<?php
if($d_prev == 1)
{
$tat =($d_off-$d_diff);
echo "<font><a href='forum.php?forumid=$forumid&tat=".$tat."'>Zurück</a></font> ";
}
?>
</td>
<td width="1%" algin="left">
<?php
if($d_next == 1)
{
$tat =($d_off+$d_diff);
echo "<font><a href='forum.php?forumid=$forumid&tat=".$tat."'>Weiter</a></font>";
}
?>
</td>
</tr>
</table>
<table width="100%" border="0">
<tr>
<form action="forum.php" methode="POST">
<td width="1%"><select name="forumid" size="1" onchange="window.location=('forum.php?forumid='+this.options[this.selectedIndex].value)">
<option value="h">Startseite</option>
<option value="">--------------------</option>
<?php
cat();
while($cat_row = mysql_fetch_array($cat))
{
echo"<option value=\"h\">$cat_row[cat_name]</option>\n";
forum($cat_row[id]);
while($forum_row = mysql_fetch_array($forum))
{
echo"<option value=\"$forum_row[id]\"";
if($forumid == $forum_row[id])
{
echo" selected ";
}
echo"> --> $forum_row[forum_name]</option>\n";
}
}
?>
</select></td>
<td width="1%"> <input type="image" src="images/button/go.gif" border="0"></td>
<td width="98%"> </td>
</form>
</tr>
</table>
<?php
@include_once("header/footer.inc.php");
?>
<br><br>
<?php
(float)$dauer = getmicrotime() - $startzeit; //Ende der Zeitmessung
$aus = round($dauer,4);
echo "<font class=\"seitenzeit\"><center>Der Seitenaufbau hat $aus Sekunden gedauert</center></font>"; //Beispielausgabe
?>
</body>
</html>
Kommentar