脚本宝典收集整理的这篇文章主要介绍了一个可分页的基于文本的PHP留言板源码,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
小弟初学
PHP,编了
一个留言板程序,自我感觉良好,故厚着脸皮放了上来,请各位大哥指正。
源程序如下:&nbs
p; <?
PHP //
文件名:guest.
PHP //设定部分
$guestfile="guest";//纪录留言的文本
文件 $home="index.ht
ML";//返回的主页
$imagedir="image"; //图像
文件的目录
$backimage=$imagedir."/bk.gif";//背景图像
$backcolor="
#ceffff";//
背景颜色,在$backimage=""时起作用
?>
<html>
<head>
<?
PHP if($QUERY_STRING!="") {
$page = $QUERY_STRING;
} else {
$page = 1;
}
if($mode
=="add"){
$n
ame=htmls
PEcialchars(trim($name));
$t
ITle=htmlspecialchars(trim($title));
$data=nl2
br(htmlspecialchars($data));
$data=str_replace("r","",$data);
$data=str_replace("x0A",$data);
$data=str_replace(" "," ",$data);
if($data=="") $data=" ";
$e_m
ail=trim($e_mail);
if($e_mail=="") $e_mail=0;
$url=trim($url);
if($url=="http://" || $url=="") $url=0;
$time=date("Y")."年".date("m")."月".date("d")."日[".date("H").":".date("i").":".date("s")."]";
if($name=="" || $title==""){
echo "<script Language="JavaScript">n";
echo " alert("请至少输入姓名与留言
标题。");n";
echo "history.back();";
echo "</script></head></html>n";
exit;
}
$adddata=$name."t".$e_mail."t".$url."t".$title."t".$data."t".$icon."t".$time."n";
if(
file_exists($guestfile)){
$filebuffer=file($guestfile);
if(
sizeof($filebuffer)>100){
for($i=0;$i<100;$
i++)
$newbuffer[i]=$filebuffer[i];
}
else{
$newbuffer=$filebuffer;
}
$fp=fopen($guestfile,"w");
fputs($fp,$adddata);
fclose($fp);
$buffer=
implode("",$newbuffer);
$fp=fopen($guestfile,"a");
fputs($fp,$buffer);
fclose($fp);
}
else{
$fp=fopen($guestfile,"w");
fwrite($fp,$adddata);
fclose($fp);
}
}
?>
<
Meta HTTP-EQUIV="Content
-type" CONTENT="text/html; charset=gb2312">
<title>留言板</title>
<style>
a{text-decoration:none; font-
Size:9pt; color:blue}
a:visited {text-decoration:none; color:009999}
a:hover {color:
red; text-decoration:underline}
td{font
-size:9pt;line-h
eight:14pt}
P{font-size:9pt}
</style>
</head>
<?
PHP if($backimage!="" && file_exists($backimage)){
echo "<body background="".$backimage."" bg
PRoperties="fixed">n";
}
else{
echo "<body bgcolor="".$backcolor."">n";
}
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr bgcolor="#9999FF">
<td height="28">
<div align="
center"><b>供
电9901网上空间留言板</b></div>
</td>
</tr>
<tr><td><div align="right"><a
href="<? echo $home; ?>">[返
回首页]</a></div></td></tr>
</table>
<font size="2">
<form 
;method="post" action="guest.
PHP">
<input type="hidden" name="mode" value="add">
<p>姓名:
<input type="text" name="name" size="20">
<br>
E_Mail:
<input type="text" name="e_mail" size="20">
<br>
主页:
<input type="text" name="url" value="http://" size="30">
<br>
留言
标题:
<input type="text" name="title" size="50">
<br>
留言
内容:(
不支持HTML)<br>
<textarea name="data" rows="5" cols="60"></textarea>
<div id="Layer1" style="position:absolute; left:460px; top:152px; width:
301px; height:104px; z
-index:1">
<p>表情:</p>
<p>
<input type="ra
dio" name="icon" value="1">
<
img src="<? echo $imagedir."/1.gif"; ?>" width="15" height="15">
<input type="ra
dio" name="icon" value="2">
<img src="<? echo $imagedir."/2.gif"; ?>" width="15" height="15">
<input type="ra
dio" name="icon" value="3">
<img src="<? echo $imagedir."/3.gif"; ?>" width="15" height="15">
<input type="ra
dio" name="icon" value="4" checked>
<img src="<? echo $imagedir."/4.gif"; ?>" width="15" height="15">
<input type="ra
dio" name="icon" value="5">
<img src="<? echo $imagedir."/5.gif"; ?>" width="15" height="15">
脚本宝典总结
以上是脚本宝典为你收集整理的一个可分页的基于文本的PHP留言板源码全部内容,希望文章能够帮你解决一个可分页的基于文本的PHP留言板源码所遇到的问题。
如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。