Conn. php file:
<! -- This page is a public file used to connect to the database... -->
<? PHP
// Connect to the database
$ Conn = mysql_connect ("localhost", "root", "") or die ("database connection failed ");
Mysql_select_db ("cql", $ conn) or die ("database selection failed. Check whether the data exists ....");
Mysql_query ('set names utf8 ');
?>
Index. php file:
<? PHP
Session_start ();
Include "conn. php ";
// <! -- Index. php... -->
// Check for Logon
If ($ _ session ['user _ name'] = "" | $ _ session ['user _ id'] = "")
{
Echo "<SCRIPT> alert ('You are not logged on, please log on! '); Location. href = 'login. php'; </SCRIPT> ";
}
// Click to exit
If ($ _ Get [out])
{
Unset ($ _ session [user_name]);
Unset ($ _ session [user_id]);
Echo "<SCRIPT> window. Close (); </SCRIPT> ";
}
?>
<! 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 = UTF-8"/>
<Title> untitled document </title>
<Script language = "JavaScript">
VaR Ajax = false;
Try {
Ajax = new activexobject ("msxml2.xmlhttp ");
} Catch (e ){
Try {
Ajax = new activexobject ("Microsoft. XMLHTTP ");
} Catch (e ){
Ajax = false;
}
}
If (! Ajax & typeof XMLHttpRequest! = 'Undefined '){
Ajax = new XMLHttpRequest ();
}
Function getnews (newsid)
{
If (typeof (newsid) = 'undefined ')
{
Return false;
}
VaR url = "show. php? Id = "+ newsid;
VaR show = Document. getelementbyid ("show_news ");
// Alert (show );
Ajax. Open ("get", URL, true );
Ajax. onreadystatechange = function (){
If (Ajax. readystate = 4 & Ajax. Status = 200 ){
Show. innerhtml = Ajax. responsetext;
// Alert (Ajax. responsetext );
}
}
Ajax. Send (null );
}
</SCRIPT>
</Head>
<Body>
Welcome! <A href = "show_user.php? Id = <? PHP echo $ _ session [user_id]?> "> View my information </a>
<? PHP
$ Query = mysql_query ("select * From 'zf '");
$ Num = mysql_num_rows ($ query );
If ($ num = 0)
{
Echo "<center> <font size = \" + 2 \ "> sorry, no related content... </font> </center> ";
} Else {
?>
<Table cellspacing = 1 cellpadding = 3 width = "99%" bgcolor = #6298e1 border = 0>
<Tbody>
<Tr>
<TD nowrap background = admin_poli.files/th_bg.gif Height = 25> <font
Color = # ffffff> <strong> <font size = "+ 0"> current page </font> </strong> </font>
</TD> </tr>
<Tr>
<TD nowrap align = middle bgcolor = # ebf2f9 Height = 30>
<Table cellspacing = 0 width = "99%" border = 0>
<Tbody>
<Tr>
</Tr> </tbody> </table> </TD> </tr> </tbody> </table>
<Table cellspacing = 1 cellpadding = 0 width = "99%" border = 0>
<Tbody>
<Tr>
<TD Height = 30> </TD> </tr> </tbody> </table>
<Table cellspacing = 1 cellpadding = 3 width = "99%" bgcolor = #6298e1 border = 0>
<Form name = formdel action =? Result = photo method = post>
<Tbody>
<Tr>
& Lt; TD width = "5%"
Height = 25 align = middle nowrap background = admin_poli.files/th_bg.gif> <font color = # ffffff> <strong> NO. </strong> </font> </TD>
& Lt; TD width = "5%"
Height = 25 align = middle nowrap background = admin_poli.files/th_bg.gif> <font color = # ffffff> <strong> id </strong> </font> </TD>
<TD width = "10%" align = middle nowrap background = admin_poli.files/th_bg.gif> <font
Color = # ffffff> <strong> title </strong> </font> </TD>
<TD width = "19%" align = middle nowrap background = admin_poli.files/th_bg.gif> <font
Color = # ffffff> <strong> content </strong> </font> </TD>
& Lt; TD width = "5%" align = middle nowrap
Background = admin_poli.files/th_bg.gif> <strong> <font color = "# ffffff"> uploaded by </font> </strong> </TD>
& Lt; TD width = "7%" align = middle nowrap
Background = admin_poli.files/th_bg.gif> <strong> <font
Color = # ffffff> release date </font> </strong> </TD>
& Lt; TD width = "5%" align = middle nowrap
Background = admin_poli.files/th_bg.gif> <strong> <font
Color = # ffffff> source </font> </strong> </TD>
& Lt; TD width = "4%" align = middle nowrap
Background = admin_poli.files/th_bg.gif> <strong> <font
Color = # ffffff> clicks </font> </strong> </TD>
& Lt; TD width = "5%" align = middle nowrap
Background = admin_poli.files/th_bg.gif> <strong> <font
Color = # ffffff> comments </font> </strong> </TD>
& Lt; TD width = "4%" align = middle nowrap
Background = admin_poli.files/th_bg.gif> <strong> <font
Color = # ffffff> classification </font> </strong> </TD>
</Tr>
<? PHP
$ Each_page = 8;
If ($ _ Get [Page] = NULL ){
$ Page = 1;
} Else {
$ Page = $ _ Get [Page];
}
$ All_page = Ceil ($ num/$ each_page );
$ Pagestar = ($ page-1) * $ each_page;
$ Sq = mysql_query ("select * From 'zf 'order by 'zf _ uptime' DESC limit $ pagestar, $ each_page ");
While ($ arr = mysql_fetch_array ($ sq ))
{
?>
<Tr onmouseover = "This. style. backgroundcolor = '# ffff'" style = "cursor: hand"
Onmouseout = "This. style. backgroundcolor ='' "bgcolor = # ebf2f9>
<TD nowrap align = Middle Height = 24> 161 </TD>
<TD nowrap align = Middle Height = 24> <? PHP echo $ arr [zf_id]?> </TD>
<TD nowrap> <a href = "#" onclick = "getnews (<? PHP echo $ arr [zf_id]?>) ">
<? PHP echo $ arr [zf_title]?> </A> </TD>
<TD nowrap align = middle> <? PHP // echo cut_str ($ arr [zf_content], 20,0). "..."?> </TD>
<TD nowrap align = middle> <? PHP echo $ arr [zf_upname]?> </TD>
<TD nowrap align = middle> <? PHP echo $ arr [zf_uptime]?> </TD>
<TD nowrap align = middle> <? PHP echo $ arr [zf_resource]?> </TD>
<TD nowrap align = middle> <? PHP echo $ arr [zf_djtimes]?> </TD>
<TD nowrap align = middle> <? PHP echo $ arr [zf_pltimes]?> </TD>
<TD nowrap align = middle> <? PHP echo $ arr [zf_type]?> </TD>
</Tr>
<? PHP }?>
<Tr>
<TD nowrap bgcolor = # d7e4f7 colspan = 13>
<Table cellspacing = 0 cellpadding = 0 width = "100%" align = center border = 0>
<Tbody>
<Tr>
<TD> total: <font color = # ff6600> <? PHP echo $ num?> </Font> Records & nbsp; Page times: <font
Color = # ff6600> <? PHP echo $ page?> </Font> </strong>/<? PHP echo $ all_page?> & Nbsp; per page: <font
Color = # ff6600> 8 </font> entries
<? PHP
Echo "Current page:". $ page;
If ($ page <= 1 );
Else
Echo "<a href = \"? Page = ". ($ page-1)." \ "> previous page </a> ";
If ($ page >=$ all_page );
Else
Echo "<a href = \"? Page = ". ($ page + 1)." \ "> next page </a> ";
/* Echo "<input type = \" button \ "value = \" homepage \ "onclick = \" location. href = '? Page = 1 & type = ". $ _ Get ['type']." '\ "/> ";
* // * Echo "<input type = \" button \ "value = \" Last Page \ "onclick = \" location. href = '? Page = ". ($ all_page)." & type = ". $ _ Get ['type']." '\ "/> ";*/
?>
</TD>
</Tr> </tbody> </table> </TD> </tr> </form> </tbody> </table>
<? PHP
}
?>
<Div id = "show_news"> </div>
</Body>
</Html>
Show. php file:
<? PHP
Include "conn. php ";
Echo "select * From 'zf 'where 'zf _ id' = $ _ Get [ID]";
$ Sq = mysql_query ("select * From 'zf 'Where 'zf _ id' = $ _ Get [ID]");
While ($ arr = mysql_fetch_array ($ sq ))
{
Echo "<br> <font color = \" # 00ccff \ "> title:". $ arr [zf_id]. "</font> <br> ";
Echo "Author:". $ arr [zf_upname]. "<br> ";
Echo "content:". $ arr [zf_content]. "<br> ";
}
?>