?? forum.php
字號:
<?
session_start();
include "middle.php";
require_once "../MessageBox.php";
$Message = new MessageBox;
$datetime = date("Y-m-j h:i:s");
if ( !empty($_SESSION["userid"]) ) {
include "../datasource.inc.php";
?>
<link href="../css/a1.css" rel="stylesheet" type="text/css">
<body leftmargin="0" topmargin="0">
<table width="789" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2"><img src="../images/home_12.jpg" width="789" height="12"></td>
</tr>
<tr>
<td width="776" valign="top">
<table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<TD vAlign=top><FONT color=#565656> <IMG height=14
src="../images/closedfold.gif" width=14> 您當前的位置<BR> <IMG
height=15 src="../images/bar.gif" width=15> <IMG height=14
src="../images/openfold.gif" width=14> 內部交流中心</FONT></TD>
</tr>
</table>
<table border=0 cellpadding=0 cellspacing=0 width=766 align="right">
<tr><td width=766 height=0 bgcolor=#3494d4></td>
</tr>
</table><br>
<table width="776" border="0" cellpadding="0" cellspacing="0" align="right">
<tr><td width=10 bgcolor=#ffffff> </td>
<td><table width=766 border=0 cellpadding=0 cellspacing=0>
<tr>
<td width="766" valign="top">
<table width="766" height="18" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<?php
if (!empty($_REQUEST['forum_fl']) or !empty($_REQUEST['forum_id']) or !empty($_REQUEST['text'])) {
if (!empty($_REQUEST['forum_id'])) {
$_SESSION['forum_id'] = $_REQUEST['forum_id'];
}
if (!empty($_REQUEST['forum_fl'])) {
$_SESSION['forum_fl'] = $_REQUEST['forum_fl'];
}
if (!$_REQUEST['text']) {
echo "<table width=766 border=0 cellpadding=0 cellspacing=0><tr><td><font color=478CB6 size=4><b>版塊:$_SESSION[forum_fl]</b></font></td></tr></table>";
?>
<table width="766" border="0" cellspacing=0 cellpadding=0>
<tr>
<td>
<?php
echo "<a href=forum.php?forum_fl=$_SESSION[forum_fl]&forum_id=$_SESSION[forum_id]&id=$_REQUEST[id]&forum=add><img src=../images/forum_send.jpg border=0></a>";
//echo "<a href=forum.php?forum_fl=$_SESSION[forum_fl]&text=$_REQUEST[id]&forum=return&id=$_REQUEST[id]><img src=../images/forum_return.jpg border=0></a>";
?>
</td>
</tr>
</table>
<table width="766" border="0" cellpadding=0 cellspacing=1 bgcolor=#3494d4>
<tr height=24>
<td width="280" align="center" bgcolor=#3494d4><font color=#ffffff><strong>主題</strong></font></td>
<td width="80" align="center" bgcolor=#3494d4><font color=#ffffff><strong>回覆</strong></font></td>
<td width="106" align="center" bgcolor=#3494d4><font color=#ffffff><strong>發表人</strong></font></td>
<!-- <td width="49" align="center" bgcolor=#0872A6><font color=#FEA348><strong>觀看</strong></font></td>-->
<td width="300" align="center" bgcolor=#3494d4><font color=#ffffff><strong>最后發表</strong></font></td>
</tr>
<?php
}
if ($_REQUEST['action']=="add") {
$commet = str_replace("\n", "<BR>", $_REQUEST['commet']);
$sql = "insert into forum (id,forum_id,name,title,datetime,commet) values ('','$_REQUEST[forum_id]','$_REQUEST[name]','$_REQUEST[title]','$datetime','$commet');";
$result = mysql_query($sql);
}
if ($_REQUEST['text']) {
if ($_REQUEST['action']=="return") {
$commet = str_replace("\n", "<BR>", $_REQUEST['commet']);
$sql = "insert into forum_return (id,forum_id,name,commet,datetime) values ('','$_REQUEST[id]','$_REQUEST[name]','$commet','$datetime');";
$result = mysql_query($sql);
}
$sql = "select * from forum where id='$_REQUEST[id]' order by id desc;";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
$commet = str_replace("\n", "<BR>", $row['commet']);
?>
<table width="240" border="0">
<tr>
<td>
<?php
echo "<a href=forum.php?forum_fl=$_SESSION[forum_fl]&forum_id=$_SESSION[forum_id]&id=$_REQUEST[id]&forum=add><img src=../images/forum_send.jpg border=0></a>";
echo "<a href=forum.php?forum_fl=$_SESSION[forum_fl]&text=$_REQUEST[id]&forum=return&id=$_REQUEST[id]><img src=../images/forum_return.jpg border=0></a>";
?>
</td>
</tr>
</table>
<table width="766" border="0" bgcolor=#3494d4 cellpadding=0 cellspacing=1>
<tr height=24>
<td width="266" align="center" bgcolor=#3494d4><font color=#ffffff><strong>發表人</strong></font></td>
<td width="500" align="center" bgcolor=#3494d4><font color=#ffffff><strong>內容</strong></font></td>
</tr>
<tr height=80>
<td width="266" align="center" bgcolor=#ffffff><?php echo $row['name']; ?></td>
<td width="500" valign="top" bgcolor=#ffffff>
<?php
echo "發表于:";
echo $row['datetime'];
echo "<br><hr>";
echo $commet;
?>
</td>
</tr>
<?php
$sql1 = "select * from forum_return where forum_id='$_REQUEST[id]' order by id desc;";
$result1 = mysql_query($sql1);
while ( $row1 = mysql_fetch_array($result1) ) {
$commet = str_replace("\n", "<BR>", $row1['commet']);
?>
<tr height=80>
<td width="266" align="center" bgcolor=#ffffff><?php echo $row1['name']; ?></td>
<td width="500" valign="top" bgcolor=#ffffff>
<?php
echo "發表于:";
echo $row1['datetime'];
echo "<br><hr>";
echo $commet;
?>
</td>
</tr>
<?php
}
?>
</table>
<?php
} else {
$sql = "select * from forum where forum_id='$_SESSION[forum_id]' order by id desc;";
$result = mysql_query($sql);
$num = mysql_num_rows($result);
if ( $num>0 ){
$last = intval(($num-1)/10)+1;
if ( $page < 1 ) $page=1;
if ( $page > $last ) $page=$last;
mysql_data_seek($result,($page-1)*10);
for ($i=0;$i<10;$i++) {
$row = mysql_fetch_array($result);
$commet = str_replace("<BR>", "\n", $row['commet']);
if ($row['id']){
$sql1 = "select * from forum_return where forum_id='$row[id]' order by id desc;";
$result1 = mysql_query($sql1);
$num1 = mysql_num_rows($result1);
/*
while ( $row1 = mysql_fetch_array($result1)) {
}*/
echo "<tr>";
//echo "<td> </td>";
echo "<td bgcolor=ffffff align=center><a href=forum.php?forum_fl=$row[title]&id=$row[id]&text=$row[id]><font color=478CB6 size=3><b>$row[title]</b></font></a></td>";
echo "<td bgcolor=ffffff align=center>$num1</td>";
echo "<td bgcolor=ffffff align=center>$row[name]</td>";
//echo "<td bgcolor=DEE3E7>$row[a]</td>";
echo "<td bgcolor=ffffff align=center>$row[datetime]</td>";
echo "</tr>";
}
}
} else {
echo "<div align=center>對不起,沒有找到相關記錄!</div>";
}
}
if ( $_REQUEST['forum'] == "add" ) {
echo "<form action=forum.php method=post name=form1 onsubmit=\"return form1_onsubmit()\">";
echo "<table width=766 cellpadding=0 border=0 cellspacing=1 height=120 bgcolor=#3494d4>";
echo "<tr><td width=278 bgcolor=#ffffff align=center>發表人</td><td bgcolor=#ffffff> <input type=text name=name size=40 value=$_SESSION[userid]></td></tr>";
echo "<tr><td bgcolor=#ffffff align=center>主題</td><td bgcolor=#ffffff> <input type=text name=title size=40></td></tr>";
echo "<tr><td bgcolor=#ffffff align=center>內容</td><td bgcolor=#ffffff> <textarea name=commet cols=40 rows=6></textarea></td></tr>";
echo "</table><br>";
echo "<table width=766 cellpadding=0 border=0 cellspacing=0>";
echo "<tr><td align=center>";
echo "<input type=submit value=\"發 表\"> <input type=reset value=\"重 置\"></td></tr>";
echo "</table>";
echo "<input type=hidden name=forum_id value=\"$_SESSION[forum_id]\">";
echo "<input type=hidden name=action value=add>";
echo "</form>";
}
if ( $_REQUEST['forum'] == "return" ) {
echo "<form action=forum.php method=post name=form1 onsubmit=\"return form1_onsubmit()\">";
echo "<br><table width=766 cellpadding=0 cellspacing=1 height=120 border=0 bgcolor=#3494d4>";
echo "<tr bgcolor=#ffffff><td width=266 bgcolor=#ffffff align=center>回覆人</td><td> <input type=text name=name size=40 value=$_SESSION[userid]></td></tr>";
echo "<tr bgcolor=#ffffff><td width=266 bgcolor=#ffffff align=center>內容</td><td> <textarea name=commet cols=40 rows=6></textarea></td></tr>";
echo "</table><br>";
echo "<table width=380 border=0 cellpadding=0 cellspacing=0 align=center>";
echo "<tr><td align=center>";
echo "<input type=submit value=\"回 覆\"> <input type=reset value=\"重 置\"></td></tr>";
echo "</table>";
echo "<input type=hidden name=forum_id value=\"$_SESSION[forum_id]\">";
echo "<input type=hidden name=id value=\"$row[id]\">";
echo "<input type=hidden name=action value=return>";
echo "<input type=hidden name=text value=\"$row[id]\">";
echo "</form>";
}
} else {
?>
<center>
<table width="766" border="0" align="right" cellpading=0 cellspacing="1" bgcolor=#3494d4>
<tr height=24>
<td width="400" align="center" bgcolor=#3494d4><font color=#ffffff><strong>版面</strong></font></td>
<td width="183" align="center" bgcolor=#3494d4><font color=#ffffff><strong>主題</strong></font></td>
<td width="183" align="center" bgcolor=#3494d4><font color=#ffffff><strong>文章</strong></font></td>
</tr>
<?php
$sql = "select * from forum_fl order by id desc;";
$result = mysql_query($sql);
$num = mysql_num_rows($result);
if ( $num>0 ){
$last = intval(($num-1)/10)+1;
if ( $page < 1 ) $page=1;
if ( $page > $last ) $page=$last;
mysql_data_seek($result,($page-1)*10);
for ($i=0;$i<10;$i++) {
$row = mysql_fetch_array($result);
$commet = str_replace("<BR>", "\n", $row['body']);
if ($row['id']){
$sql1 = "select * from forum where forum_id='$row[id]' order by id desc;";
$result1 = mysql_query($sql1);
$num1 = mysql_num_rows($result1);
echo "<tr>";
echo "<td bgcolor=ffffff><a href=forum.php?forum_id=$row[id]&forum_fl=$row[title]><font color=478CB6 size=3><b>$row[title]</b></font></a><br>$commet</td>";
echo "<td bgcolor=ffffff align=center>$num1</td>";
echo "<td bgcolor=ffffff align=center>$num1</td>";
}
}
} else {
echo "Sorry,No Found and record;";
}
}
?>
<?
if ($_REQUEST['forum'] == "return" or $_REQUEST['forum'] == "add" or $_REQUEST['text']) {
?>
</tr>
</table>
</center>
</td>
</tr>
</table>
</td></tr>
</table>
<?
} else {
?>
</tr>
</table>
</center>
</td>
</tr>
</table>
</td></tr></table>
</td></tr>
</table>
<?php
}
} else {
$Message->setMessage("對不起,您沒有權限進入后臺管理!","index.php");
$Message->showMessage();
}
?>
<td width="13" align="right" background="../images/home_16.jpg" height=457> </td>
</tr>
<tr>
<td height="8" colspan="2" valign="top"><img src="../images/home_24.jpg" width="789" height="8"></td>
</tr>
</table>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -