############### Index. php ######################
<? Session_start ();
Require "./inc/func. php ";
Mscon ();
Require "./inc/header. inc ";
?>
<Script language = "javascript">
Function opwin (filename)
{Window. open ("read_article.php? Id = "+ filename," "," height = 500, width = 585, resizable = no, scrollbars = yes, status = no, toolbar = no, menubar = no, location = no ");
}
</Script>
</Head>
<Body bgcolor = "# FFFFFF" text = "#000000" leftmargin = "0" topmargin = "0">
<Table width = "100%" border = "0" cellspacing = "0" cellpadding = "0" bgcolor = "#003399" height = "23">
<Tr>
<Td width = "80">
<Div id = "Layer2" style = "position: absolute; left: 7px; top: 17px; width: 43px; height: 44px; z-index: 2 "> <object classid =" clsid: D27CDB6E-AE6D-11cf-96B8-444553540000 "codebase =" http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0 "width =" 80 "height =" 60 ">
<Param name = movie value = "images/logo.swf">
<Param name = quality value = high>
<Param name = "wmode" value = "transparent">
<Embed src = "images/logo.swf" quality = high pluginspage = "http://www.macromedia.com/shockwave/download/index.cgi? P1_Prod_Version = ShockwaveFlash "type =" application/x-shockwave-flash "width =" 80 "height =" 60 "wmode =" transparent ">
</Embed>
</Object> </div>
<Div id = "Layer1" style = "position: absolute; left:-5px; top: 61px; width: 49px; height: 37px; z-index: 1 "> </div>
</Td>
<Td width = "539"> <object classid = "clsid: D27CDB6E-AE6D-11cf-96B8-444553540000" codebase = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width = "468" height = "60">
<Param name = movie value = "images/ti1.swf">
<Param name = quality value = high>
<Param name = "wmode" value = "transparent">
<Embed src = "images/ti1.swf" quality = high pluginspage = "http://www.macromedia.com/shockwave/download/index.cgi? P1_Prod_Version = ShockwaveFlash "type =" application/x-shockwave-flash "width =" 468 "height =" 60 "wmode =" transparent ">
</Embed>
</Object> </td>
</Tr>
</Table>
<Table width = "100%" border = "0" cellspacing = "0" cellpadding = "0">
<Tr>
<Td background = "images/211.gif" height =" 2 "> </td>
</Tr>
</Table>
<Table> <FORM name = form1 action = search. php method = post target = _ blank>
<Table width = "80%" border = "0" cellspacing = "0" cellpadding = "0" bgcolor = "#009933" align = "center">
<Tr>
<Td align = "center">
<Input type = "text" name = "key">
<Select name = "type">
<Option value => all categories </option>
<? $ Typ = file ("list.txt ");
$ Num = count ($ typ );
For ($ I = 2; $ I <= $ num; $ I ++)
{
Echo "<option value = $ typ [$ I]> $ typ [$ I] </option> ";}
?>
</Select>
<Select name = "whe">
<Option value => all content </option>
<Option value = 1> Article content </option>
<Option value = 2> Article Title </option>
<Option value = 3> Add time </option>
</Select>
<Input type = "hidden" name = "submit" value = "1">
<Input type = "submit" name = "submit" value = "submit query">
</Td>
</Tr>
</Table>
</FORM> </table>
<?
$ Type = trim ($ type );
If ($ comm)
{
$ Sec = "and comm = 1 ";
$ Fir = "where comm = 1 ";
}
If (! Empty ($ type ))
$ Query = "select count (*) from $ table where type = '$ type' $ sec ";
Else
$ Query = "select count (*) from $ table $ fir ";
$ Res = mysql_db_query ("$ database", $ query );
If (@ mysql_num_rows ($ res)> 0)
$ Tot = mysql_fetch_array ($ res );
$ Total = $ tot [0];
$ Total_page = ceil ($ total/$ pagenum );
Echo "<table width =" 80% "border =" 0 "cellspacing =" 0 "cellpadding =" 0 "align = center> ";
Echo "<tr> <td> total:". $ total. "". $ total_page. "page </td> </tr> ";
If (empty ($ page ))
$ Page = 0;
If (empty ($ offset ))
$ Offset = 0;
$ Offset = $ pagenum * $ page;
If (! Empty ($ type ))
$ Query = "select * from $ table where type = '$ type' $ sec order by id desc limit $ offset, $ pagenum ";
Else
$ Query = "select * from $ table $ fir order by id desc limit $ offset, $ pagenum ";
$ Res = mysql_db_query ("$ database", $ query );
If (@ mysql_num_rows ($ res)> 0)
While ($ topic = mysql_fetch_array ($ res ))
{
If (strlen ($ topic [title])> 40)
{
$ Topic [title] = substr ($ topic [title], 0, 40 );
$ Topic [title] = $ topic [title]. "......";
}
If (trim ($ topic [time]) = date (Y, m, D ))
$ Topic [time] = "<font color = # FF9900> $ topic [time] </font> ";
Echo "<tr> <td> [$ topic [type] <a href = # onClick =" opwin ($ topic [id]) ";> $ topic [title] </a> <font size = 1> ($ topic [time]) </font> ";
If ($ topic [comm] = 1)
Echo " ";
If ($ topic [locked] = 1)
Echo " ";
Echo "</td>
<Td> Read: $ topic [hits] times; Comment: $ topic [p_num] Times </td>
</Tr> ";
}
Else
Echo "sorry, there are no articles in this column !!! ";
Echo "</table> ";
?>
<Br>
<Table width = "80%" border = "0" cellspacing = "0" cellpadding = "0" align = "center">
<Tr>
<Td>
<?
$ Pre = $ page-1;
$ Next = $ page + 1;
If ($ page> 0)
Echo "<a href =" $ php_self? Page = $ pre & type = $ type "> previous page </a> <br> ";
Else
Echo "Previous Page <br>" ;?> </Td>
<Td> <? If ($ page <$ total_page-1)
Echo "<a href =" $ php_self? Page = $ next & type = $ type "> next page </a> <br> ";
Else echo "next page <br>" ;?> </Td>
<Td>
<Form> jump:
<Select name = "page" onchange = "top. location = '<? Echo $ php_self;?>? Page = '+ document. forms [1]. elements [0]. value +' & type = <? Echo $ type;?> '; "Class =" border ">
<?
For ($ I = 0; $ I <$ total_page; $ I ++)
{
$ P = $ I + 1;
Echo "<option value = $ I ";
If ($ page = $ I) echo "selected ";
Echo "> page". $ p. "</option> n ";
}
?>
</Select> </form>
</Td>
<Td>
<Form> select a topic:
<Select name = "type" onchange = "top. location = '<? Echo $ php_self;?>? Type = '+ document. forms [2]. elements [0]. value <? If ($ comm) echo "+ '& comm = 1'";?>; ">
<? $ Typ = file ("list.txt ");
$ Num = count ($ typ );
For ($ I = 0; $ I <$ num; $ I ++)
{
Echo "<option value = $ typ [$ I]"; if (trim ($ typ [$ I]) ==$ type) {echo "selected ";} echo "> $ typ [$ I] </option> ";}
?>
</Select>
</Form>
</Td> <form method = "post" action = <? Echo $ PHP_SELF;?>? Type = <? Echo $ type;?> Target = "_ balnk"> <input type = "submit" name = "comm" value = "excellent article" class = border> </form> </td>
</Tr>
</Table>
<? Require "./inc/footer. inc";?>
##################### Read_article.php ################## #######
<?
Require "./inc/func. php ";
If (! $ Id)
{
Echo "<script> window. close (); </script> ";
Exit ();
}
Mscon ();
$ Query = "select * from $ table where id = '$ id '";
$ Res = mysql_db_query ("$ database", $ query );
If (! $ Res)
{
Echo "this article has been deleted or no this article !! ";
Exit ();
}
$ Data = mysql_fetch_array ($ res );
Add_hits ($ data [id]);
$ Pre = $ data [id]-1;
$ Next = $ data [id] + 1;
?>
<HTML>
<HEAD>
<TITLE>
<? Echo "$ data [title] -- [$ data [type]";?>
</TITLE>
<META http-equiv = Content-Type content = "text/html; charset = gb2312">
<Style type = text/css>
<! --
Body, table, td, input, textarea {font-family: ""; font-size: 9pt}
Select {font-family: ""; font-size: 9pt}
Code {font-family: "Courier"; font-size: 10pt}
A {color :# 005500}
A: hover {color: # CC0000}
. Border {border: 1px #000000 solid; background-color: transparent; list-style-position: inside; list-style-type: square}
-->
</Style>
<Script language = "javascript">
Function name ()
{
Var theResult = true;
Var elem4 = null;
If (document. forms [0]. elements [0]. value = "" | document. forms [0]. elements [0]. value = "undefined" | document. forms [0]. elements [0]. value = "null ")
{
Elem4 = prompt ("enter your name :","");
TheResult = false;
Document. forms [0]. elements [0]. value = elem4;
}
Return theResult;
}
Function mail ()
{
Var theResult = true;
Var elem1 = null
If (document. forms [0]. elements [1]. value. indexOf ('@') =-1 | document. forms [0]. elements [1]. value = "" | document. forms [0]. elements [1]. value. indexOf ('. ') =-1 ))
{
Elem1 = prompt ("Enter your correct email address. Thank you !! ","");
TheResult = false;
Document. forms [0]. elements [1]. value = elem1;
}
Return theResult;
}
Function go ()
{
Var theResult = true;
TheResult = name () & mail ();
Return theResult;
}
</Script>
</HEAD>
<BODY text = #000000 bgColor = # ffffff>
<TABLE borderColor = #339933 cellSpacing = 0 borderColorDark = # ffffff
CellPadding = 0 align = center borderColorLight = #000000 border = 1 width = 545>
<TBODY>
<TR vAlign = center bgColor = #009900>
<TD background = images/third-back3.gif>
<TABLE cellSpacing = 0 cellPadding = 0 width = 100% border = 0>
<TBODY>
<TR>
<TD width = 17> </TD>
<TD width = 590>
<TABLE width = "36%" align = center border = 0>
<TBODY>
<TR>
<TD bgcolor = "#009900">
<DIV align = center> <FONT face = "Verdana, Arial, Helvetica, sans-serif" color = # ffffff> <B>
<? Echo $ data [title];?>
</B> </FONT> </DIV>
</TD> </TR> </TBODY> </TABLE> </TD>
<TD width = 19>
<DIV align = center> <A href = "javascript: window. close ()"> Src = "images/third-close.gif" width = 17 align = absMiddle
Border = 0 name = content_r03_c28> </A> </DIV>
</TD> </TR> </TBODY> </TABLE> </TD> </TR>
<TR vAlign = center align = left bgColor = # cccccc>
<TD>
<TABLE cellSpacing = 0 cellPadding = 0 border = 0 align = "center" width = "100%">
<TBODY>
<TR>
<TD>
<DIV align = left> <A class = whitetxt
Href = "read_article.php? Id = <? Echo $ pre;?> "> </A> </DIV>
</TD>
<TD>
<DIV align = left> <a class = whitetxt
Href = "read_article.php? Id = <? Echo $ next;?> "> </a> </DIV>
</TD>
<TD> Height = 16 src = "images/mail.gif" width = 16> </TD>
<TD class = myfont> <A class = redtxt
Href = "commend. php? Id = <? Echo "$ data [id] & title = $ data [title]";?> "> Recommended to friends </A> </TD>
<TD> posting time:
<? Echo $ data [time];?>
Times of reading:
<? Echo $ data [hits];?>
</TD>
<TD> </TD>
</TR>
</TBODY>
</TABLE>
</TD> </TR>
<TR vAlign = top>
<TD class = tenpt>
<?
If ($ data [locked] <> 0)
{
Echo " sorry! This article has been locked by the administrator! ";
}
Else
If ($ data [html] = 1)
Highlight_string ($ data [cont]);
Else
Echo nl2br ($ data [cont]);
?>
</TD>
</TR>
</TBODY> </TABLE>
<Table bordercolor = #339933 cellspacing = 0 bordercolordark = # ffffff
Cellpadding = 0 align = center bordercolorlight = #000000 border = 1 width = 545>
<Tbody>
<TR bgColor = # cccccc>
<Th>
<DIV align = center> post comments </DIV>
</Th>
</TR>
<Tr>
<Td>
<Form name = "form1" method = "post" action = "ping. php" onsubmit = "return go ()">
Your name:
<Input type = "text" name = "name" class = "border">
Your email:
<Input type = "text" name = "mail" size = 20 class = "border">
Only visible to webmasters: <input type = "checkbox" name = "pub" value = "<? Echo $ data [title];?> ">
<Input type = "hidden" name = "p_id" value = "<? Echo $ id;?> ">
<Br>
Comment:
<Textarea name = "cont" rows = "8" cols = "85"> </textarea>
<Br>
<Br>
<Center>
<Input type = "submit" name = "Submit" value = "submit" class = "border">
<Input type = "reset" name = "Submit2" value = "Override" class = "border">
</Center> </form>
</Td>
</Tr>
<TR bgColor = # cccccc>
<Th>
<DIV align = center> related comments </DIV>
</Th>
</TR>
<Tr>
<Td>
<? $ Query = "select * from $ ping_tab where p_id = '$ id' order by time desc ";
$ Res = mysql_db_query ("$ database", $ query );
If (mysql_num_rows ($ res)> 0)
{$ I = 1;
While ($ ping = mysql_fetch_array ($ res ))
Echo "reviewer: $ ping [name] Email: $ ping [mail] <br> ". nl2br ($ ping [p_cont]). "<br> time: $ ping [time] From: $ ping [ip] }
Else
Echo "no comments for this article! ";
?>
</Td>
</Tr>
<Tr bgcolor = # cccccc>
<Td>
<Div align = center> <
Href = "javascript: window. close ()"> close the window </a> </div>
</Td>
</Tr>
</Tbody>
</Table>
<? Require "./inc/footer. inc";?>