模仿OSO的论坛(二)
程序员文章站
2022-12-26 08:32:32
read.php(用来显示相关主题内容) 疑难问题
read.php(用来显示相关主题内容)
<html><head><title>疑难问题</title>
<link href="mypic/style.css" rel=stylesheet type=text/css></head>
<body bgcolor=#cccc99 bottommargin=0 leftmargin=0 topmargin=0 marginwidth="0" marginheight="0">
<table border=0 cellpadding=0 cellspacing=0 width="100%" class=body_br >
<tbody>
<tr>
<td valign=top><br>
<table align=center border=0 cellpadding=3 cellspacing=0 width=100%>
<tbody>
<td>主 题:<font class=mid
color=#993333><b>
<?php
include "connect.inc.php";
$query = "select * from guestbook where id=".$theme_id;
$res = mysql_query($query);
$row = mysql_fetch_array($res);
echo $row['theme'];
?>
</b></font></td></tr><tr>
<td align=middle valign=top width=100%><a
href="post.php"><img
border=0 src="mypic/post.gif"></a>
<a href="reply.php?theme_id=<?php echo $row['id'] ?>"><img
border=0
src="mypic/reply.gif"></a> <a
href="faq.php?page=1"><img
border=0
src="mypic/theme.gif"></a></td></tr>
<?php
if ($row['answer_count']>5)
{echo "<tr> <td>分 页:<font class=mid >";
for ($j=1;$j<=($row['answer_count']-1)/5+1;$j++) {
if ($j==$page) echo "<font color=#999999> [".$j."]</font> </a>";
else echo "<a href='read.php?theme_id=".$row['id']."&page=".$j."'[".$j."]</font> </a>";
}}
echo " 共有帖子".$row['answer_count']."个</td>";
$this_id=$row['id'];
$query = "select id from guestbook where id<".$this_id." and type=1 order by id desc";
$res = mysql_query($query);
$row = mysql_fetch_row($res);
$pre_id=$row[0];
$query = "select id from guestbook where id>".$this_id." and type=1 order by id";
$res = mysql_query($query);
$row = mysql_fetch_row($res);
$next_id=$row[0];
?>
</tr>
</tbody></table>
<table align=center border=0 cellpadding=4 cellspacing=2 width=100%>
<tbody>
<tr>
<td align=middle bgcolor=#6f6f6f width="20%"><font color=#ffffff>作
者</font></td>
<td align=middle bgcolor=#6f6f6f width="80%"><font color=#ffffff>内
容</font></td></tr>
<?php
$query = "select * from guestbook where main_id=".$theme_id." or id=".$theme_id." order by time_open desc limit ".strval(($page-1)*5).",5";
$res = mysql_query($query);
function tdbackcolor() {
static $colorstr;
if ($colorstr=="#ededed") {
$colorstr="#dedede";
} else {
$colorstr="#ededed";
}
return($colorstr);
}
for ($i=1;$i<=5;$i++)
{$row = @mysql_fetch_array($res);
if(!$row) break;
$colorstr=tdbackcolor();
echo "<tr>";
echo "<td align=middle bgcolor=".$colorstr." valign=top width='20%'><font";
echo "class=mid><b>";
echo $row['name']."</b></font></td>";
echo "<td bgcolor=".$colorstr." valign=top width='80%'>";
echo "<table border=0 cellpadding=0 cellspacing=0 width='100%'>";
echo "<tbody>";
echo "<tr>";
echo "<td align=middle width=30><img align=abscenter border=0";
echo " src='mypic/icon".$row['icon'].".gif'></td>";
echo "<td><font color=#336699>发表于: ".$row['time_open']."</font></td>";
echo "<td align=right></td></tr>";
echo "<tr>";
echo "<td colspan=3>";
echo "<hr size=1>";
echo "</td></tr></tbody></table>".$row['content']."</td></tr>";
echo "<tr>";
}
?>
<tr align=right bgcolor=#6f6f6f>
<td> </td>
<td><a
href="read.php?theme_id=<?php echo $pre_id?>&page=1"><font
color=#ffffff>上一个主题</font></a> <a
href="read.php?theme_id=<?php echo $next_id?>&page=1"><font
color=#ffffff>下一个主题</font></a> </td></tr></tbody></table>
<hr size=1 width=100%>
<br></td></tr>
</tbody></table>
</form>
</html>
<html><head><title>疑难问题</title>
<link href="mypic/style.css" rel=stylesheet type=text/css></head>
<body bgcolor=#cccc99 bottommargin=0 leftmargin=0 topmargin=0 marginwidth="0" marginheight="0">
<table border=0 cellpadding=0 cellspacing=0 width="100%" class=body_br >
<tbody>
<tr>
<td valign=top><br>
<table align=center border=0 cellpadding=3 cellspacing=0 width=100%>
<tbody>
<td>主 题:<font class=mid
color=#993333><b>
<?php
include "connect.inc.php";
$query = "select * from guestbook where id=".$theme_id;
$res = mysql_query($query);
$row = mysql_fetch_array($res);
echo $row['theme'];
?>
</b></font></td></tr><tr>
<td align=middle valign=top width=100%><a
href="post.php"><img
border=0 src="mypic/post.gif"></a>
<a href="reply.php?theme_id=<?php echo $row['id'] ?>"><img
border=0
src="mypic/reply.gif"></a> <a
href="faq.php?page=1"><img
border=0
src="mypic/theme.gif"></a></td></tr>
<?php
if ($row['answer_count']>5)
{echo "<tr> <td>分 页:<font class=mid >";
for ($j=1;$j<=($row['answer_count']-1)/5+1;$j++) {
if ($j==$page) echo "<font color=#999999> [".$j."]</font> </a>";
else echo "<a href='read.php?theme_id=".$row['id']."&page=".$j."'[".$j."]</font> </a>";
}}
echo " 共有帖子".$row['answer_count']."个</td>";
$this_id=$row['id'];
$query = "select id from guestbook where id<".$this_id." and type=1 order by id desc";
$res = mysql_query($query);
$row = mysql_fetch_row($res);
$pre_id=$row[0];
$query = "select id from guestbook where id>".$this_id." and type=1 order by id";
$res = mysql_query($query);
$row = mysql_fetch_row($res);
$next_id=$row[0];
?>
</tr>
</tbody></table>
<table align=center border=0 cellpadding=4 cellspacing=2 width=100%>
<tbody>
<tr>
<td align=middle bgcolor=#6f6f6f width="20%"><font color=#ffffff>作
者</font></td>
<td align=middle bgcolor=#6f6f6f width="80%"><font color=#ffffff>内
容</font></td></tr>
<?php
$query = "select * from guestbook where main_id=".$theme_id." or id=".$theme_id." order by time_open desc limit ".strval(($page-1)*5).",5";
$res = mysql_query($query);
function tdbackcolor() {
static $colorstr;
if ($colorstr=="#ededed") {
$colorstr="#dedede";
} else {
$colorstr="#ededed";
}
return($colorstr);
}
for ($i=1;$i<=5;$i++)
{$row = @mysql_fetch_array($res);
if(!$row) break;
$colorstr=tdbackcolor();
echo "<tr>";
echo "<td align=middle bgcolor=".$colorstr." valign=top width='20%'><font";
echo "class=mid><b>";
echo $row['name']."</b></font></td>";
echo "<td bgcolor=".$colorstr." valign=top width='80%'>";
echo "<table border=0 cellpadding=0 cellspacing=0 width='100%'>";
echo "<tbody>";
echo "<tr>";
echo "<td align=middle width=30><img align=abscenter border=0";
echo " src='mypic/icon".$row['icon'].".gif'></td>";
echo "<td><font color=#336699>发表于: ".$row['time_open']."</font></td>";
echo "<td align=right></td></tr>";
echo "<tr>";
echo "<td colspan=3>";
echo "<hr size=1>";
echo "</td></tr></tbody></table>".$row['content']."</td></tr>";
echo "<tr>";
}
?>
<tr align=right bgcolor=#6f6f6f>
<td> </td>
<td><a
href="read.php?theme_id=<?php echo $pre_id?>&page=1"><font
color=#ffffff>上一个主题</font></a> <a
href="read.php?theme_id=<?php echo $next_id?>&page=1"><font
color=#ffffff>下一个主题</font></a> </td></tr></tbody></table>
<hr size=1 width=100%>
<br></td></tr>
</tbody></table>
</form>
</html>
上一篇: ip签名探针
下一篇: python计算机基础(一)