/Quản lý website quảng cáo PHP/module/search.php
PHP | 279 lines | 86 code | 193 blank | 0 comment | 11 complexity | 8e856521f290773060744058d8f2c40a MD5 | raw file
- <?
- $keyword = killInjection($_REQUEST['keyword']);
- ?>
-
- <?
-
- $row =10;
-
- $col =2;
-
- $cat =0;
-
- $p=0;
-
- if ($_REQUEST['p']!='') $p=$_REQUEST['p'];
-
- $sql = "select * from tbl_product where name like '%".$keyword."%' order by sort,date_added desc limit ".$row*$col*$p.",".$row*$col;
-
- $result = @mysql_query($sql,$conn);
-
- $total = countRecord("tbl_product","name like '%".$keyword."%'");
-
- if($total==0){
-
- ?>
-
- <table align="center" cellSpacing="0" cellPadding="0" width="100%" border="0">
-
-
-
-
-
-
-
- <tr>
-
-
-
- <td align="center">
-
-
-
- <font color="#FF0000"><b><?=$_lang=="vn"?'Không tìm thấy sản phẩm xin hãy chọn từ khóa khác !':''?></b></font>
-
-
-
- </td>
-
-
-
- </tr>
-
-
-
- <tr><td height="20"></td></tr>
-
-
-
- </table>
-
-
-
- <?
-
-
-
- }else{
-
-
-
- ?>
- <link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />
-
- <script src="script/prototype.js" type="text/javascript"></script>
- <script src="script/scriptaculous.js?load=effects" type="text/javascript"></script>
- <script src="script/lightbox.js" type="text/javascript"></script>
-
- <table align="center" cellSpacing="0" cellPadding="0" width="100%" border="0">
-
- <?
-
- for($i=0; $i<$row; $i++){
-
- ?>
-
- <tr>
-
-
-
-
-
- <?
-
- for($j=0; $j<$col&&$products=mysql_fetch_assoc($result); $j++){
-
-
-
- $pro = getRecord("tbl_product","id=".$products['id'])?>
-
- <td class="margin_image_center" colspan="2"><table width="100%" border="0" cellpadding="0" cellspacing="10" class="line_bottom_center">
- <tr>
- <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td align="center"><a href="<?=$pro["image_large"]?>" rel="lightbox[roadtrip]"><img src="<?=$pro["image"]?>" alt="" width="180" height="100" border="0" class="border_image" /></a></td>
- </tr>
- <tr>
- <td align="center"><?=$pro["name"]?> </td>
- </tr>
- </table></td>
-
- </tr>
- </table></td>
- <?
-
-
-
- }
-
-
-
- while($j<$col){
-
-
-
- echo "";
-
-
-
- $j=$j+1;
-
-
-
- }
-
-
-
- ?>
-
-
-
-
-
-
-
- </tr>
-
-
-
-
-
-
-
- <? }?>
-
-
-
-
-
-
-
- </table>
-
-
- <table align="center" cellSpacing=0 cellPadding=0 width="98%" border=0>
-
-
-
- <?
-
-
-
- $newsPage = $_lang=="vn" ? "Sản phẩm" : "Products";
-
-
-
- $pagePage = $_lang=="vn" ? "Trang" : "Page";
-
-
-
- $titleFirst = $_lang=="vn" ? "Đầu Tiên" : "First";
-
-
-
- $titlePrevious = $_lang=="vn" ? "Về trước" : "Previous";
-
-
-
- $titleNext = $_lang=="vn" ? "Tiếp theo" : "Next";
-
-
-
- $titleLast = $_lang=="vn" ? "Cuối cùng" : "Last";
-
-
-
-
-
-
-
- $pages = countPages($total,$row*$col);
-
-
-
- echo '<tr><td colspan="2" align="center"></td></tr>';
-
-
-
- echo '<tr><td class="td1" align="left"></td>';
-
-
-
- echo '<td class="td1" align="right">';
-
-
-
- $param="";
-
-
-
- if ($p>1) echo '<a class="link5" title="'.$titleFirst.'" href="./?frame='.$_REQUEST['frame'].'&cat='.$_REQUEST['cat'].'&'.$param.'&p=0">[<<]</a> ';
-
-
-
- if ($p>0) echo '<a class="link5" title="'.$titlePrevious.'" href="./?frame='.$_REQUEST['frame'].'&cat='.$_REQUEST['cat'].'&'.$param.'&p='.($p-1).'">[<]</a> ';
-
-
-
- $from=($p-10>0?$p-10:0);
-
-
-
- $to=($p+10<$pages?$p+10:$pages);
-
-
-
- for ($i=$from;$i<$to;$i++){
-
-
-
- if ($i!=$p) echo '<a class="link5" href="./?frame='.$_REQUEST['frame'].'&cat='.$_REQUEST['cat'].'&'.$param.'&p='.$i.'">'.($i+1).' </a>';
-
-
-
- else echo '<b>'.($i+1).'</b> ';
-
-
-
- }
-
-
-
- if ($p<$i-1) echo '<a class="link5" title="'.$titleNext.'" href="./?frame='.$_REQUEST['frame'].'&cat='.$_REQUEST['cat'].'&'.$param.'&p='.($p+1).'">[>]</a> ';
-
-
-
- if ($p<$pages-1) echo '<a class="link5" title="'.$titleLast.'" href="./?frame='.$_REQUEST['frame'].'&cat='.$_REQUEST['cat'].'&'.$param.'&p='.($pages-1).'">[>>]</a>';
-
-
-
- echo '</td></tr>';
-
-
-
- ?>
-
-
-
- </table><br />
-
-
-
-
-
-
-
- <? }?>
-
-
-