?? index.php
字號:
<?
############ ZTSKY留言簿1.0版本 ########################################################
# 版權所有: ztsky
# E-mail : yangyuyan@sina.com
# OICQ : 605202
# 主頁地址: http://www.zthouse.com/
#
# 【版權聲明】
# 本程序提供個人網站免費使用,請勿非法修改,
# 轉載,散播,或用于其他圖利行為,并請勿刪除版權聲明以及我的主頁地址?。。?# 如果您的網站正式起用了這個腳本,請您通知我們,以便我能夠知曉,
# 如果可能,請在您的網站做上我們的鏈接,希望能給予合作。謝謝!
#
# 【程序功能】
#1. 支持多用戶,功能強大
#2. 界面美觀,模仿UGB風格
#3. 支持OICQ在線顯示
#4. 在線申請留言簿在線開通
#5. 版主在線修改, 即時生效
#6. 超級管理可以隨時刪除申請留言簿的用戶
#7. 可顯示訪客IP及留言時間。
#8. 每個版主都可以管理自己版內的留言,包括了刪除留言和回復留言。
#9. 提供搜索留言資料,速度快、功能強。
#10.斑竹可以自定義留言簿頭部顯示信息和尾部顯示信息。
#11.可以設定是否支持ubb碼和html碼
#12.只是使用文本作為數據庫,窮人有福!
#
# 還有就是一些公用的函數都放在了函數部分,大家可以很方便的修改,呵呵
# 對于程序的安裝設置也是非常簡單,如果大家怕麻煩,可以運行run.php
# 她會幫你修改所有文件的屬性!對于變量的設置請參見設置部分。
# 這里是留言簿的演示:2hu.net/free/gb
#########################################################################################
# 請您尊重我們的勞動和版權,不要刪除以上的版權聲明部分,謝謝合作??!
#########################################################################################
####################################設置部分#############################################
$admin[path]="./data"; ##數據庫文件的路徑
$admin[home]="http://www.zthouse.com"; ##主頁地址
$admin[password]="123"; ##管理員密碼
$admin[email]="yangyuyan@sina.com"; ##管理員郵箱
$admin[name]="ztsky"; ##管理員帳號
$admin[homename]="紫桐工作室"; ##主頁名稱
$admin[ubb]=1; ##是否支持UBB代碼,0=否
$admin[html]=0; ##是否支持HTML代碼,0=否
$admin[up]=""; ##留言簿上部HTML代碼
$admin[down]=""; ##留言簿下部HTML代碼
$admin[page]=5; ##每頁默認顯示留言數目
$admin[img]="image"; ##圖片文件儲存URL
$admin[gb]="http://ztasp.host.wayall.com/gb/index.php"; ##留言簿主頁主程序URL
####################################設置完成#############################################
if(empty($home))$home=$admin[home];
$pass=$admin[password];
if(empty($email))$email=$admin[email];
#########################################################################################
####################################公用函數#############################################
function oicq($uin){
if($uin=="")return 1;else
if(strlen($uin)<=8 and !eregi("([^0-9])",$uin))return 1;else return 0;
}
function getline($file){
$data=Chop(fgets($file,5000));
return $data;
}
function nowtime(){
$date=date("Y-m-d.G:i:s");
return $date;
}
function getid(){
$id=date("YmdHis");
return $id;
}
function ubb($Text) {
$Text=htmlspecialchars($Text);
$Text=ereg_replace("\r\n","<br>",$Text);
$Text=ereg_replace("\r","<br>",$Text);
$Text=nl2br($Text);
$Text=preg_replace("/\\t/is"," ",$Text);
$Text=preg_replace("/\[h1\](.+?)\[\/h1\]/is","<h1>\\1</h1>",$Text);
$Text=preg_replace("/\[h2\](.+?)\[\/h2\]/is","<h2>\\1</h2>",$Text);
$Text=preg_replace("/\[h3\](.+?)\[\/h3\]/is","<h3>\\1</h3>",$Text);
$Text=preg_replace("/\[h4\](.+?)\[\/h4\]/is","<h4>\\1</h4>",$Text);
$Text=preg_replace("/\[h5\](.+?)\[\/h5\]/is","<h5>\\1</h5>",$Text);
$Text=preg_replace("/\[h6\](.+?)\[\/h6\]/is","<h6>\\1</h6>",$Text);
$Text=preg_replace("/\[url\](http:\/\/.+?)\[\/url\]/is","<a href=\\1>\\1</a>",$Text);
$Text=preg_replace("/\[url\](.+?)\[\/url\]/is","<a href=\"http://\\1\">http://\\1</a>",$Text);
$Text=preg_replace("/\[url=(http:\/\/.+?)\](.*)\[\/url\]/is","<a href=\\1>\\2</a>",$Text);
$Text=preg_replace("/\[url=(.+?)\](.*)\[\/url\]/is","<a href=http://\\1>\\2</a>",$Text);
$Text=preg_replace("/\[img\](.+?)\[\/img\]/is","<img src=\\1>",$Text);
$Text=preg_replace("/\[color=(.+?)\](.+?)\[\/color\]/is","<font color=\\1>\\2</font>",$Text);
$Text=preg_replace("/\[size=(.+?)\](.+?)\[\/size\]/is","<font size=\\1>\\2</font>",$Text);
$Text=preg_replace("/\[sup\](.+?)\[\/sup\]/is","<sup>\\1</sup>",$Text);
$Text=preg_replace("/\[sub\](.+?)\[\/sub\]/is","<sub>\\1</sub>",$Text);
$Text=preg_replace("/\[pre\](.+?)\[\/pre\]/is","<pre>\\1</pre>",$Text);
$Text=preg_replace("/\[email\](.+?)\[\/email\]/is","<a href=\\1>\\1</a>",$Text);
$Text=preg_replace("/\[i\](.+?)\[\/i\]/is","<i>\\1</i>",$Text);
$Text=preg_replace("/\[b\](.+?)\[\/b\]/is","<b>\\1</b>",$Text);
$Text=preg_replace("/\[quote\](.+?)\[\/quote\]/is","<blockquote><font size='1' face='Courier New'>quote:</font><hr>\\1<hr></blockquote>", $Text);
$Text=preg_replace("/\[code\](.+?)\[\/code\]/is","<blockquote><font size='1' face='Times New Roman'>code:</font><hr color='lightblue'><i>\\1</i><hr color='lightblue'></blockquote>", $Text);
$Text=preg_replace("/\[sig\](.+?)\[\/sig\]/is","<div style='text-align: left; color: darkgreen; margin-left: 5%'><br><br>--------------------------<br>\\1<br>--------------------------</div>", $Text);
return $Text;
}
function str($msg){
global $admin;
if(!$admin[html]) $msg=htmlspecialchars($msg);
if($admin[ubb]) $msg=ubb($msg);
$msg=nl2br($msg); #處理message
$msg= str_replace("\n","",$msg); #處理message
$msg= str_replace("\r","",$msg); #處理message
return $msg;
}
function error($msg){
global $admin;
?>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="<?echo$admin[img];?>/style.css"><title>留言簿出錯</title></head>
<body background="image/bgmc.gif"><html><head></head><body bgcolor="#FFFFFF">
<center><table border="0" width="100%" height="100%" cellspacing="0" cellpadding="0">
<tr><td width="100%"><table border="0" width="100%" bgcolor="#000000" cellspacing="0" cellpadding="0">
<tr><td width="100%">
<table border="0" cellspacing="2" width="100%" align=left height="320" bordercolor="#000000" bgcolor="#339966">
<tr bgcolor="#339966">
<td width="100%" align=center height="31"><font color="#804000"><span style="font-size: 11pt"><font color="#FFFFFF">留言本發生錯誤</font></span></font></td>
</tr>
<tr>
<td width="100%" align=left height="247" bgcolor="#F7F7F7"><span style="font-size: 11pt">
<p align="center"> 出錯原因:<font color="#FF0000"><? echo $msg;?></font></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>
</span></td>
</tr>
<tr bgcolor="#339966" bordercolor="#000000">
<td width="100%" height="30">
<p align="right"><font color="#339966"><span
style="font-size: 9pt">Copyright 200x ztsky <font face="Arial">.Allrights reserved.</font></span>
</font>
</td>
</tr>
</table>
</td></tr></table></td></tr></table></center></body></html>
<?
}
function output($line,$no){
$info=explode("|!:!|",$line);
global $name;
global $admin;
global $user;
?>
<center><TABLE a bgColor=#000000 border=0 cellPadding=0 cellSpacing=0 height=1 width='90%'>
<TR bgColor=#ffffff width="100%"><TD bgColor=#000000 height=1 width="100%">
<TABLE border=0 cellPadding=3 cellSpacing=1 height=8 width="100%"><TBODY><TR>
<TD bgColor=#f7f7f7 height=8 rowSpan=3 vAlign=top width=155>
<TABLE><font color="#000000">留言:NO.<?echo$no;?></font>
<TBODY></TBODY></TABLE><div align="center"><center><TABLE border=0 cellPadding=0 cellSpacing=0>
<TBODY><TR><TD align=middle><font color="#000000"><img src="<?echo$info[3];?>" width="32" height="32"></font></TD></TR></TBODY></TABLE></center></div>
<P>姓名:<font color="#000000"><?echo$info[2];?></font><BR>來自:<font color="#000000"><?echo$info[7];?></font><BR>郵件:<a href="mailto:<?echo$info[4];?>" title="給<?echo$info[2];?>發信"><IMG border=0 src="<?echo$admin[img];?>/mail.gif"> 郵件</a><BR>主頁:<a href="<?echo$info[5];?>" target="_blank" title="訪問<?echo$info[2];?>的主頁"><IMG border=0 src="<?echo$admin[img];?>/home.gif"> 主頁</a> <BR></P></TD>
<TD bgColor=#ffffff height=1 width=503><IMG src="<?echo$admin[img];?>/1.gif" width="18" height="18"> 發表于:<?echo$info[8];?>
<TR><TD bgColor=#ffffff height=95 width=503><TABLE border=0 cellPadding=3 cellSpacing=0 height="100%" width="100%"><TBODY><TR><TD vAlign=top width="100%" height="94"><font color="#0080FF"><?echo$info[1];?></font></TD></TR></TBODY></TABLE><TR>
<TD bgColor=#f7f7f7 height=10 width=503> <a href="mailto:<?echo$info[4];?>" title="給<?echo$info[2];?>發信"><IMG border=0 src="<?echo$admin[img];?>/mail.gif"> 郵件</a> <a href="<?echo$info[5];?>" target="_blank" title="訪問<?echo$info[2];?>的主頁"><IMG border=0 src="<?echo$admin[img];?>/home.gif"> 主頁</a> <img src=http://icon.tencent.com/<?echo$info[6];?>/s/00/ alt=<?echo$info[2];?>的OICQ:<?echo$info[6];?> width=16 height=16> OICQ <IMG alt=<?echo$info[2];?>的IP地址是:<?echo$info[7];?> border=0 src="<?echo$admin[img];?>/ip.gif" width="13" height="15"> IP
<a href="<?echo$PHP_SELF;?>?action=reply&user=<?echo$user;?>&id=<?echo$info[0];?>" title="回復該留言(只有版主才有回復的權利?。?quot;><IMG border=0 src="<?echo$admin[img];?>/replay.gif"> 回復</a>
<a href="<?echo$PHP_SELF;?>?action=del&user=<?echo$user;?>&id=<?echo$info[0];?>" title="刪除該留言"><IMG border=0 src="<?echo$admin[img];?>/del.gif"> 刪除</a></TD></TR></TBODY></TABLE></TR></TABLE></CENTER>
<?
}
####################################函數完成#############################################
#########################################################################################
####################################程序部分#############################################
if(empty($user))$user="main";
$file="$admin[path]/$user.dat";
if(!file_exists($file)) error("對不起,沒有找到這個用戶的留言簿,<a href=$PHP_SELF>不如您申請一個吧</a>!");
else{
if($user<>"main") include("$admin[path]/$user.php");
if($action=="add"){
if($addsub){
$name=Chop($name);
$msg=str($msg);
if($msg=="" or $name=="")error("不是吧,你的名字和留言都不寫,還叫做什么“留言”啊!");
elseif(!oicq($oicq))error("你的OICQ好像有錯??!");
else{
if($sex=="boy")$sex="$admin[img]/01.gif";
else $sex="$admin[img]/02.gif";
if($oicq=="")$oicq="未知";
if($home=="")$home="未知";
if($mail=="")$mail="未知";
$data=fopen("$admin[path]/$user.dat","r");
$num=Chop(fgets($data,15));
$num++;
$old=fread($data,filesize($file));
fclose($data);
$id=getid();
$time=nowtime();
$ip=$REMOTE_ADDR;$ip2=explode(".",$ip);$ip="$ip2[0].$ip2[1].$ip2[2].xxx";
$writemsg="$num\n$id|!:!|$msg|!:!|$name|!:!|$sex|!:!|$email|!:!|$home|!:!|$oicq|!:!|$ip|!:!|$time\n$old";
$data=fopen($file,"w");
fwrite($data,$writemsg);
fclose($data);
$cookietime=time()+31536000;
setcookie(ex_user_home,$home,$cookietime);
setcookie(ex_user_mail,$email,$cookietime);
setcookie(ex_user_name,$name,$cookietime);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -