📄 edit.php
字号:
<?php
include 'check.php';
include 'include/config.php';
include 'include/para.php';
$page=$_GET['page'];
if (empty($page)) $page=1;
$pageUrl="index.php?page=".$page;
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>回复/编辑留言 - <?php echo $gb_name?></title>
<link href="include/css.css" rel="stylesheet" type="text/css">
</head>
<body>
<?php include 'include/head.php';?>
<?php
if(empty($_POST['ac'])){?>
<form name="form1" method="post" action="<?php $_SERVER['PHP_SELF']?>" onsubmit="return FrontPage_Form1_Validator(this)">
<table width="750" border="0" align="center" cellpadding="0" cellspacing="10" bgcolor="#FFFFFF">
<tr>
<td align="center">
<table width="97%" border="0" cellpadding="0" cellspacing="15" bgcolor="#EBF5FE">
<tr>
<td align="center" valign="top" bgcolor="#FFFFFF"><table width="100%" border="0" cellpadding="6" cellspacing="0" class="border2">
<tr>
<td><table width="100%" border="0" cellspacing="5" cellpadding="0">
<tr>
<td width="9%" align="center"><font color="#0066FF"><img src="images/i1.gif" width="36" height="36"></font></td>
<td width="91%" class="font16"><img src="images/edit.gif" width="142" height="28"></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<?php
$rs=$db->execute("select * from ".TABLE_PREFIX."guestbook where id=".$_GET["id"]);
if($db->num_rows($rs)!=0)
{
$rows=$db->fetch_array($rs);
$db->free_result($rs);
}
?>
<table width="100%" border="0" cellpadding="5" cellspacing="0">
<tr bgcolor="#F4FAFF">
<td colspan="2"><font color="#175CBB"><img src="images/icon_write.gif" width="16" height="16">
<?php echo $rows['username']?></font> <font color="#333333">于
<?php echo date("Y-m-d",strtotime($rows["systime"]));?>
发表留言:</font>
<?php if($rows['settop']!=0){?>
<img src="images/settop.gif" alt="该留言已被置顶">
<?php }?>
</td>
</tr>
<tr>
<td colspan="2">
<textarea name="content" cols="70" rows="9" id="content"><?php echo ereg_replace("<br> ","\n",ereg_replace(" "," ",$rows['content'])); ?></textarea>
<font color="#999999">*</font></td>
</tr>
<tr>
<td width="15%" align="right"><p><font color="#333333">管理员回复<br>
</font><font color="#333333">的内容:</font></p></td>
<td width="85%" height="50"><textarea name="reply" cols="50" rows="6" id="reply"><?php echo ereg_replace("<br> ","\n",ereg_replace(" "," ",$rows['reply'])); ?></textarea></td>
</tr>
<tr>
<td align="right"> <script language=JavaScript>
function FrontPage_Form1_Validator(theForm)
{
if (theForm.content.value == "")
{
alert("您不能将留言内容编辑为空!");
theForm.content.focus();
return (false);
}
return (true);
}
</script></td>
<td height="50" class="font14"> <input type="submit" name="Submit" value=" 提交 ">
<input name="ac" type="hidden" id="ac" value="reply">
<input name="id" type="hidden" id="id" value="<?php echo $_GET['id'];?>">
</td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<?php }else{?>
<table width="750" border="0" align="center" cellpadding="0" cellspacing="10" bgcolor="#FFFFFF">
<tr>
<td><table width="97%" border="0" align="center" cellpadding="0" cellspacing="15" bgcolor="#EBF5FE">
<tr>
<td align="center" bgcolor="#FFFFFF"><table width="100%" border="0" cellpadding="6" cellspacing="0" class="border2">
<tr>
<td align="center">
<?php
include 'include/config.php';
$id=$_POST['id'];
$content=$_POST['content'];
$reply=$_POST["reply"];
$systime=date("Y-m-d H:i:s");
//还原空格和回车
if(!empty($content)){
$content=str_replace(" ","",$content);
$content=ereg_replace("\n","<br> ",ereg_replace(" "," ",$content));
}
if(!empty($reply)){
$reply=str_replace(" ","",$reply);
$reply=ereg_replace("\n","<br> ",ereg_replace(" "," ",$reply));
}
//还原结束
$db->update("update ".TABLE_PREFIX."guestbook set content='".$content."',reply='".$reply."',replytime='".$systime."' where id=".$id);
echo "<img src=\"images/success.gif\"> <font style=font-size:12pt;color=green>编辑/回复成功,请稍候……</font><br><a href=".$pageUrl.">如果浏览器没有自动返回,请点击此处返回</a>";
echo "<meta http-equiv=\"refresh\" content=\"2; url=".$pageUrl."\">";
?>
</td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
<?php }?>
<?php include 'include/foot.php';?>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -