选择显示字体大小

php+mysql的文章管理系统(二) 


  ###############index.php######################
<?session_start();
require&quot;./inc/func.php&quot;;
mscon();
require &quot;./inc/header.inc&quot;;
?>
<script language=&quot;javascript&quot;>
function opwin(filename)
{                window.open(&quot;read_article.php?id=&quot;+filename,&quot;&quot;,&quot;height=500,width=585,resizable=no,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no&quot;);
        }

</script>
</head>
<body bgcolor=&quot;#ffffff&quot; text=&quot;#000000&quot; leftmargin=&quot;0&quot; topmargin=&quot;0&quot;>
<table width=&quot;100&#37;&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; bgcolor=&quot;#003399&quot; height=&quot;23&quot;>
  <tr>
    <td width=&quot;80&quot;>
      <div id=&quot;layer2&quot; style=&quot;position:absolute; left:7px; top:17px; width:43px; height:44px; z-index:2&quot;><object classid=&quot;clsid:d27cdb6e-ae6d-11cf-96b8-444553540000&quot; codebase=&quot;http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0&quot; width=&quot;80&quot; height=&quot;60&quot;>
          <param name=movie value=&quot;images/logo.swf&quot;>
          <param name=quality value=high>
          <param name=&quot;wmode&quot; value=&quot;transparent&quot;>
          <embed src=&quot;images/logo.swf&quot; quality=high pluginspage=&quot;http://www.macromedia.com/shockwave/download/index.cgi?p1_prod_version=shockwaveflash&quot; type=&quot;application/x-shockwave-flash&quot; width=&quot;80&quot; height=&quot;60&quot; wmode=&quot;transparent&quot;>
          </embed>
        </object></div>
      <div id=&quot;layer1&quot; style=&quot;position:absolute; left:-5px; top:61px; width:49px; height:37px; z-index:1&quot;><img src=&quot;images/11.gif&quot; width=&quot;58&quot; height=&quot;55&quot;></div>
    </td>
    <td width=&quot;539&quot;> <object classid=&quot;clsid:d27cdb6e-ae6d-11cf-96b8-444553540000&quot; codebase=&quot;http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0&quot; width=&quot;468&quot; height=&quot;60&quot;>
          <param name=movie value=&quot;images/ti1.swf&quot;>
          <param name=quality value=high>
          <param name=&quot;wmode&quot; value=&quot;transparent&quot;>
          <embed src=&quot;images/ti1.swf&quot; quality=high pluginspage=&quot;http://www.macromedia.com/shockwave/download/index.cgi?p1_prod_version=shockwaveflash&quot; type=&quot;application/x-shockwave-flash&quot; width=&quot;468&quot; height=&quot;60&quot; wmode=&quot;transparent&quot;>
          </embed>

      </object> </td>
  </tr>
</table>
<table width=&quot;100&#37;&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;>
  <tr>
    <td background=&quot;images/211.gif&quot; height=&quot;2&quot;>&nbsp;</td>
  </tr>
</table>
<table><form name=form1 action=search.php  method=post target=_blank>
  <table width=&quot;80&#37;&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; bgcolor=&quot;#009933&quot; align=&quot;center&quot;>
    <tr>
    <td align=&quot;center&quot;>
    <input type=&quot;text&quot; name=&quot;key&quot;>
  <select name=&quot;type&quot;>
  <option value=>全部类别</option>
<? &#36;typ=file(&quot;list.txt&quot;);
&#36;num=count(&#36;typ);
for(&#36;i=2;&#36;i<=&#36;num;&#36;i++)
{
  echo&quot;<option value=&#36;typ[&#36;i]>&#36;typ[&#36;i]</option>&quot;;}
      ?>
  </select>
  <select name=&quot;whe&quot;>
  <option value=>全部内容</option>
  <option value=1>文章内容</option>
  <option value=2>文章标题</option>
  <option value=3>加入时间</option>
  </select>
  <input type=&quot;hidden&quot; name=&quot;submit&quot; value=&quot;1&quot;>
  <input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;提交查询&quot;>
  </td>
  </tr>
</table>
</form></table>
<?
&#36;type=trim(&#36;type);
  if(&#36;comm)
    {
     &#36;sec=&quot;and comm=1&quot;;
     &#36;fir=&quot;where comm=1&quot;;
    }
  if(!empty(&#36;type))
    &#36;query=&quot;select count(*) from &#36;table where type='&#36;type' &#36;sec&quot;;
  else
    &#36;query=&quot;select count(*) from &#36;table &#36;fir&quot;;
  &#36;res=mysql_db_query(&quot;&#36;database&quot;,&#36;query);
  if(@mysql_num_rows(&#36;res)>0)
    &#36;tot=mysql_fetch_array(&#36;res);
  &#36;total=&#36;tot[0];
  &#36;total_page=ceil(&#36;total/&#36;pagenum);
  echo &quot;<table width=&quot;80&#37;&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; align=center>&quot;;
  echo &quot;<tr><td>共:&quot;.&#36;total.&quot;篇&quot;.&#36;total_page.&quot;页</td></tr>&quot;;
  if(empty(&#36;page))
    &#36;page=0;
  if(empty(&#36;offset))
    &#36;offset=0;
  &#36;offset=&#36;pagenum*&#36;page;
  if(!empty(&#36;type))
     &#36;query=&quot;select * from &#36;table where type='&#36;type' &#36;sec order by id desc limit &#36;offset,&#36;pagenum&quot;;
  else
    &#36;query=&quot;select * from &#36;table &#36;fir order by id desc limit &#36;offset,&#36;pagenum&quot;;
  &#36;res=mysql_db_query(&quot;&#36;database&quot;,&#36;query);
  if(@mysql_num_rows(&#36;res)>0)
     while(&#36;topic=mysql_fetch_array(&#36;res))
       {
         if(strlen(&#36;topic[title])>40)
          {
            &#36;topic[title]=substr(&#36;topic[title],0,40) ;
            &#36;topic[title]=&#36;topic[title].&quot;.....&quot;;
          }
         if(trim(&#36;topic[time])==date(y年m月d日))
           &#36;topic[time]=&quot;<font color=#ff9900>&#36;topic[time]</font>&quot;;
           echo&quot; <tr><td>[&#36;topic[type]]<a href=# onclick=&quot;opwin(&#36;topic[id])&quot;;>&#36;topic[title]</a><font size=1>(&#36;topic[time])</font>&quot;;
        if(&#36;topic[comm]==1)
          echo &quot;<img src=&quot;./images/comm.gif&quot; alt=&quot;精品文章&quot;>&quot;;
        if(&#36;topic[locked]==1)
          echo &quot;<img src=&quot;./images/locked.gif&quot; alt=&quot;文章已锁定&quot;>&quot;;
        echo &quot;</td>
          <td>阅读:&#36;topic[hits] 次;评论:&#36;topic[p_num]次</td>
          </tr>&quot;;
     }
else
   echo &quot; 对不起,本栏 目暂没有任何文章!!!&quot;;
echo &quot;</table>&quot;;
  ?>

<br>
<table width=&quot;80&#37;&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; align=&quot;center&quot;>
  <tr>
    <td>
  <?
     &#36;pre=&#36;page-1;
     &#36;next=&#36;page+1;
if(&#36;page>0)
   echo &quot;<a href=&quot;&#36;php_self?page=&#36;pre&type=&#36;type&quot;>上一页</a><br><br>&quot;;
else
  echo &quot;上一页<br><br>&quot;;  ?></td>
    <td><?if(&#36;page<&#36;total_page-1)
   echo &quot;   <a href=&quot;&#36;php_self?page=&#36;next&type=&#36;type&quot;>下一页</a><br><br>&quot;;
else echo &quot;   下一页<br><br>&quot;;?></td>
    <td>
<form> 跳转到:
        <select name=&quot;page&quot; onchange=&quot;top.location='<? echo &#36;php_self;?>?page='+document.forms[1].elements[0].value+'&type=<?echo &#36;type;?>';&quot; class=&quot;border&quot;>
          <?
  for(&#36;i=0;&#36;i<&#36;total_page;&#36;i++)
    {
     &#36;p=&#36;i+1;
     echo &quot;<option value=&#36;i&quot;;
     if(&#36;page==&#36;i) echo &quot; selected&quot; ;
     echo &quot;>第&quot;.&#36;p.&quot;页</option>n&quot;;
     }
?>
        </select> </form>
</td>
<td>
<form >选择栏目:
        <select name=&quot;type&quot;  onchange=&quot;top.location='<? echo &#36;php_self;?>?type='+document.forms[2].elements[0].value<?if(&#36;comm) echo&quot;+'&comm=1'&quot;;?>;&quot; >
          <? &#36;typ=file(&quot;list.txt&quot;);
&#36;num=count(&#36;typ);
for(&#36;i=0;&#36;i<&#36;num;&#36;i++)
{
  echo&quot;<option value=&#36;typ[&#36;i] &quot;; if(trim(&#36;typ[&#36;i])==&#36;type) {  echo &quot;  selected&quot;; } echo &quot;>&#36;typ[&#36;i]</option>&quot;;}
      ?>
        </select>
    </form>
</td><td><form method=&quot;post&quot; action=<? echo &#36;php_self;?>?type=<?echo &#36;type;?> target=&quot;_balnk&quot;><input type=&quot;submit&quot; name=&quot;comm&quot; value=&quot;精品文章&quot; class=border></form></td>
</tr>
</table>
<?require &quot;./inc/footer.inc&quot;;?>
#####################read_article.php#########################
<?
require&quot;./inc/func.php&quot;;
if(!&#36;id)
{
  echo&quot;<script>window.close();</script>&quot;;
   exit();
}
mscon();
&#36;query=&quot;select * from &#36;table where id='&#36;id'&quot;;
&#36;res=mysql_db_query(&quot;&#36;database&quot;,&#36;query);
if(!&#36;res)
  {
    echo &quot;this article has been deleted or no this article!!&quot;;
    exit();
  }
&#36;data=mysql_fetch_array(&#36;res);
add_hits(&#36;data[id]);
&#36;pre=&#36;data[id]-1;
&#36;next=&#36;data[id]+1;
?>
<html>
<head>
<title>
<?   echo &quot;&#36;data[title]--[&#36;data[type]]&quot;;?>
</title>
<meta http-equiv=content-type content=&quot;text/html; charset=gb2312&quot;>
<style type=text/css>
<!--
body,table,td,input,textarea {  font-family: &quot;宋体&quot;; font-size: 9pt}
select {  font-family: &quot;宋体&quot;; font-size: 9pt}
code {font-family: &quot;courier&quot; ; 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=&quot;javascript&quot;>
function name()
{
  var theresult = true;
  var elem4 = null;

  if (document.forms[0].elements[0].value == &quot;&quot; document.forms[0].elements[0].value == &quot;undefined&quot; document.forms[0].elements[0].value == &quot;null&quot;)
  {
    elem4 = prompt(&quot;请输入您的姓名:&quot;,&quot;&quot;);
    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 == &quot;&quot; document.forms[0].elements[1].value.indexof('.') == -1))
  {
    elem1 = prompt(&quot;请输入您的正确的电子邮件地址。谢谢!!&quot;,&quot;&quot;);
    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&#37; border=0>
        <tbody>
        <tr>
          <td width=17>&nbsp;</td>
          <td width=590>
            <table width=&quot;36&#37;&quot; align=center border=0>
              <tbody>
              <tr>
                <td bgcolor=&quot;#009900&quot;>
                  <div align=center><font face=&quot;verdana, arial, helvetica, sans-serif&quot; color=#ffffff><b>
                    <? echo &#36;data[title];?>
                    </b></font></div>
                </td></tr></tbody></table></td>
          <td width=19>
            <div align=center><a href=&quot;javascript:window.close()&quot;><img height=17
            src=&quot;images/third-close.gif&quot; 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=&quot;center&quot; width=&quot;100&#37;&quot;>
        <tbody>
        <tr>
          <td>
            <div align=left><a class=whitetxt
            href=&quot;read_article.php?id=<? echo  &#36;pre;?>&quot;><img src=&quot;images/prethread.gif&quot; width=&quot;48&quot; height=&quot;12&quot; border=&quot;0&quot;></a></div>
          </td>
          <td>
            <div align=left><a class=whitetxt
            href=&quot;read_article.php?id=<? echo &#36;next;?>&quot;><img src=&quot;images/nextthread.gif&quot; width=&quot;48&quot; height=&quot;12&quot; border=&quot;0&quot;></a></div>
          </td>
          <td><img
            height=16 src=&quot;images/mail.gif&quot; width=16></td>
          <td class=myfont><a class=redtxt
            href=&quot;commend.php?id=<? echo &quot;&#36;data[id]&title=&#36;data[title]&quot;;?>&quot;>推荐给朋友</a></td>
          <td> 发表时间:
            <? echo &#36;data[time];?>
            阅读次数:
            <? echo &#36;data[hits];?>
          </td>
          <td>&nbsp; </td>
        </tr>
        </tbody>
      </table>
    </td></tr>
    <tr valign=top>
    <td class=tenpt>
<?
if(&#36;data[locked]<>0)
{
  echo &quot;<img src=images/lock.gif>对不起!本文已经被管理员锁定!&quot;;
}
else
  if(&#36;data[html]==1)
     highlight_string(&#36;data[cont]);
  else
     echo nl2br(&#36;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>发表评论</div>
    </th>
  </tr>
  <tr>
    <td>
<form name=&quot;form1&quot; method=&quot;post&quot; action=&quot;ping.php&quot; onsubmit=&quot;return go()&quot;>
        您的姓名:
        <input type=&quot;text&quot; name=&quot;name&quot; class=&quot;border&quot;>
       &nbsp;&nbsp;您的电子邮件:
        <input type=&quot;text&quot; name=&quot;mail&quot; size=20 class=&quot;border&quot;>
        仅站长可见:<input type=&quot;checkbox&quot; name=&quot;pub&quot; value=&quot;<? echo &#36;data[title];?>&quot;>
        <input type=&quot;hidden&quot; name=&quot;p_id&quot; value=&quot;<? echo &#36;id;?>&quot;>
        <br>
        发表评论:
        <textarea name=&quot;cont&quot; rows=&quot;8&quot; cols=&quot;85&quot;></textarea>
        <br>
        <br>
        <center>
          <input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;提交&quot; class=&quot;border&quot;>
          <input type=&quot;reset&quot; name=&quot;submit2&quot; value=&quot;重写&quot; class=&quot;border&quot;>
        </center></form>
        </td>
  </tr>
  <tr bgcolor=#cccccc>
    <th>
      <div align=center>相关评论</div>
    </th>
  </tr>
  <tr>
  <td>
<?  &#36;query=&quot;select * from &#36;ping_tab where p_id='&#36;id' order by time desc&quot;;
  &#36;res=mysql_db_query(&quot;&#36;database&quot;,&#36;query);
  if(mysql_num_rows(&#36;res)>0)
   {&#36;i=1;
   while(&#36;ping=mysql_fetch_array(&#36;res))
    echo &quot;评论人:&#36;ping[name]   电子邮件:&#36;ping[mail]<br>&nbsp;&nbsp;&quot;.nl2br(&#36;ping[p_cont]).&quot;<br>时间:&#36;ping[time]  来自:&#36;ping[ip]<hr size=1>n&quot; ;
   }
   else
   echo &quot;暂时没有本文章的相关评论!&quot;;
  ?>
  </td>
  </tr>
  <tr bgcolor=#cccccc>
    <td>
      <div align=center><a
  href=&quot;javascript:window.close()&quot;>关闭窗口</a></div>
    </td>
  </tr>
  </tbody>
</table>
<?require &quot;./inc/footer.inc&quot;;?> 


 


关键字 本文所属关键字

相关 与本文相关文章

分类 所有文章关键字导航

源码编程相关

Java   Asp   PHP   .Net   XML   C/C++   CGI   VB   Jsp   J2ee   J2se   J2me   EJB   Servlet   Tomcat   Resin   Struts   Weblogic   Eclipse   ANT   GUI   JMS   Web servise   IDEA   Webphere   Hibernate   Spring   Jboss   Applet   Swing   Socket   Javamail   Perl   Ajax   P2P   安全   模式   框架   测试   开源   游戏

SQL数据库相关

My-SQL   Ms-SQL   Access   DB2   Oracle   Sybase   SQLserver   索引   存储过程   加密   数据库   分页   视图  

手机无线相关

3G   Wap   CDMA   GRPS   GSM   IVR   彩信   短信   无线   增值业务

网页设计制作相关

HTML   CSS   网页配色   网页特效   Javascript   VBscript   Dreamweaver   Frontpage   JS   Web   网站设计

网站建设推广相关

建站经验   网站优化   网站排名   推广   Alexa

操作系统/服务器相关

Windows XP   Windows 2000   Windows 2003   Windows Me   Windows 9.x   Linux   UNIX   注册表   操作系统   服务器   应用服务器

图形图像多媒体相关

Photoshop   Fireworks   Flash   Coreldraw   Illustrator   Freehand   Photoimpact   多媒体   图形图像

标准 网站致力的规范

Valid CSS!

无不良内容,无不良广告,无恶意代码

Valid XHTML 1.0 Transitional

creativecommons