<?php
session_start();
include "header.html";
require_once "../MessageBox.php";
include "../datasource.inc.php";
include "../Function.php";
$Message = new MessageBox;
if ( empty($_SESSION["usernumber"]) and $_SESSION["userjs"] != "1") {
    $Message->setMessage("对不起，您没有权限进入后台管理!","logout.php");
	$Message->showMessage();
	EXIT;
}
$body  = $_REQUEST['body'];
if ( $_REQUEST['action00'] == 'add' && !empty($body)) {
	$sql     = "insert into webinfo values ('','$_REQUEST[action]','$body')";
	$result  = mysql_query($sql);
	$Message->setMessage("添加成功!","about.php?action=$_REQUEST[action]");
	$Message->showMessage();
}
if ( $_REQUEST['action00'] == 'update') {
	$sql         = "update webinfo set body='$body' where id='$_REQUEST[id]'";
    $result  = mysql_query($sql);
    $Message->setMessage("编辑成功!","about.php?action=$_REQUEST[action]");
	$Message->showMessage();
}
?>
<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>&nbsp;&nbsp;您当前的位置<BR><IMG
      height=15 src="../images/bar.gif" width=15><IMG height=14
      src="../images/openfold.gif" width=14>&nbsp;&nbsp;<?php echo $_REQUEST['action']?>管理</FONT></TD>
        </tr>
</table>
<?php
$sql     = "select * from webinfo where fl='$_REQUEST[action]' order by id desc";
$result  = mysql_query($sql);
$row     = mysql_fetch_array($result);
$body    = str_replace("<BR>", "\n", $row['body']);
if ( $row['id']) {
	echo "<p align=center><font size=3><b>修改 $_REQUEST[action]</b></font></p>";
	echo "<form name=form  method=\"post\" action=\"about.php?action00=update\">";
} else {
	echo "<p align=center><font size=3><b>填写 $_REQUEST[action]</b></font></p>";
	echo "<form name=form  method=\"post\" action=\"about.php?action00=add\">";
}
?>
<table border=0 cellpadding=0 cellspacing=1 bgcolor=#6795B4 width=750 align=center>
  <tr>
    <td><textarea name="body" style="display:none"><? echo $row['body']?></textarea><iframe id="body___Frame" src="../fckeditor/editor/fckeditor.html?InstanceName=body&amp;Toolbar=Basic" width="760px" height="560px" frameborder="0" scrolling="no"></iframe></td>
  </tr>
</table>
<?php echo "<input type=hidden name=\"action\"  value=\"$_REQUEST[action]\">"; ?>
<?php echo "<input type=hidden name=\"id\"  value=\"$row[id]\">"; ?>
<center><input type="submit" value="提 交">&nbsp;&nbsp;<input type="reset" value="取 消"></center>
</form>
