?? forum_fl.php
字號:
<?php
session_start();
include "middle.php";
require_once "../MessageBox.php";
$Message = new MessageBox;
if ( !empty($_SESSION["userid"]) ) {
include "../datasource.inc.php";
$page = $_REQUEST['page'];
$id = $_REQUEST['id'];
$action = $_REQUEST['action'];
$body = str_replace("\n", "<BR>", $_REQUEST['body']);
if ($action == 'add') {
$sql = "insert into forum_fl (id,title,body) values ('','$_REQUEST[title]','$body');";
$result = mysql_query($sql);
$Message->setMessage("添加成功!","forum_fl.php");
$Message->showMessage();
}
if ($_REQUEST['action'] == 'update') {
$sql = "update forum_fl set title='$_REQUEST[title]',body='$body' where id='$id';";
$result = mysql_query($sql);
$Message->setMessage("編輯成功!","forum_fl.php");
$Message->showMessage();
}
?>
<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> 您當(dāng)前的位置<BR> <IMG
height=15 src="../images/bar.gif" width=15> <IMG height=14
src="../images/openfold.gif" width=14> 論壇分類管理</FONT></TD>
</tr>
</table>
<table width=766 cellpadding=0 cellspacing=0 border=0 align=right>
<tr><td width=766 height=1 bgcolor=#3494d4></td>
</table>
<script language=javascript>
function check_input()
{
if (document.form.title.value=='') {
alert("請輸入分類名稱!");
return false;
}
if (document.form.body.value=='') {
alert("請輸入分類介紹!");
return false;
}
return true;
}
</script>
<br>
<div align="right"><a href=forum_fl.php?page=add>添加分類</a></div>
<?php
if ($_SESSION['userjs']=="1") {
echo "<div align=center><a href=job_download.php?page=add>添加文檔</a> <a href=job_download.php>瀏覽文檔</a> <a href=forum_fl.php?page=add>添加分類</a> <a href=forum_fl.php>分類管理</a></div>";
}
switch ($page){
case "add":
?>
<center>
<form enctype="multipart/form-data" name=form method="post" action="forum_fl.php" onsubmit="return check_input()">
<table border=0 cellpadding=0 cellspacing=0 width=776>
<tr><td width=10 bgcolor=#ffffff> </td>
<td><table border=0 cellpadding=0 cellspacing=1 bgcolor=#3494d4 width=766>
<tr>
<td width="15%" bgColor=#ffffff align=center><center><b>分類名稱</b></center></td>
<td width="85%" bgcolor=ffffff>
<input type="text" size="30" name="title" maxlength="28">
</td>
</tr>
<tr>
<td width="15%" bgColor=#ffffff align=center><center><b>分類介紹</b></center></td>
<td width="85%" bgcolor=ffffff>
<textarea name="body" cols="40" rows="8"></textarea> </td>
</tr>
</table></td></table><br>
<input type="hidden" value="add" name="action">
<input type="submit" name="submit" value=" 確 定 "> <input type="reset" name="submit1" value=" 重 置 ">
</form>
</center>
<?
break;
case "delete":
$query = "delete from forum_fl where id='$id';";
mysql_query($query);
$Message->setMessage("刪除成功!","forum_fl.php");
$Message->showMessage();
break;
case "update":
$sql = "select * from forum_fl where id='$id';";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
$id = $row['id'];
$name = $row['name'];
$body = str_replace("<BR>", "\n", $row['body']);
?>
<form name=form method="post" action="forum_fl.php" onsubmit="return check_input()">
<center>
<table border=0 cellpadding=0 cellspacing=0 width=776>
<tr><td width=10 bgcolor=#ffffff> </td>
<td><table border=0 cellpadding=0 cellspacing=1 bgcolor=#3494d4 width=766>
</tr>
<td width="15%" bgColor=#ffffff align=center><center><b>分類名稱</b></center></td>
<td width="85%" bgcolor=ffffff>
<?php
echo "<input type=text size=30 name=title maxlength=28 value=\"$row[title]\">";
?>
</td>
</tr>
<tr>
<td width="15%" bgColor=#ffffff align=center><center><b>分類介紹</b></center></td>
<td width="85%" bgcolor=ffffff>
<textarea name="body" cols="40" rows="8"><?php echo $body;?>
</textarea>
</td>
</tr>
</table></td></table><br>
<input type="hidden" value="update" name="action">
<?php echo "<input type=hidden name=id value=$id>"; ?>
<input type="hidden" name="MAX_FILE_SIZE" value="1000000">
<input type="submit" name="submit" value=" 確 定 "> <input type="reset" name="submit1" value=" 重 置 ">
</form>
</center>
<?php
break;
default:
$sql = "select * from forum_fl order by id asc;";
$result = mysql_query($sql);
$num = mysql_num_rows($result);
if ( $num>0 ){
$last = intval(($num-1)/20)+1;
if ( $page < 1 ) $page=1;
if ( $page > $last ) $page=$last;
mysql_data_seek($result,($page-1)*20);
echo "<center><br>";
echo "<table border=0 cellpadding=0 cellspacing=0 width=776>";
echo "<tr><td width=10 bgcolor=#ffffff> </td>";
echo "<td><table border=0 cellpadding=0 cellspacing=1 bgcolor=#3494d4 width=766>";
echo "<tr>";
echo "<td width=450 height=24 bgColor=#3494d4><div align=center><font color=#ffffff><b>分類</b></font></div></td>";
echo "<td width=158 height=24 bgColor=#3494d4><div align=center><font color=#ffffff><b>編輯</b></font></div></td>";
echo "<td width=158 height=24 bgColor=#3494d4><div align=center><font color=#ffffff><b>刪除</b></font></div></td>";
echo "</tr>";
for ( $i=0;$i<20;$i++ ) {
$row = mysql_fetch_array($result);
$id = $row['id'];
$body = substr($row['body'],0,30);
if ( $id ) {
echo "<tr bgColor=#ffffff>";
echo "<td width=450 height=18 bgColor=#ffffff><div align=center>$row[title]</div></td>";
echo "<td width=158 height=18 bgColor=#ffffff><div align=center><a title=點(diǎn)擊編輯內(nèi)容 href=forum_fl.php?page=update&id=$row[id]><img src=../images/editicon.gif border=0></a></div></td>";
echo "<td width=158 height=18 bgColor=#ffffff><div align=center><a title=點(diǎn)擊刪除本條記錄 href=forum_fl.php?page=delete&id=$row[id] onclick=\"return confirm('確定要刪除嗎?')\"><img src=../images/clearicon.gif border=0></a></div></td>";
echo "</tr>";
}
}
echo "</table></td></table><br>";
echo "<table width=500 border=0 cellspacing=0 cellpadding=0 height=24>";
echo "<tbody>";
echo "<tr><td><center>";
echo "總共找到<font color=red>$num</font>條記錄,第<font color=red>$page</font>頁,共<font color=red>$last</font>頁。";
echo "</center></td></tr><tr>";
if ( $page <> 1 ) {
echo "<td align=center> <a href=forum_fl.php?page=1>第一頁</a></td>";
echo "<td align=center><a href=forum_fl.php?page=".($page-1).">上一頁</a></td>";
}
if ( $page <> $last ) {
echo "<td align=center><a href=forum_fl.php?page=".($page+1).">下一頁</a></td>";
echo "<td align=center><a href=forum_fl.php?page=$last>最后一頁</a></td>";
}
echo "</tbody>";
echo "</tr>";
echo "</table><br>";
echo "</center>";
} else {
echo "<center>對不起,您還沒有添加記錄,<a href=forum_fl.php?page=add>我要添加</a>!</center>";
}
break;
}
} else {
$Message->setMessage("對不起,您沒有權(quán)限進(jìn)入后臺管理!","index.php");
$Message->showMessage();
}
?>
</td>
<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"></td>
</tr>
</table>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -