留言本开始换个思路做

| |
[不指定 2007/10/15 13:33 | by Else ]
book.php的代码

这个代码是我最初理解et的一个模试!今天看到,更好的代理,我试试

<?php
#这个页要分页模板化
#如果是apache的话,做好分页的优化

require_once("./template.php");
require_once('./data/conn.php');
require_once('./mysql.php');
require_once('./data/function.php');
//声明类

//声明数据库  
$db = new Dirver();  
$db->DBLink($db_server,$db_username,$db_password,$db_name);
#以上是mysql数据库文件的设置  

#设模板的目录
$tl    = new template();
  $tl->template(
     array(
       'TplType'=>'html',
     'TemplateDir'=>'template/blue'
    )
);

$datetime   = "&nbsp;日期:".date("Y年 m月 d日 星期:l");

#显示网站大类

  function ShowMenu(){
    $sql="SELECT link,text,menu,opennew FROM menu WHERE `view` = 1 ORDER BY list ASC ";
    $rs=mysql_query($sql);
  do {
  if ($row_rs['opennew']==1)
     {
     $blank="target=\"_blank\"";
     }
   $mymenus.= "<a href=\"".$row_rs['link']."\" class=\"White\" ".$blank."title=\"".$row_rs['text']."\" >" .$row_rs['menu']."</a> \n";
  } while ($row_rs = mysql_fetch_assoc($rs));

    echo $mymenus;
    
  }

#显示留言

$maxRows_list = 5;      //每页显示留言数
$pageNum_list = 0;
if (isset($_GET['pageNum_list'])) {
  $pageNum_list = $_GET['pageNum_list'];
}


#分页优化
$Php2Html_FileUrl = $_SERVER["REQUEST_URI"];
$Php2Html_UrlString = str_replace("/", "", strrchr($Php2Html_FileUrl, "/"));
$pageNum_list=intval(intval($Php2Html_UrlString));//Integer type variable conversion
  if (!intval($pageNum_list))
  {
    $sid=intval($_GET['pageNum_list']);
    if(!intval($pageNum_list))
    {
      $pageNum_list=0;
    }
  }
  
  
$startRow_list = $pageNum_list * $maxRows_list;
$query_list = "select * from book order by id desc";
$query_limit_list = sprintf("%s LIMIT %d, %d", $query_list, $startRow_list, $maxRows_list);

  $query = $db->query($query_limit_list); //这里要修改


//----------------------------------------------------------------------
if (isset($_GET['totalRows_list'])) {
  $totalRows_list = $_GET['totalRows_list'];
} else {
  $all_list = mysql_query($query_list);
  $totalRows_list = mysql_num_rows($all_list);
}
$totalPages_list = ceil($totalRows_list/$maxRows_list)-1;

//------------------------------------------------------
$pageinfo="共 ".($totalPages_list + 1)." 页 $totalRows_list 条记录 当前第".($pageNum_list +1)."页 <a href=book.php/0>首页</a> <a href=book.php/".max(0, $pageNum_list - 1).">上一页</a> <a href=book.php/".min($totalPages_list, $pageNum_list + 1).">下一页</a> <a href=book.php/$totalPages_list>未页</a>";
//------------------------------------------------------



#全站热点文章
$site_hot_query=$db->query("SELECT id,title FROM ruby WHERE view=1  order by countruby desc LIMIT 0,15");

#本站推荐文章
$site_commend_query=$db->query("SELECT id,title FROM ruby WHERE view=1 order by commend=1,id desc LIMIT 0,15");
  //连载
$tl->set_file('book');
$tl->n();
$tl->p('book');
$db->close();
?>



<!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=gb2312" />
<meta name="keywords" content="{Sitekey}" />
<meta name="copyright" content="{SiteName}" />
<meta name="author" content="{WebmasterEmail}" />
<meta name="description" content="{description}" />
<meta name="robots" content="all" />
<base href="{SiteUrl}" />
<title>留言版 CukuCms 2.0 Powered by Cuku.net</title>
<style type="text/css">
<!--
div,form,img,ul,ol,li,dl,dt,dd {margin: 0; padding: 0; border: 0;}
h1,h2,h3,h4,h5,h6 { margin:0; padding:0;}
body,td,th {
  font-size: 12px;
  color: #333333;
  font-family: 宋体;
}

body {
  background-color: #FFFFFF;
  margin-left: 0px;
  margin-top: 0px;
  margin-right: 0px;
  margin-bottom: 0px;  
  text-align: center;
}
.cls0{
  width: 802px;
  margin-right: auto;
  margin-left: auto;
  text-align: left;
  height:auto;
}
.cls1{
  font-size: 14px;
  font-style: normal;
  line-height: 20px;
  color: #333333;
  background-color: #E3F5FC;
  height: 20px;
  
  border-bottom-width: 1px;
  border-bottom-style: solid;
  border-bottom-color: #CCCCCC;
  text-align: left;
}
.cls2{
  font-size: 12px;
  line-height: 20px;
  height: 90px;
  
  border-bottom-width: 1px;
  border-bottom-style: solid;
  border-bottom-color: #00A4F2;
  padding-top: 2px;
  padding-bottom: 2px;
}
  .cls2_1{
    float: left;
    width: 166px;
    height: auto;
  }
  .cls2_2{
    text-align: center;
    height: 80px;
    width: 500px;
    float: left;
    line-height: 25px;
    padding-top: 5px;
  }
  .cls2_3{
    float: left;
    line-height: 20px;
    padding-top: 10px;
    padding-bottom: 10px;
    text-align: right;
    height: 70px;
    width: 100px;
  }
.cls3{
  line-height: 22px;
  background-color: #D2E4FC;
  height: 22px;
  margin-top: 1px;
  padding-top: 1px;
  padding-bottom: 1px;
}
.cls4{
  line-height: 22px;
  height: 22px;
  margin-top: 1px;
  background-color: #F5FAFE;
  border-bottom-width: 1px;
  border-bottom-style: solid;
  border-bottom-color: #6B92D6;
  margin-bottom: 8px;
  border-top-width: 1px;
  border-top-style: solid;
  border-top-color: #82B4F7;
  padding-left: 5px;
}
.cls5{
  background-color: #F5FAFE;
  border: 1px solid #D2E4FC;
  line-height: 22px;
  height: 22px;
  width: 560px;
  margin-bottom: 5px;
}
.cls6{
  border: 1px solid #4074CA;
  width: 560px;
  height: auto;
}
  .cls6_1{
    line-height: 25px;
    margin: 1px;
    background-color: #D2E4FC;
    height: 25px;
  }
  .cls6_2{

    height: auto;
    margin: 5px;
  }
  .cls6_2_input{
  height: 20px;
  border: 1px solid #000000;
  background-color: #F2F2F2;
  }
  .cls6_2_textarea{
  border: 1px solid #333333;
  background-color: #F2F2F2;
  }
  .cls6_2_Submit{
      border-top-width: 1px;
      border-right-width: 1px;
      border-bottom-width: 1px;
      border-left-width: 5px;
      border-top-style: solid;
      border-right-style: solid;
      border-bottom-style: solid;
      border-left-style: solid;
      border-top-color: #666666;
      border-right-color: #666666;
      border-bottom-color: #666666;
      border-left-color: #666666;
    }
  .cls6_3{
    padding: 5px;
    height: auto;
    text-align: center;
  }
  .cls6_4{
  padding: 5px;
  height: auto;
  border: 1px solid #D2E4FC;
  width: 95%;
  margin-right: auto;
  margin-left: auto;
  margin-top: 5px;
  margin-bottom: 5px;
  }
    .cls6_4_1{
  line-height: 20px;
  font-weight: bold;
}
     .cls6_4_2{
  line-height: 20px;
  font-size: 12px;
  color: #3333FF;
    }
    .cls6_4_3{
      line-height: 20px;
      font-size: 12px;
    }
    .cls6_4_3_1{
  width: 95%;
  margin-right: auto;
  margin-left: auto;
  line-height: 20px;
  background-color: #F6F6F6;
    }
.cls7{
  line-height: 20px;
  text-align: center;
  height: 20px;
}
.cls8{
  width: 235px;
  height: auto;
  float: right;
}
  .cls8_1{
  border: 1px solid #4074CA;
  margin-bottom: 10px;
  }
  .cls8_1_1{
  line-height: 25px;
  background-color: #D2E4FC;
  height: 25px;
  border: 1px solid #FFFFFF;
  }
  .cls8_1_2{
  margin: 3px;
  height: auto;
}
.cls9{
  background-color: #FDFDFD;
  height: 80px;
  clear: both;
}
a:link {
  text-decoration: none;
}
a:visited {
  text-decoration: none;
}
a:hover {
  text-decoration: none;
}
a:active {
  text-decoration: none;
}

-->
</style>
</head>

<body>
<div class="cls0">
  <div class="cls1">{datetime}{weekday}</div>
  <div class="cls2">
    
    <div class="cls2_1"><img src="images/top.gif" alt="logo" width="166" height="90" align="middle" /></div>
    <div class="cls2_2">
    <!--广告代码开始-->
    <a href="http://www.chanet.com.cn/click.cgi?a=43423&d=3794&u=&e=" target="_blank"><IMG SRC="http://file.chanet.com.cn/image.cgi?a=43423&d=3794&u=&e=" width="468" height="80"  border="0"></a>
    <!--广告代码结束-->
    </div>
    
      <div class="cls2_3"> 加入收藏<br />
        联系我们<br />
        设为首页</div>
  </div>
  <div class="cls3">&nbsp;导航{run:} ShowMenu();{/run}</div>
  <div class="cls4">
  <!--while:$menu = $db->fetch_array($sub_menu)-->
  <a href="list.php/{menu['id']}" title="{menu['content']}">{menu['catname']}</a>
    <!--END-->
  </div>
  <!--右边-->
  <div class="cls8">
    <div class="cls8_1">
      <div class="cls8_1_1">&nbsp;广告位</div>
      <div class="cls8_1_2">&nbsp;<!--广告开始-->
      <a href="http://www.chanet.com.cn/click.cgi?a=43423&d=11993&u=&e=" target="_blank"><IMG SRC="http://file.chanet.com.cn/image.cgi?a=43423&d=11993&u=&e=" width="120" height="60"  border="0"></a>
      <!--广告结束--></div>
    </div>
    
      <div class="cls8_1">
      <div class="cls8_1_1">&nbsp;本站热门</div>
      <div class="cls8_1_2">
      <!--while:$shot = $db->fetch_array($site_hot_query)-->
   ·<a href=show.php/{shot['id']}.html title="{shot['title']}">{run:}echo cnSubStr($shot['title'],34){/run}</a><br />
   <!-- END -->
            </div>
    </div>
    
    <div class="cls8_1">
      <div class="cls8_1_1">&nbsp;本站推荐</div>
      <div class="cls8_1_2"><!--while:$scommend = $db->fetch_array($site_commend_query)-->
   ·<a href=../show.php/{scommend['id']}.html title="{scommend['title']}" >{run:}echo cnSubStr($scommend['title'],34){/run}</a><br />

   <!-- END --></div>
    </div>
  </div>
  
  <div class="cls5">&nbsp;<a href="index.html">首页</a>-&gt;在线留言</div>


  
  
  <div class="cls6">
    <div class="cls6_1">&nbsp;添加留言:</div>
    <div class="cls6_2">
    <form action="book.php?" name="form" id="form">
      <div>昵称:
        <label>
        <input name="username" type="text" class="cls6_2_input" id="username" />
        </label>
      密码
      <input name="password" type="password" class="cls6_2_input" id="password" />
       游客无需密码</div>
      
        <div>网址:
        <label>
        <input name="website" type="text" class="cls6_2_input" id="website" />
        </label>
      邮箱
      <input name="email" type="text" class="cls6_2_input" id="email" />
       注册</div>
      
      <div><textarea name="content" cols="60" rows="10" class="cls6_2_textarea" id="content"></textarea>
      </div>
      <div>验证码
        <label>
        <input name="intcode" type="text" class="cls6_2_input" id="intcode" size="7" maxlength="5" />
        </label>
      </div>
      <div>
      
        <label>
        <input name="Submit" type="submit" class="cls6_2_Submit" value="提交" />
        </label>
        <label>
        <input name="Submit2" type="reset" class="cls6_2_Submit" value="重置" />
        </label>
      </div>
      </form>
    </div>
    
    
    <div class="cls6_3">
    <!--广告开始-->
    <script>document.write('<iframe src="http://u.keyrun.com/k.html?id=75034&title='+document.title+'" marginheight=0 marginwidth=0 frameborder=0 scrolling=no height="60" width="468" ></iframe>');</script>
    <!--广告结束-->
    </div>
    <!-- while:$row = $db->fetch_array($query) -->
    <div class="cls6_4">
      <div class="cls6_4_1">昵称:{row['name']}</div>
      <div class="cls6_4_2">时间:{run:}echo cnSubStr($row['time'],10){/run}</div>
      <div class="cls6_4_3">内容:{run:}echo nl2br($row['content']){/run}
        <div class="cls6_4_3_1">回复:{run:=nl2br($row[re])} <br />
</div>
      </div>
      
    </div>
    <!--END-->
  <div class="cls7">分页信息{pageinfo}</div>  
  </div>
  <div class="cls9">
    <hr width="100%" size="0" />
    {Copyright}{webcount}</div>  
</div>
</body>
</html>


作者:Else 's Blog
地址:http://www.aixq.com/post/836/
版权所有。转载时必须链接形式注明作者和原始出处及本声明!
  • 中查看更多“留言本开始换个思路做”相关内容
  • 中查看更多“留言本开始换个思路做”相关内容
  • 中查看更多“留言本开始换个思路做”相关内容
  • 中查看更多“留言本开始换个思路做”相关内容
  • 中查看更多“留言本开始换个思路做”相关内容
  • 中查看更多“留言本开始换个思路做”相关内容

  • 最后编辑: Else 编辑于2008/04/10 00:47
    Tags: , , ,
    代码 程序 编程 | 评论(0) | 引用(0) | 阅读(3348)
    发表评论
    表情
    emotemotemotemotemot
    emotemotemotemotemot
    emotemotemotemotemot
    emotemotemotemotemot
    emotemotemotemotemot
    打开HTML
    打开UBB
    打开表情
    隐藏
    昵称   密码   游客无需密码
    网址   电邮   [注册]