Website management, file name: guanli. php
<Html>
<Head>
<Title> Untitled Document </title>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312">
</Head>
<Body bgcolor = "# FFFFFF" background = "image/b-graingr2.jpg">
<Table width = "775" border = "0">
<Tr>
<Td width = "101" height = "463" valign = "top">
<P> </p>
<P> </p>
<P> <a href = "muban. php "> </a> </p>
<P> </p>
<P> </p>
<P> </p>
<P> </p>
</Td>
<Td width = "663" height = "463" valign = "top">
<Table width = "95%" border = "0" align = "center" height = "234">
<Tr>
<Td height = "43">
<Div align = "center"> <B> <font color = "#480000" size = "6"> Page Management </font> </B> </div>
</Td>
</Tr>
<Tr valign = "top">
& Lt; td height = "267" & gt;
<? Php
// Start the program
$ Db = mysql_connect ("localhost", "root ");
Mysql_select_db ("study", $ db );
// Determine whether the file is modified
If ($ submit ){
$ SQL = "UPDATE wenzhang SET timu = $ timu, zuozhe = $ zuozhe,
Laiyuan = $ laiyuan, textt = $ textt WHERE id = $ id ";
// Issue SQL commands to the database
$ Result = mysql_query ($ SQL );
// Document generation
$ T = date ("Y-m-d h: I: s ");
$ Muoban1 = fopen ("muoban1.txt", "r ");
$ Muoban2 = fopen ("muoban2.txt", "r ");
$ Muoban3 = fopen ("muoban3.txt", "r ");
$ Qita = "<p> <table width =" 75% "border =" 0 "align =" center ">
<Tr>
<Td class = p9>
<Div align = "center"> author: <font color = "#306800"> $ zuozhe </font> Source: <font color = "#306800"> $ laiyuan </font>
Time: <font color = "#336600"> $ t </font> </div>
</Td>
</Tr>
</Table> </p> ";
$ Muoban4 = fread ($ muoban1, 1000 );
$ Muoban5 = fread ($ muoban2, 1000 );
$ Muoban6 = fread ($ muoban3, 1000 );
Fclose ($ muoban1 );
Fclose ($ muoban2 );
Fclose ($ muoban3 );
$ Main = "$ muoban4 $ timu $ qita $ muoban5 $ textt $ muoban6 ";
// Document generation
$ Ttt = ". html ";
$ N = $ id. $ ttt;
$ F = fopen ($ n, "w ");
Fwrite ($ f, $ main );
Fclose ($ f );
Echo "record modified successfully! <P> ";
}
// Do we enter the editing and modification status?
If ($ id ){
// We are editing the modification status. for some reasons, select a record.
$ SQL = "SELECT * FROM wenzhang WHERE id = $ id ";
$ Result = mysql_query ($ SQL );
$ Myrow = mysql_fetch_array ($ result );
$ Id = $ myrow ["id"];
$ Timu = $ myrow ["timu"];
$ Zuozhe = $ myrow ["zuozhe"];
$ Laiyuan = $ myrow ["laiyuan"];
$ Textt = $ myrow ["textt"];
// Display the id for editing and modification.
$ Fom1 = "<form method =" post "action =" $ PATH_INFO ">
<Input type = hidden name = "id" value = "$ id">
<Table width = "97%" border = "0" align = "center">
<Tr>
<Td width = "53"> title: </td>
<Td colspan = "3">
<Input type = "text" name = "timu" value = "$ timu" size = "50">
</Td>
</Tr>
<Tr>
<Td width = "53" height = "28"> author: </td>
& Lt; td width = "154" height = "28" & gt;
<Input type = "text" name = "zuozhe" value = "$ zuozhe" size = "20">
</Td>
<Td width = "59" height = "28"> Source: </td>
& Lt; td width = "456" height = "28" & gt;
<Input type = "text" name = "laiyuan" value = "$ laiyuan" size = "20">
</Td>
</Tr>
<Tr>
<Td width = "53"> body: </td>
<Td colspan = "3">
<Textarea name = "textt" cols = "60" rows = "10"> $ textt </textarea>
</Td>
</Tr>
<Tr>
<Td width = "53"> </td>
<Td colspan = "3">
<Input type = "Submit" name = "submit" value = "input information">
</Td>
</Tr>
</Table>
</Form> ";
Echo $ fom1;
}
If (! $ Id ){
// If the status is not modified, the employee list is displayed.
$ Result = mysql_query ("SELECT * FROM wenzhang", $ db );
Printf ("<ul> ");
While ($ myrow = mysql_fetch_array ($ result )){
Printf ("<li> <a href =" %s.html "> % s </a> n ",
$ Myrow ["id"], $ myrow ["timu"]);
Printf ("<a href =" % s? Id = % s "> (modify) </a> <br> </li>", $ PATH_INFO, $ myrow ["id"]);
}
Printf ("</ul> ");}
// End the program
?>
</Td>
</Tr>
<Tr>
<Td height = "32">
<Div align = "right"> <a href = "input. php "> </a> </div>
</Td>
</Tr>
</Table>
</Td>
</Tr>
</Table>
</Body>
</Html>