相思资源网 Design By www.200059.com
这一节我们将dele.php和sys.php放上来.
---------
//dele.php<html>
<head>
<title>删除留言</title>
<style>
<!--
A:link {text-decoration: none ; color:0000ff}
A:visited {text-decoration: none; color:004080}
A:active {text-decoration: none}
A:hover {text-decoration: underline; color:ff0000}
BODY {FONT-SIZE:10pt}
TH {FONT-SIZE:10 pt}
TD {FONT-SIZE: 10pt}
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<?
require("sys.php");
if ($Submit)
{
if ($password<>$managepwd)
{$errorm="<font color=red>密码错误</font>.无权操作..";}
else
{
$content=file($guestfile);
$message=$content[$record-1];
$count=count($content);
if ($dele=="delreply")
{
$replylen=strlen(strstr($message,"<!--reply>"));
$long=strlen($message);
$len=$long-$replylen;
$message=substr($message,0,$len);
}
else
{$message="";}
//writefile
$fp=fopen($guestfile,"w");
for ($i=0;$i<$count;$i++)
{
if ($i==($record-1)){$content[$i]=$message;}
fputs($fp,$content[$i],strlen($content[$i]));
}//end for
fclose($fp);
echo "<meta http-equiv=Refresh content="1;url=guest.php">";
exit;
}
}// end ifSubmit
$content=file($guestfile);
$message=$content[$record-1];
$found=ereg("<!--reply>",$message);
?>
<body bgcolor="#FFFFFF" background="back.gif">
<? include("head.htm"); ?>
<table width="68%" border="1" cellpadding="5" align="center" cellspacing="0" bordercolor="#F2F2F2">
<form action=dele.php method=post>
<?
if ($errorm)
{
echo "<tr>";
echo "<td height=27>$errorm</td>";
echo "</tr>";
}
?>
<? echo $message ?>
<tr align="center">
<td height="37" bgcolor="#f0f0f0">
<?
if ($found)
{
echo "<input type=radio name=dele value=delall>";
echo "全部删除 ";
echo "<input type=radio name=dele value=delreply checked>";
echo "仅删除回复";
}
?>
<font color="#000000">管理密码</font>
<input type="password" name="password" size="10">
<input type=hidden name=record value=<? echo "$record";?
<input type="submit" name="Submit" value="我要删除了">
</td>
</tr>
</form>
</table>
<? include("bottom.htm"); ?>
</body>
</html>
------
//sys.php
<title>zihanonline</title><?
$managepwd='zihanonline';
$guestfile="guest.txt";
function check_strlen_long($txt)
{
$count=0;
$arrtemp=$txt;
$len=strlen($txt);
$txt=$txt.' ';
for ($i=0;$i<$len;$i++)
{
if (ord($txt[$i])<128)
{ $count=$count+1;}
if (ord($txt[$i])==10 or ord($txt[$i])==32)
{$count=0;}
if ($count>=70)
{
for ($j=$i;$j<$len;$j++)
{
$txt[$j+1]=$arrtemp[$j];
}
$txt[$i]="n";
$len=$len+1;
$txt[$len]=$arrtemp[$len-1];
$count=0;
$arrtemp=$txt;
}//end if count
}
$txt=trim($txt);
return $txt;
}//end function
function encode ($txt)
{
$txt=strip_tags($txt);
$txt=htmlspecialchars($txt);
$message=StripSlashes($txt);
return $message;
}
function ubb($txt)
{
}
?>
<body bgcolor="#FFFFFF" background="back.gif">
----------
注意sys.php中的" $managepwd='zihanonline' "一栏中等号后的是留言本的管理密码号,此时是默认的zihanonline.您可以修改为自己的号码.
未完待续...
---------
//dele.php<html>
<head>
<title>删除留言</title>
<style>
<!--
A:link {text-decoration: none ; color:0000ff}
A:visited {text-decoration: none; color:004080}
A:active {text-decoration: none}
A:hover {text-decoration: underline; color:ff0000}
BODY {FONT-SIZE:10pt}
TH {FONT-SIZE:10 pt}
TD {FONT-SIZE: 10pt}
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<?
require("sys.php");
if ($Submit)
{
if ($password<>$managepwd)
{$errorm="<font color=red>密码错误</font>.无权操作..";}
else
{
$content=file($guestfile);
$message=$content[$record-1];
$count=count($content);
if ($dele=="delreply")
{
$replylen=strlen(strstr($message,"<!--reply>"));
$long=strlen($message);
$len=$long-$replylen;
$message=substr($message,0,$len);
}
else
{$message="";}
//writefile
$fp=fopen($guestfile,"w");
for ($i=0;$i<$count;$i++)
{
if ($i==($record-1)){$content[$i]=$message;}
fputs($fp,$content[$i],strlen($content[$i]));
}//end for
fclose($fp);
echo "<meta http-equiv=Refresh content="1;url=guest.php">";
exit;
}
}// end ifSubmit
$content=file($guestfile);
$message=$content[$record-1];
$found=ereg("<!--reply>",$message);
?>
<body bgcolor="#FFFFFF" background="back.gif">
<? include("head.htm"); ?>
<table width="68%" border="1" cellpadding="5" align="center" cellspacing="0" bordercolor="#F2F2F2">
<form action=dele.php method=post>
<?
if ($errorm)
{
echo "<tr>";
echo "<td height=27>$errorm</td>";
echo "</tr>";
}
?>
<? echo $message ?>
<tr align="center">
<td height="37" bgcolor="#f0f0f0">
<?
if ($found)
{
echo "<input type=radio name=dele value=delall>";
echo "全部删除 ";
echo "<input type=radio name=dele value=delreply checked>";
echo "仅删除回复";
}
?>
<font color="#000000">管理密码</font>
<input type="password" name="password" size="10">
<input type=hidden name=record value=<? echo "$record";?
<input type="submit" name="Submit" value="我要删除了">
</td>
</tr>
</form>
</table>
<? include("bottom.htm"); ?>
</body>
</html>
------
//sys.php
<title>zihanonline</title><?
$managepwd='zihanonline';
$guestfile="guest.txt";
function check_strlen_long($txt)
{
$count=0;
$arrtemp=$txt;
$len=strlen($txt);
$txt=$txt.' ';
for ($i=0;$i<$len;$i++)
{
if (ord($txt[$i])<128)
{ $count=$count+1;}
if (ord($txt[$i])==10 or ord($txt[$i])==32)
{$count=0;}
if ($count>=70)
{
for ($j=$i;$j<$len;$j++)
{
$txt[$j+1]=$arrtemp[$j];
}
$txt[$i]="n";
$len=$len+1;
$txt[$len]=$arrtemp[$len-1];
$count=0;
$arrtemp=$txt;
}//end if count
}
$txt=trim($txt);
return $txt;
}//end function
function encode ($txt)
{
$txt=strip_tags($txt);
$txt=htmlspecialchars($txt);
$message=StripSlashes($txt);
return $message;
}
function ubb($txt)
{
}
?>
<body bgcolor="#FFFFFF" background="back.gif">
----------
注意sys.php中的" $managepwd='zihanonline' "一栏中等号后的是留言本的管理密码号,此时是默认的zihanonline.您可以修改为自己的号码.
未完待续...
相思资源网 Design By www.200059.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
相思资源网 Design By www.200059.com
暂无一个php作的文本留言本的例子(四)的评论...
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。