Php+mysql's article Management System (II)

Source: Internet
Author: User
Tags add time exit empty mysql net version trim window
MySQL ############## #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>
<body bgcolor= "#FFFFFF" text= "#000000" leftmargin= "0" topmargin= "0" >
<table width= "100%" border= "0" cellspacing= "0" cellpadding= "0" bgcolor= "#003399" height= ">"
<tr>
&LT;TD width= ">"
<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=" height= ">"
<param name=movie value=http://www.163design.net/p/b/"images/logo.swf" >
<param name=quality value=high>
<param name= "wmode" value= "Transparent" >
<embed src=http://www.163design.net/p/b/"images/logo.swf" Quality=high pluginspage= "http://www.macromedia.com/" Shockwave/download/index.cgi? P1_prod_version=shockwaveflash "type=" Application/x-shockwave-flash "width=" "height=" wmode= "Transparent" >
</embed>
</object></div>
<div id= "Layer1" style= "Position:absolute; left:-5px; top:61px; width:49px; height:37px; Z-index:1 "></div>
</td>
&LT;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=" >
<param name=movie value=http://www.163design.net/p/b/"images/ti1.swf" >
<param name=quality value=high>
<param name= "wmode" value= "Transparent" >
<embed src=http://www.163design.net/p/b/"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=" wmode= "Transparent" >
</embed>

</object> </td>
</tr>
</table>
<table width= "100%" border= "0" cellspacing= "0" cellpadding= "0" >
<tr>
&LT;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>
&LT;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= "Submission" value= "submitting 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> altogether:". $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 the 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-year m-month D-day))
$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> reading: $topic [hits] times; comments: $topic [p_num] times </td>
</tr> ";
}
Else
echo "Sorry, this column does not have any article!!!";
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 "> Prev </a><br><br>";
Else
echo "Prev <br><br>";?></td>
<td><?if ($page < $total _page-1)
echo "<a href=" $php _self?page= $next &type= $type "> Next </a><br><br>";
else echo "next page <br><br>";? ></td>
<td>
<form> Jump to:
<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 ">". $p. " Page </option>n ";
}
?>
</select> </form>
</td>
<td>
<form > select columns:
<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><td><form method= "POST" ACTION=&LT;? echo $PHP _self;? >?type=<?echo $type;? > target= "_balnk" ><input type= "Submit" Name= "Comm" value= "boutique 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: "Song Body"; font-size:9pt}
Select {font-family: "XXFarEastFont-Arial"; 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 ("Please 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 ("Please enter your correct e-mail 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>
&LT;TR valign=center bgcolor= #009900 >
&LT;TD background=images/third-back3.gif>
<table cellspacing=0 cellpadding=0 width=100% border=0>
<TBODY>
<TR>
&LT;TD width=17> </TD>
&LT;TD width=590>
<table width= "36%" Align=center border=0>
<TBODY>
<TR>
&LT;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>
&LT;TD width=19>
<div align=center><a href= "Javascript:window.close ()" >src=http://www.163design.net/p/b/"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=&LT;? Echo $pre;? > ">< /a></div>
</TD>
<TD>
<div Align=left><a Class=whitetxt
Href= "READ_ARTICLE.PHP?ID=&LT;? Echo $next;? > "> </a></DIV>
</TD>
<td>Height=16 src=http://www.163design.net/p/b/"Images/mail.gif" width=16></td>
&LT;TD Class=myfont><a Class=redtxt
Href= "COMMEND.PHP?ID=&LT;? echo "$data [id]&title= $data [title]";? > "> Recommended to Friends </A></TD>
<TD> Publishing Time:
? Echo $data [TIME];? >
Reading times:
? echo $data [hits];? >
</TD>
<TD> </TD>
</TR>
</TBODY>
</TABLE>
</TD></TR>
<tr valign=top>
&LT;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> Comment </DIV>
</th>
</TR>
<tr>
<td>
<form name= "Form1" method= "Post" action= "ping.php" onsubmit= "Return to Go ()" >
Your name:
<input type= "text" name= "name" class= "Border" >
Your email:
<input type= "text" name= "Mail" size=20 class= "Border" >
Only stationmaster visible: <input type= "checkbox" Name= "Pub" value= " echo $data [title];? > ">
<input type= "hidden" name= "p_id" "value=" echo $id;? > ">
<br>
Post a comment:
<textarea name= "cont" rows= "8" cols= "></textarea>"
<br>
<br>
<center>
<input type= "Submit" name= "Submission" value= "submitted" class= "Border" >
<input type= "reset" name= "Submit2" value= "rewrite" class= "border" >
</center></form>
</td>
</tr>
<tr bgcolor= #cccccc >
<th>
<div align=center> Related Reviews </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> times: $ping [Time] From: $ping [ip]}
Else
echo "There is no comment about this article!";
?>
</td>
</tr>
<tr bgcolor= #cccccc >
<td>
<div Align=center><a
Href= "Javascript:window.close ()" > Close window </a></div>
</td>
</tr>
</tbody>
</table>
<?require "./inc/footer.inc";? >

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.