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)
Copy codeThe Code is as follows:
<? Php
Mysql_connect ("localhost", "root", ""); // connect to the database
Mysql_select_db ("lyb"); // select a database
?>
2. header. php (Public header file)
Copy codeThe Code is as follows:
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"/>
<Title> Silver Message Board Version 1.0 </title>
</Head>
<Link href = "css.css" rel = "stylesheet" type = "text/css"/>
<Body>
<Div id = "head">
<Div id = "head_l">
<Ul>
<Li> <a href = "index. php"> Leave a message </a> </li>
<Li> <a href = "post. php"> occasionally published </a> </li>
<? Php
Session_start ();
If ($ _ SESSION ["key"] = 1) {// if the obtained SESSION is 1, the management item is displayed.
?>
<Li> <a href = "adminexit. php"> exit management </a> </li>
<?
}
Else
{
?>
<Li> <a href = "admin. php"> occasionally managed </a> </li>
<?}?>
</Ul>
</Div>
<Div id = "head_r"> Silver Message Board Version 1.0 </div>
</Div>
3. footer. php (Public bottom file)
Copy codeThe Code is as follows:
<? Php
$ CounterFile = "conter. xml ";
Function displayCounter ($ counterFile ){
$ Fp = fopen ($ counterFile, "rw ");
$ Num = fgets ($ fp, 5 );
$ Num + = 1;
Print "<div id = \" footer \ "> Silver Message Board Version 1.0". "$ num". "bored silver </div> ";
Exec ("rm-rf $ counterFile ");
Exec ("echo $ num> $ counterFile ");
}
If (! File_exists ($ counterFile )){
Exec ("echo 0> $ counterFile ");
}
DisplayCounter ($ counterFile );
?>
</Body>
</Html>