Little Brother Beginner PHP, made up a message board program, self-feeling good, so thick cheek put up, please the eldest brother correct. The source program is as follows:
File name: guest.php
Settings section
$guestfile = "Guest";//The text file of the record message
$home = "index.html";//home page returned
$imagedir = "image"; Directory of image files
$backimage = $imagedir. " /bk.gif ";//Background image
$backcolor = "#ceffff";//Background color, which works when $backimage= ""
?>
if ($QUERY _string!= "") {
$page = $QUERY _string;
} else {
$page = 1;
}
if ($mode = = "Add") {
$name =htmlspecialchars (Trim ($name));
$title =htmlspecialchars (Trim ($title));
$data =nl2br (Htmlspecialchars ($data));
$data =str_replace ("R", "", $data);
$data =str_replace ("x0a", "", $data);
$data =str_replace ("", "", $data);
if ($data = = "") $data = "";
$e _mail=trim ($e _mail);
if ($e _mail== "") $e _mail=0;
$url =trim ($url);
if ($url = = "http:/" | | $url = = "") $url = 0;
$time =date ("Y"). " ". Date (" M ")." Month ". Date (" D ")." Day [". Date (" H ").": ". Date (" I ").": ". Date (" S ")."] ";
if ($name = = "" | | $title = = "") {
echo "n ";
Exit
}
$adddata = $name. " T ". $e _mail." T ". $url." T ". $title." T ". $data." T ". $icon." T ". $time." n ";
if (file_exists ($guestfile)) {
$filebuffer =file ($guestfile);
if (sizeof ($filebuffer) >100) {
for ($i =0; $i <100; $i + +)
$newbuffer [i]= $filebuffer [i];
}
else{
$newbuffer = $filebuffer;
}
$FP =fopen ($guestfile, "w");
Fputs ($fp, $adddata);
Fclose ($FP);
$buffer =implode ("", $newbuffer);
$FP =fopen ($guestfile, "a");
Fputs ($fp, $buffer);
Fclose ($FP);
}
else{
$FP =fopen ($guestfile, "w");
Fwrite ($fp, $adddata);
Fclose ($FP);
}
}
?>
<title>Message boards</title>
if ($backimage! = "" "&& file_exists ($backimage)) {
echo "n ";
}
else{
echo "n ";
}
?>
Power 9901 on-line space message board
|
">[Back Home" |
Name:
E_Mail:
Home:
Message title:
Message content: (HTML not supported)
Expression:
"Width=" "height=" >
"Width=" "height=" >
"Width=" "height=" >
"Width=" "height=" >
"Width=" "height=" >
http://www.bkjia.com/PHPjc/318062.html www.bkjia.com true http://www.bkjia.com/PHPjc/318062.html techarticle Little Brother Beginner PHP, made up a message board program, self-feeling good, so thick cheek put up, please the eldest brother correct. The source program is as follows:? PHP//File name: guest.php//settings section ...