Create a simple PHP & MYSQL message board from the classic page _ php instance

Source: Internet
Author: User
Simple and easy-to-understand php + mysql message board database structure: (database name: lyb) Table 1: admin
Field: id (int11) name (varchvr) password (varchvr)

Table 2: lo
Field: id (int11) username (varchvr) sex (varchvr) qq (varchvr) email (varchvr) info (text) ip (varchvr) submit_time (datetime)

1. conn. php (connect to the database file)

The code is as follows:


Mysql_connect ("localhost", "root", ""); // connect to the database
Mysql_select_db ("lyb"); // select a database
?>


2. header. php (public header file)

The code is as follows:






Silver message board Version 1.0






  • Even check the message

  • Even post

  • Session_start ();
    If ($ _ SESSION ["key"] = 1) {// if the obtained SESSION is 1, the management item is displayed.
    ?>
  • Exit Management

  • }
    Else
    {
    ?>
  • Even Management




Silver message board Version 1.0




3. footer. php (public bottom file)

The code is as follows:


$ CounterFile = "conter. xml ";
Function displayCounter ($ counterFile ){
$ Fp = fopen ($ counterFile, "rw ");
$ Num = fgets ($ fp, 5 );
$ Num + = 1;
Print"

Silver message board Version 1.0 You are the first boring silver digit "." $ num "."

";
Exec ("rm-rf $ counterFile ");
Exec ("echo $ num> $ counterFile ");
}
If (! File_exists ($ counterFile )){
Exec ("echo 0> $ counterFile ");
}
DisplayCounter ($ counterFile );
?>




Current 1/4 page1234 Next page

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.