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