欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

不需要数据库支持的php留言簿_PHP教程

程序员文章站 2022-05-30 13:40:09
...
代码如下:

/*

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")));
?>

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/532227.htmlTechArticle代码如下: /* 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 directo...