⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 edit.php

📁 转载: 1、留言内容不良词语过滤 2、版主可修改留言内容 3、能把留言删除到回收站 4、可批量删除留言 5、留言前可先预览 6、UBB 标签代码支持 7、随机选择头像和表情
💻 PHP
字号:
<?php
#####################################
##  名 称 :雨虹留言板  YHPbook    ##
##  设 计 :绿叶软件营 -> 蓝鸟     ##
##  展 示 :http://lvsoft.126.com  ##
##  电 邮 : lvsoft@tom.com         ##
#####################################

require("include/config.php");
require($datapath."/prepare.php");
require("global.php");

if(!CheckAdmin()){
	warn("你不是版主(未登陆或连接超时),无权执行相关操作");
}else{
	$file="${datapath}/book.php";
	$fp=fopen($file,"r");
	flock($fp,LOCK_SH);
	$id = isset($_GET['id'])?$_GET['id']:$_POST['id'];

	if($_POST['act'] == "addto"){        /// 修改留言
		$hid=$_POST['hid'];
		if($hid <> "on") $hid="";
		$headdata="";$sign=1;
		While($sign){
			$headdata=$headdata.$temp;
			$temp=fgets($fp,5000);
			$line=explode("\t",$temp);
			if($line[0]==$id) $sign=0;
			if(feof($fp)) error("对不起,你的留言板不存在此条留言。");
		}

		$content=message($_POST['content']);
		if(strlen($content)>$config[strlen]) error("你修改的留言内容过长");

		$line[10]=$content;
		$line[12]=$hid;
		$line[16]=$gb_time;
		$temp2=implode("\t",$line);
		$footdata=fread($fp,filesize($file));
		fclose($fp);
		$writemsg=$headdata.$temp2.$footdata;
		$fp=fopen($file,"w");
		flock($fp,LOCK_EX);
		fwrite($fp,$writemsg);
		fclose($fp);

		success("修改成功","你已成功的修改此条留言,即将返回留言簿","./");
		
	}elseif($_GET['act'] == "top"){
		if(empty($id) or ($id < 1))  $id = 0;
		$fp=fopen($datapath."/top.txt","w");
		flock($fp,LOCK_EX);
		fwrite($fp,$id);
		fclose($fp);
		$title = ($id==0) ? "你已把固顶留言取消了固顶" : "你已成功把一条留言固顶";
		success("操作成功",$title.",即将返回留言簿","./");

	}else{   /// 显示要修改的留言
		$sign=1;
		While($sign){
			$temp=fgets($fp,5000);
			$line=explode("\t",$temp);
			if($line[0]==$id) $sign=0;
			if(feof($fp)) error("对不起,你的留言板不存在此条留言。");
		}

		$time=date("Y-m-d.H:i",$line[11]);
		fclose($fp);

		$content = ereg_replace("\[br\]","\r",$line[10]);
		$hid = ($line[12]=="on") ? " checked" : "";
		if($line[16]<>"") $showtime=" title=\"最后修改时间: ".date("Y-m-d.H:i",$line[16])."\"";

header("Expires: 0");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><?echo$config[bookname];?>——修改留言</title>
<link rel="stylesheet" href="images/style.css">
<script language='JavaScript1.2' src='images/clue.js' type='text/javascript'></script>
</head>
<body bgcolor="#9BCBFB">
<script language="JavaScript1.2">
<!--
var postmaxchars = <?echo$config[strlen]?>;
function validate(theform) {
    ByteCount  = 0;
	if (postmaxchars != 0) {
	for (i=0;i<theform.content.value.length;i++){
		ByteCount  = (theform.content.value.charCodeAt(i)<=256) ? ByteCount + 1 : ByteCount + 2;
	}
		if (ByteCount > postmaxchars) {
			alert("你的信息太长了.\n\n请限制在 "+postmaxchars+" 字节以内.\n当前已有 "+ByteCount+" 字节.");
			return false; }
		else { document.form.submit.disabled = true; return true; }
	} else { 
document.form.submit.disabled = true; return true; }
}
-->
</script>
<p> </p>
<div align="center">
  <center>
  <table border="0" cellspacing="0" width="500" bgcolor="#000000">
    <tr>
      <td width="498">
        <table border="0" cellpadding="2" cellspacing="0" width="100%">
          <tr>
            <td width="100%" colspan="2" align="center" height="23" background="images/table.gif"><font color="#FFFFFF"><?echo$config[bookname];?></font></td>   
          </tr>
          <tr>
            <td width="100%" colspan="2" height="1"></td>
          </tr>
          <tr>
            <td width="74%" bgcolor="#EFEFEF" height="17">&nbsp;当前位置: <a href="<?echo$config[homeurl];?>"><?echo$config[homename];?></a> &gt;&gt; <a href="./">查看留言</a>  &gt;&gt;     
              修改留言</td>          
            <td width="26%" bgcolor="#EFEFEF" height="17"> </td>
          </tr>
        </table>
      </td>
    </tr>
  </table>
  </center>
</div>
<div align="center">
  <center>
<table cellpadding="0" cellspacing="0" width="500" height="5">
  <tr>
    <td width="100%"></td>
  </tr>
</table>
  </center>
</div>
<div align="center">
  <center>
  <table border="0" cellspacing="0" width="500" bgcolor="#000000" cellpadding="0">
    <tr>
      <td width="100%">
  <table border="0" cellpadding="3" cellspacing="1" width="100%">
    <form name="form" method="post" action="edit.php" onsubmit="return validate(this)">
    <input type="hidden" name="act" value="addto">
    <input type="hidden" name="id" value="<?echo$_GET['id'];?>">
    <tr>
      <td width="105" bgcolor="#DAEFE1">
      <table border="0" cellpadding="0" cellspacing="0" bordercolor="#4F4F4F" width="100%">
        <tr>
          <td width="100%" class="shadow" align="center">留言内容<br>
            (<<?echo$config[strlen]?>个字符)</td>
        </tr>
      </table>
      </td>
      <td width="377" bgcolor="#DAEFE1">
      <p style="line-height: 12pt; margin-left: 10; margin-right: 10"><font color="#0000FF"><u>
      <?echo$line[1];?></u></font> [<?echo$time;?>]<br>
            <textarea rows="8" cols="58" name="content" onmouseover="this.style.backgroundColor='#FFFFFF'" onmouseout="this.style.backgroundColor=''" style="overflow:auto" class="input"<?echo$showtime?>><?echo$content;?></textarea><br>
      <input type="checkbox" name="hid" value="on" title="改变悄悄话模式"<?echo$hid?>>悄悄话</p></td>
    </tr>
    <tr>
      <td width="490" colspan="2" align="center" bgcolor="#DAEFE1">
      <input type="submit" value="修改" name="submit" style="width: 50; height: 18" onmouseover="this.style.backgroundColor='#FFFFFF'" onmouseout="this.style.backgroundColor=''" class="input">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
      <input type="reset" value="复原" name="reset" style="width: 50; height: 18" onmouseover="this.style.backgroundColor='#FFFFFF'" onmouseout="this.style.backgroundColor=''" class="input">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
      <input type="button" value="不修改" onclick="javascript:history.back()" style="width: 50; height: 18" onmouseover="this.style.backgroundColor='#FFFFFF'" onmouseout="this.style.backgroundColor=''" class="input">
      </td>
    </tr>
    </form>
  </table>
</td>
  </tr>
</table>
  </center>
</div>
      <p>&nbsp;</p>
 <div align="center">
  <center>
<table cellpadding="3" cellspacing="0" bordercolor="#4F4F4F" width="400">
  <tr>
    <td width="100%">&nbsp;</td>         
  </tr>
  <tr>
    <td width="100%" bgcolor="#808080" height="1"></td>         
  </tr>
  <tr>
    <td width="100%" align="center">受权使用:<?echo$config[homename];?> / <a href="http://www.yhai.com" 
title="宇海网络" target="_blank">Yhai.Com</a> <a href="http://lvsoft.126.com" 
title="VerInfo: <?=Verinfo?>" target="_blank">YHPbook v<?=Verion?></a></td>
  </tr>
</table>
  </center>
</div>
</td>
		</tr>
	</table>
</div>
</body>
</html>
<?
	}
}
?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -