📄 qijibook.php
字号:
<?
/*-------------------------------------------------------------------
奇迹数码专用版留言簿ver1.0
程序:by 魔力闪客~~Ten
E-mail:qqlzl@sohu.com
主页:http://jlqiji.wo.to
论坛:http://mo2x.uni.cc
本程序为免费程序,但请保留本版权信息,对自行修改代码造成的病毒现象,一律不给予技术上的回复。
程序说明:
1.本留言簿为单用户留言簿.
2.纯字符界面,浏览速度更快,这是本程序的一大特色。
3.有版主回复和删除留言的功能,版主可以无限次回复留言。
4.很好的解决了字符太长时表格变形的问题。
5.加入了防灌水功能,发留言间隔为10秒
6.加入了引用留言的功能。
7.使用前将数据文件所在的文件夹属性设为777,数据文件的属性设为666。
--------------------------------------------------------------------*/
#留言簿的设置数组
$admin[path]="data"; ##数据文件的路径
$admin[home]="../index.php"; ##主页地址
$admin[password]="111"; ##管理员密码
$admin[email]="qqlzl@sohu.com"; ##管理员邮箱
$admin[name]="111"; ##管理员帐号
$admin[homename]="奇迹数码专用版"; ##主页名称
$admin[bbsname]="奇迹数码专用版"; ##留言簿名称
$admin[html]=0; ##HTML代码支持,0=否
$admin[copyright]="Copyright by <a href='http://jlqiji.wo.to'>奇迹专用版</a>";##页脚处显示的版权信息
$admin[page]=6; ##每页显示留言数目
$admin[url]="qijibook.php";##留言簿主程序URL
/*--------------------------------------ubb函数-----------------------------------------*/
#发表时间函数
function posttime(){
$date=date("Y-m-d.G:i:s");
return $date;
}
#取得贴子id函数
function getid(){
$id=date("YmdHis");
return $id;
}
#字符串处理函数
function str($msg){
global $admin;
if(!$admin[html]) $msg=htmlspecialchars($msg);
if($admin[ubb]) $msg=ubb($msg);
$msg=nl2br($msg);
$msg= str_replace("\r","",$msg);
$msg= str_replace("\t","",$msg);
$msg=str_replace("|","│",$msg);
return $msg;
}
#检查邮件函数
function checkmail($add){
if(ereg("^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+",$add))
$ttt=true;
else $ttt=false;
return $ttt;
}
#取得ip函数
function getip($REMOTE_ADDR){
$ip=$REMOTE_ADDR;
$iphide=explode(".",$ip);
$ip="$iphide[0].$iphide[1].$iphide[2].***";
return $ip;
}
#显示错误函数
function showerror($errormsg){
global $admin;
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="style.css">
<title>奇迹有我</title>
<style type="text/css">
<!--
-->
</style>
</head>
<p align="center">错误原因:<b><?echo $errormsg;?></b></p>
<p align="center"><a href="javascript:history.go(-1);"><font color="#000000">请点这里返回上一页检查你的输入是否有误</font></a></p>
<p align="center">[ <a href="javascript:history.go(-1);">返回上一页</a> ]</p>
<p align="center" class="unnamed1"><?echo $admin[copyright];?></p>
</body></html>
<?}
#输出一条留言函数
function messageshow($line){
global $admin;
$info=explode("|","$line");
?>
<table width="512" border="0" cellspacing="0" cellpadding="0" height="179">
<tr>
<td width="122" height="20">[No.<?echo $info[0];?>]</td>
<td colspan="3" height="20">发表于:<?echo $info[1];?> ------------[<a href="<?echo $admin[url]."?action=reply&num=".$info[0]?>">回复</a>]--[<a href="<?echo $admin[url]."?action=add"e=1&num=".$info[0]?>">引用</a>]--[<a href="<?echo $admin[url]."?action=del&num=".$info[0]?>">删除</a>]----</td>
</tr>
<tr>
<td width="122" height="125" valign="top">
<div align="center">
<p>id:<b><?echo $info[2];?></b></p>
<? if ($info[3]=="male") {?>
<p>我是大男生我怕谁</p><?}
else {?><p>小魔女我会撒娇
</p> <?}?>
<p>[<a href="mailto:<?echo $info[4];?>">E-mail</a>]<br>
[<a href="<?echo $info[7];?>" target="_blank">主页</a>]<br>
[<a href="http://search.tencent.com/cgi-bin/friend/user_show_info?ln=<?echo $info[6];?>" target="_blank">Qicq</a>]</p>
<p>IP:<?echo $info[5];?></p>
</div>
</td>
<td width="390" colspan="3" height="125" valign="top" style="TABLE-LAYOUT: fixed; WORD-BREAK: break-all; WORD-WRAP: break-word">
<div align="left">
<? echo $info[8]."\n";
for ($i=9;$i<count($info);$i++)
{
if (isset($info[$i])) echo "<p>斑竹回复:[".($i-8)."]<br>$info[$i]</p>";
}
?>
</div>
</td>
</tr>
<tr>
<td width="122" height="14">--------------------</td>
<td height="14" colspan="3">
<div align="left">-----------------------------------------------------------------</div>
</td>
</tr>
</table>
<?}
/*------------------------------------------------函数结束-----------------------------------------------------*/
?><?
if ($action=="add")
{ if ($submitadd)
{ if ($id=="") showerror("你的网名还没添呢");
elseif (time()-$post_time<10) showerror ("为防止灌水,发留言间隔为10秒");
elseif (!checkmail($email)) showerror("你邮件没有填写或填写有错误!");
elseif (eregi("[<>(),#|;%/$\]",$email)) showerror("邮件填写不能包含特殊字符!");
elseif (strlen($id)>15) showerror("昵称太长,改一个吧!");
elseif (eregi("[<>(),#|;%/$\]+", $id)) showerror("名称只能是字母数字或中文,请不要包含< > | ?等特殊字符");
elseif (eregi("[^[a-z]]",$sex)) showerror("非法提交!");
elseif (eregi("[^[:digit:]未知]", $oicq)) showerror("QQ号码填错了!");
elseif (eregi("[<>(),#|;%$\]+",$homepage)) showerror("主页填写有错误,主页名字只能包含字母数字下划线和-号!");
elseif (!eregi("^http://",$homepage)) showerror("主页开头要加http://");
elseif ($message=="") showerror("没有填写留言!");
elseif (strlen($message)>2000) showerror("留言太长,小心黑了你的网站");
else {
if ($oicq=="") $oicq="未知";
if ($homepage=="") $homepage="http://";
if ($sex!="male") $sex="female";
$message=str($message);
$date=posttime();
$ip=getip($REMOTE_ADDR);
if (!file_exists("$admin[path]/message")) $num=1;
else { $fp1=file("$admin[path]/message"); $num=count($fp1)+1; }
$arr="$num|$date|$id|$sex|$email|$ip|$oicq|$homepage|$message\n";
$fp=fopen("$admin[path]/message","a");
fputs($fp,"$arr");
fclose($fp);
$cookietime=time()+31536000;
$posttime=time();
setcookie(user_homepage,$homepage,$cookietime);
setcookie(user_sex,$sex,$cookietime);
setcookie(user_email,$email,$cookietime);
setcookie(user_id,$id,$cookietime);
setcookie(user_oicq,$oicq,$cookietime);
setcookie(post_time,$posttime,60);
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">";
echo "<HTML><HEAD><TITLE>发表文章</TITLE>";
echo "<META content=\"text/html; charset=gb2312\" http-equiv=Content-Type>";
echo "<link rel=\"stylesheet\" href=\"style.css\">";
echo "<meta HTTP-EQUIV=\"REFRESH\" CONTENT=\"2;URL=$admin[url]\">";
echo "</head><body topmargin=\"0\"><br>";
echo "<ul>谢谢你发表留言,即将返回留言簿首页.<br>";
echo " <br>请等待 系统正在创建这个新的留言...<br>";
echo " <br></font>";
echo "<a href='$admin[url]'>如果你的浏览器没有自动的返回到留言簿首页,或者你不想再等待,请点这里返回.";
echo "</font></a></ul>";
}
}
else { if($user_homepage=="")$user_homepage="http://";
if($user_oicq=="")$user_oicq="未知"; ?>
<html>
<head>
<link rel="stylesheet" href="style.css">
<script>
function gbcount(message,total,used,remain) {
var max;
max = total.value;
if (message.value.length > max) {
message.value = message.value.substring(0,max);
used.value = max;
remain.value = 0;
alert("留言不能超过1000个字!");
}
else {
used.value = message.value.length;
remain.value = max - used.value;
}
}
</script>
<title>添加留言</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#FFFFFF">
<div align="center">
<table width="512" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="512">
<div align="center"><h1>添加留言</h1></div>
</td>
</tr>
<tr>
<td width="512">
<div align="center">-------------------------------------------------------------------------------------
<form name="add" action="<? echo "$PHP_SELF?action=add"?>" method="post" >
<table width="512" border="0" cellspacing="1" cellpadding="1">
<tr>
<td width="143">
<div align="right">*名称:</div>
</td>
<td width="360">
<input type="text" name="id" value="<?echo $user_id;?>">
</td>
</tr>
<tr>
<td width="143">
<div align="right">性别:</div>
</td>
<td width="360">
<select name="sex">
<option value="male">大男生</option>
<option value="female">小魔女</option>
</select>
</td>
</tr>
<tr>
<td width="143">
<div align="right">*E-mail:</div>
</td>
<td width="360">
<input type="text" name="email" value="<?echo $user_email;?>">
</td>
</tr>
<tr>
<td width="143">
<div align="right">Oicq: </div>
</td>
<td width="360">
<input type="text" name="oicq" value="<?echo $user_oicq;?>">
</td>
</tr>
<tr>
<td width="143">
<div align="right">主页:</div>
</td>
<td width="360">
<input type="text" name="homepage" value="<?echo $user_homepage;?>">
</td>
</tr>
<tr>
<td valign="top" width="143">
<div align="right">*留言: </div>
</td>
<td width="360">
<textarea rows="8" name="message" cols="50" onKeyDown="gbcount(this.form.message,this.form.total,this.form.used,this.form.remain);" onKeyUp="gbcount(this.form.message,this.form.total,this.form.used,this.form.remain);"><?if ($quote==1)
{ $fp=@file("$admin[path]/message");
$n=count($fp);
for ($i=$n-1;$i>=0;$i--)
{ $arr=$fp[$i];
$info=explode("|",$arr);
if ($info[0]==$num)
{
$info[8]=preg_replace("/<blockquote>(.+?)<\/blockquote>((<br>)*)/is","",$info[8]);
$info[8]=preg_replace("/<br>/","\n",$info[8]);
echo "[quote]".$info[8];
if (isset($info[9]))
for ($i=9;$i<count($info);$i++) {
$info[$i]=preg_replace("/<br>/","\n",$info[$i]);
echo "\n斑竹回复[".($i-8)."]:\n".$info[$i];}
echo "[/quote]";
break;
}
}
}
?></textarea>
<br>
最大字数:
<input type="text" name="total" size="3" maxlength="3" value="1000" style="border-style: solid; border-color: #FFFFFF">
已用字数:
<input type="text" name="used" size="3" maxlength="3" value="0" style="border-style: solid; border-color: #FFFFFF">
剩余字数:
<input type="text" name="remain" size="3" maxlength="3" value="1000" style="border-style: solid; border-color: #FFFFFF">
</td>
</tr>
</table>
<p align="center">带星号的为必填项!</p>
<p align="center">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -