Because domestic MySQL resources are relatively tight, foreign ones are either too slow or not open to Chinese users. Therefore, in the days without MYSQL, we wanted to do something to facilitate others and improve our own site, which was simply harder than reaching the sky. In order to get rid of this pain, Niky cried and meditated, and worked behind closed doors. Finally, the emperor paid off, A simple guestbook that does not require MYSQL database support is launched. Let’s call it gbook.php for now. The source program is as follows:
if ($message)
{
$message = ereg_replace( "rnrn", "n
", $message);
//Remove invalid control symbols
$date = date( "l, F j Y, h:i a "); //Get the specified date and time format
$ip=getenv("REMOTE_ADDR");
$message = "
$name | ="25%">$email
Written on --$date | ;from>>$ip
$subject td> |
$massage |
fp, $message);
fclose ($fp);
}
@readfile(basename(($PHP_SELF . ".comment")));
//Read the content of the record file
?>
────────────────────── ───────────────
The principle of the above program is: on the PHP side, first determine whether the message variable exists. If it does not exist, read the file using the readfile function. . As for the extraction of the file name, a clever method is used here (using the $PHP_SELF variable to extract the absolute location of the file, then using the basename() function to extract the file name, and adding the specified file tail comment.). In order to better learn PHP & MySQL, I specially share it with everyone. I also hope that Internet users who have experienced the same pain as Niky can have a guestbook of their own, instead of "xxx guestbook is provided by xxx.com." What a shame. What are you waiting for? Act quickly!
Copyright ©2000 niky All rights reserved. If you need to reprint, please indicate the author and source]
http://www.bkjia.com/PHPjc/316565.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/316565.htmlTechArticleDue to the tight domestic MySQL resources, foreign ones are either too slow or not open to Chinese users. Therefore, in the days without MYSQL, we wanted to do something to facilitate others and improve our own site...