天堂1111 发表于 2017-3-28 12:44:49

car_info.php源代码分析

<script>function StorePage(){d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(keyit=window.open('http://www.365key.com/storeit.aspx?t='+escape(d.title)+'&u='+escape(d.location.href)+'&c='+escape(t),'keyit','scrollbars=no,width=475,height=575,left=75,top=20,status=no,resizable=yes'));keyit.focus();}</script>  <link href="css/style.css" rel="stylesheet">
  <?php
  include("conn/conn.php");
  ?>
  <table width="563" height="587" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td width="563" height="587" valign="top" bgcolor="#FFFFFF"><table width="563" border="0" cellspacing="0" cellpadding="0">
  <tr>
  <td width="563" height="27" background="Images/fufei.gif">&nbsp;</td>
  </tr>
  <tr>
  <td height="96" align="center" valign="top"><br>
  <?php
  $date1=date("Y-m-d");
  %获取当前时间
  $sgsql=mysql_query("select * from tb_leaguerinfo where type='车辆信息' and showday>='$date1' and checkstate=1 ");
  %查询字符串
  $sginfo=mysql_fetch_array($sgsql);
  %查询结果
  if($sginfo){
  do{
  ?>
  <table width="540" border="0" cellspacing="0" cellpadding="0">
  <tr>
  <td height="26"><span class="style1">『车辆信息』</span><span class="style8">&nbsp;<?php echo $sginfo;?>&nbsp;</span><span class="style6">&nbsp;<?php echo $sginfo;?></span></td>
  </tr>
  <tr>
  <td height="26">&nbsp;&nbsp;&nbsp;<span class="style5">&nbsp;<?php echo $sginfo;?></span></td>
  </tr>
  <tr>
  <td height="26">&nbsp;<span class="style8">联系人:<?php echo $sginfo;?>&nbsp;&nbsp;&nbsp;联系电话:<?php echo $sginfo;?></span></td>
  </tr>
  <tr>
  <td height="3" background="Images/line1.gif"></td>
  </tr>
  </table>
  <?php
  }while($sginfo=mysql_fetch_array($sgsql));
  %显式结果
  }else{
   ?>
  <table width="540" border="0" cellspacing="0" cellpadding="0">
  <tr>
  <td align="center">暂无车辆信息资源!</td>
  </tr>
  </table>
  <?php
  }
  ?></td>
  </tr>
  <tr>
  <td align="center" valign="top"><table width="560" border="0" cellspacing="0" cellpadding="0">
  <tr>
  <td height="87" background="Images/guanggao.gif">&nbsp;</td>
  </tr>
  </table></td>
  </tr>
  <tr>
  <td height="27" background="Images/mian.gif">&nbsp;</td>
  </tr>
  <tr>
  <td height="140" align="center" valign="top">
  <br>
  <?php
  $sql=mysql_query("select count(*) as total from tb_info where type='车辆信息' and checkstate=1");
  %查询
  $info=mysql_fetch_array($sql);
  %获取结果
  $total=$info;
  %获取结果总数
  $pagesize=4;
  %每页显示的个数
  if ($total<=$pagesize){
  $pagecount=1;
  %如果结果数小于4,则页数为1
  }
  if(($total%$pagesize)!=0){
  $pagecount=intval($total/$pagesize)+1;
  %不能整除,则在商的基础上加1
  }else{
  $pagecount=$total/$pagesize;
  %能整除,则直接取商
  }
  if(($_GET)==""){
  $page=1;
  %默认为第一页
  }else{
  $page=intval($_GET);
  %否则为用户选择的页数
  }
  $gsql=mysql_query("select * from tb_info where type='车辆信息' and checkstate=1 order by edate desc limit ".($page-1)*$pagesize.",$pagesize");
  %查询信息,在每页的相应位置,放置相应的页码
  $ginfo=mysql_fetch_array($gsql);
  %获取结果
  if($ginfo){
  do{
  ?>
  <table width="540" border="0" cellspacing="0" cellpadding="0">
  <tr>
  <td height="26"><span class="style1">『车辆信息』</span><span class="style8">&nbsp;<?php echo $ginfo;?>&nbsp;</span><span class="style6">&nbsp;<?php echo $ginfo;?></span></td>
  </tr>
  <tr>
  <td height="26">&nbsp;&nbsp;&nbsp;<span class="style5">&nbsp;<?php echo $ginfo;?></span></td>
  </tr>
  <tr>
  <td height="26">&nbsp;<span class="style8">联系人:<?php echo $ginfo;?>&nbsp;&nbsp;&nbsp;联系电话:<?php echo $ginfo;?></span></td>
  </tr>
  <tr>
  <td height="3" background="Images/line1.gif"></td>
  </tr>
  </table>
  <?php
  }while($ginfo=mysql_fetch_array($gsql));
  %显式结果
  ?>
  <table width="543" height="27" border="0" cellpadding="0" cellspacing="0">
  <tr>
  <td width="543" height="27" colspan="3" align="right"> &nbsp; 共有&nbsp;
  <?php
  echo $total;
   ?>
  &nbsp;条&nbsp;每页显示&nbsp;<?php echo $pagesize;?>&nbsp;条&nbsp;第&nbsp;<?php echo $page;?>&nbsp;页/共&nbsp;<?php echo $pagecount; ?>&nbsp;页
  <?php
   if($page>=2){
   ?>
  <a href="car.php?page=1" title="首页"></a><a href="car.php?page=<?php echo $page-1;?>" title="前一页">
  %如果页数大于等于2,则显式前一页
  <?php
   }
  if($pagecount<=4){
  for($i=1;$i<=$pagecount;$i++){
   ?>
  <a href="car.php?page=<?php echo $i;?>"><?php echo $i;?></a>
  <?php
     }
  }else{
  for($i=1;$i<=4;$i++){
   ?>
  <a href="car.php?page=<?php echo $i;?>"><?php echo $i;?></a>
  <?php }?>
  <a href="car.php?page=<?php echo $page-1;?>" title="后一页"></a> <a href="car.php?page=<?php echo $pagecount;?>" title="尾页"></a>
  <?php }?></td>
  </tr>
  </table>
  <?php
  }
  else{
  ?>
  <table width="540" border="0" cellspacing="0" cellpadding="0">
  <tr>
  <td align="center">暂无车辆信息资源!</td>
  </tr>
  </table>
  <?php
  }
  ?>
  </td>
  </tr>
  </table>
  </td>
  </tr>
  </table>
  <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
页: [1]
查看完整版本: car_info.php源代码分析