A paginated text-based PHP message board source Code 1th 2 page _php tutorial

Source: Internet
Author: User
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 ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.