程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 網頁編程 >> PHP編程 >> 關於PHP編程 >> 不需要數據庫支持的php留言簿

不需要數據庫支持的php留言簿

編輯:關於PHP編程

代碼如下:
/*

annotate.php3

This is a module that can be placed on any php3 page to allow users to add
their comments. The comments are stored in a file in the current directory,
whose name is constructed by adding ".comment" to the calling pages name,
and merged into the calling page dynamically. (The calling page is not
modified.)

I wrote this because I wanted a simple way to add this functionality to my
pages without requiring that mySQL be available.

In the message input, blank lines are converted to paragraph tags. No other
conversions are applied. If you dont want your users to be able to input
html, uncomment the "strip_tags" line.

Note that the directory must be writable by the web server.

Put this module in some convenient location and then embed it in your pages
like so:

require("/some/full/path/annotate.php3");
or, relative to the docroot:
require($DOCUMENT_ROOT . "/relativepath/php3");

Steve Yelvington

*/
if ($message)
{
/* uncomment the next two lines to strip out html from input */
/* $name = strip_tags($name); */
/* $message = strip_tags($message); */
$message = ereg_replace("rnrn", "n
", $message);
$date = date("l, F j Y, h:i a");
$message = "$name -- $date
$message


";
$fp = fopen (basename($PHP_SELF) . ".comment", "a");
fwrite ($fp, $message);
fclose ($fp);
}
@readfile(basename(($PHP_SELF . ".comment")));
?>

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved