The code is as follows:
/*
Annotate.php3
This is a module so can be placed on any PHP3 page to allow users to add
Their comments. The comments is stored in a file with 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-to add this functionality to my
Pages without requiring that MySQL is available.
In the message input, blank lines is converted to paragraph tags. No Other
Conversions is applied. If you dont want your the users to being able to input
HTML, uncomment the "Strip_tags" line.
Note that the directory must is 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 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")));
?>
http://www.bkjia.com/PHPjc/532227.html www.bkjia.com true http://www.bkjia.com/PHPjc/532227.html techarticle The code is as follows:/* ANNOTATE.PHP3 This is a module, can placed on any PHP3 page to allow users to add their comments. The comments is stored in a file in the current directo ...