echo date("Y m d h:i:s");
/*****************************************************************
歡迎需要者自由下載使用。本程式依 GNU GPL 開放原始碼。
若因個人需求, 可自行修改程式, 但請保留本段作者及版權宣告等內容。
****************************************************************
程式名稱: guest.php
程式目的: 簡易留言板
程式版本: 1.00 2004-02-05 pare@mail.batol.net
****************************************************************
請務必在程式同一目錄建立一留言版資料檔名為 guest.dat
並設定該檔權限為 0777
變更權限指令: chmod 0777 guest.dat
****************************************************************/
// 寫入留言函式 **********
function guestsave() {
global $taiwan, $nickname, $email, $note, $HTTP_SERVER_VARS;
if (empty($HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"])) {
$from_addr = $HTTP_SERVER_VARS["REMOTE_ADDR"];
}
else {
$from_addr = $HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"];
}
$t = date("Y/m/d H:i:s");
$note = htmlspecialchars($note);
$note = str_replace ("∥","│", $note);
$note = str_replace ("\r\n","
", $note);
$note = str_replace ("\n","
", $note);
$note = stripslashes($note);
$taiwan = stripslashes($taiwan);
$nickname = str_replace ("∥","│", $nickname);
$nickname = stripslashes($nickname);
$email = str_replace ("∥","│", $email);
$main = $nickname."∥".$email."∥".$t."∥".$note."∥".$from_addr."\n";
$f = fopen("guest.dat","a");
fwrite($f,$main);
fclose($f);
}
// end of function guestsave() *******
$perPage = 20; #設定分頁, 每頁幾筆留言
if (empty($number)) {
$number = $perPage;
}
?>
現有 筆, 筆 |
|
for ($i=($count-1); 0 <= $i; $i--) {
$line[] = $lines[$i];
}
for ($i = 0; $i < $count; $i++) {
if ($i >= ($number-$perPage) && $i < $number) {
echo " "; list($username,$taiwan,$email,$date,$mess,$rip)=explode("∥",$line[$i]); if ($email) { $username="$username"; } if ($rip) { $rip = chop($rip); $rip=" From [$rip]"; } if ($mess) { echo "($taiwan) $username 說: ($date) $rip \n"; echo "$mess"; echo "\n"; } } } if ($count > $perPage) echo " "; ?> |