0byt3m1n1-V2
Path:
/
home
/
bangtoey
/
domains
/
bangtoey.go.th
/
public_html
/
[
Home
]
File: searchresult.php
<? $chk_found=0; $Page = $_GET['Page']; $se_var = $_POST['sevalue']; if(!isset($_POST['sevalue'])){ $se_var = $_GET['sevalue']; } $se_var = strip_tags($se_var); $se_var = substr($se_var,0,30); $se_var = trim($se_var); $se_var = get_magic_quotes_gpc() ? $se_var : addslashes($se_var); $search_vowels = array("..", "|", "&", "_",":", ",","/","+","%","$","#","@","!",">","<","=","*","~","(",")"); $se_var = str_replace($search_vowels," ",$se_var); $se_var = trim($se_var); if(!Empty($se_var) and isset($se_var) and ($se_var!="")){ include("$_home_path/search/function.php"); $sLimit = 100; $stop_Limit = $sLimit; if(isset($_POST['start_Limit'])){$start_Limit = $_POST['start_Limit'];}else{$start_Limit = 0;} $name_search = $se_var; $search_vowels = array('\"'); $name_search = str_replace($search_vowels,"",$name_search); $search_vowels = array("\'s"); $name_search = str_replace($search_vowels,"",$name_search); $search_vowels = array(" . ", " .", ". "); $name_search = str_replace($search_vowels," ",$name_search); $search_vowels = array(" - ", " -", "- "); $name_search = str_replace($search_vowels," ",$name_search); $search_vowels = array("..", "|", "&", "_",":", ",","/","+","%","$","#","@","!",">","<","=","*","~","(",")","the "); $name_search = str_replace($search_vowels," ",$name_search); $name_search = str_replace(" "," ",$name_search); $str_data = explode(" ", $name_search); $linedata = count($str_data); $name_1 = ""; $name_2 = ""; $name_3 = ""; $name_4 = ""; for($j = 0; $j < $linedata; $j++) { if(empty($name_1)) { $name_1 = $str_data[$j]; $name_1 = trim($name_1); }else if(empty($name_2)) { $name_2 = $str_data[$j]; $name_2 = trim($name_2); }else if(empty($name_3)) { $name_3 = $str_data[$j]; $name_3 = trim($name_3); }else if(empty($name_4)) { $name_4 = $str_data[$j]; $name_4 = trim($name_4); } } /*Album กิจกรรมเด่น*/ $SqlSearchAlbum="SELECT `album_id`,`album_name`,`detail`,`created` FROM `album_tbl_album` WHERE (`album_name` LIKE '%$se_var%') OR (`detail` LIKE '%$se_var%') OR (`created` = '$se_var') "; /*num_rows กิจกรรมเด่น*/ $SqlSearchAlbum_count="SELECT COUNT(*) AS num_rows_2 FROM `album_tbl_album` WHERE (`album_name` LIKE '%$se_var%') OR (`detail` LIKE '%$se_var%') OR (`created` = '$se_var') "; $name_11 = CheckSearch($name_1); $name_22 = CheckSearch($name_2); $name_33 = CheckSearch($name_3); $name_44 = CheckSearch($name_4); if(!empty($name_11)) { $SqlSearchAlbum .= "OR (`album_name` LIKE '%$name_11%') OR (`detail` LIKE '%$name_11%') "; $SqlSearchAlbum_count .= "OR (`album_name` LIKE '%$name_11%') OR (`detail` LIKE '%$name_11%') "; } if(!empty($name_22)) { $SqlSearchAlbum .= "OR (`album_name` LIKE '%$name_22%') OR (`detail` LIKE '%$name_22%') "; $SqlSearchAlbum_count .= "OR (`album_name` LIKE '%$name_22%') OR (`detail` LIKE '%$name_22%') "; } if(!empty($name_33)) { $SqlSearchAlbum .= "OR (`album_name` LIKE '%$name_33%') OR (`detail` LIKE '%$name_33%') "; $SqlSearchAlbum_count .= "OR (`album_name` LIKE '%$name_33%') OR (`detail` LIKE '%$name_33%') "; } if(!empty($name_44)) { $SqlSearchAlbum .= "OR (`album_name` LIKE '%$name_44%') OR (`detail` LIKE '%$name_44%') "; $SqlSearchAlbum_count .= "OR (`album_name` LIKE '%$name_44%') OR (`detail` LIKE '%$name_44%') "; } $SqlSearchAlbum .= "ORDER BY `album_id` Desc "; /*News Category*/ $SqlSearchNewsCat = "SELECT `cat_id`,`cat_name` FROM `news_category` WHERE(`cat_name` LIKE '%$se_var%') "; /*num_rows News Category*/ $SqlSearchNewsCat_count = "SELECT COUNT(*) AS num_rows_2 FROM `news_category` WHERE (`cat_name` LIKE '%$se_var%') "; if(!empty($name_11)) { $SqlSearchNewsCat .= " OR (`cat_name` LIKE '%$name_11%') "; $SqlSearchNewsCat_count .= " OR (`cat_name` LIKE '%$name_11%') "; } if(!empty($name_22)) { $SqlSearchNewsCat .= " OR (`cat_name` LIKE '%$name_22%') "; $SqlSearchNewsCat_count .= " OR (`cat_name` LIKE '%$name_22%') "; } if(!empty($name_33)) { $SqlSearchNewsCat .= " OR (`cat_name` LIKE '%$name_33%') "; $SqlSearchNewsCat_count .= " OR (`cat_name` LIKE '%$name_33%') "; } if(!empty($name_44)) { $SqlSearchNewsCat .= " OR (`cat_name` LIKE '%$name_44%') "; $SqlSearchNewsCat_count .= " OR (`cat_name` LIKE '%$name_44%') "; } $SqlSearchNewsCat .= " ORDER BY `cat_id` Desc "; /*News ข่าวประชาสัมพัทธ์ cat_id=17*/ $SqlSearchNewsInfo = "SELECT `id`,`cat_id`,`name`,`detail`,`d_date` FROM `news_detail` WHERE (`cat_id`= '1') AND ((`name` LIKE '%$se_var%') OR (`detail` LIKE '%$se_var%') OR (`d_date`= '$se_var') "; /*num_rows ข่าวประชาสัมพัทธ์*/ $SqlSearchNewsInfo_count = "SELECT COUNT(*) AS num_rows_2 FROM `news_detail` WHERE (`cat_id`= '1') AND ((`name` LIKE '%$se_var%') OR (`detail` LIKE '%$se_var%') OR (`d_date` = '$se_var') "; if(!empty($name_11)) { $SqlSearchNewsInfo .= " OR (`name` LIKE '%$name_11%') OR (`detail` LIKE '%$name_11%') "; $SqlSearchNewsInfo_count .= " OR (`name` LIKE '%$name_11%') OR (`detail` LIKE '%$name_11%') "; } if(!empty($name_22)) { $SqlSearchNewsInfo .= " OR (`name` LIKE '%$name_22%') OR (`detail` LIKE '%$name_22%') "; $SqlSearchNewsInfo_count .= " OR (`name` LIKE '%$name_22%') OR (`detail` LIKE '%$name_22%') "; } if(!empty($name_33)) { $SqlSearchNewsInfo .= " OR (`name` LIKE '%$name_33%') OR (`detail` LIKE '%$name_33%') "; $SqlSearchNewsInfo_count .= " OR (`name` LIKE '%$name_33%') OR (`detail` LIKE '%$name_33%') "; } if(!empty($name_44)) { $SqlSearchNewsInfo .= " OR (`name` LIKE '%$name_44%') OR (`detail` LIKE '%$name_44%') "; $SqlSearchNewsInfo_count .= " OR (`name` LIKE '%$name_44%') OR (`detail` LIKE '%$name_44%') "; } $SqlSearchNewsInfo .= ") ORDER BY `id` Desc "; $SqlSearchNewsInfo_count .= ") "; /*News ประกาศจัดซื้อจัดจ้าง cat_id=13,37*/ $SqlSearchNewsPur = "SELECT `id`,`cat_id`,`name`,`detail`,`d_date` FROM `news_detail` WHERE ((`cat_id`= '13') OR (`cat_id`= '37')) AND ((`name` LIKE '%$se_var%') OR (`detail` LIKE '%$se_var%') OR (`d_date`= '$se_var') "; /*num_rows ประกาศจัดซื้อจัดจ้าง*/ $SqlSearchNewsPur_count = "SELECT COUNT(*) AS num_rows_2 FROM `news_detail` WHERE ((`cat_id`= '13') OR (`cat_id`= '37')) AND ((`name` LIKE '%$se_var%') OR (`detail` LIKE '%$se_var%') OR (`d_date` = '$se_var') "; if(!empty($name_11)) { $SqlSearchNewsPur .= " OR (`name` LIKE '%$name_11%') OR (`detail` LIKE '%$name_11%') "; $SqlSearchNewsPur_count .= " OR (`name` LIKE '%$name_11%') OR (`detail` LIKE '%$name_11%') "; } if(!empty($name_22)) { $SqlSearchNewsPur .= " OR (`name` LIKE '%$name_22%') OR (`detail` LIKE '%$name_22%') "; $SqlSearchNewsPur_count .= " OR (`name` LIKE '%$name_22%') OR (`detail` LIKE '%$name_22%') "; } if(!empty($name_33)) { $SqlSearchNewsPur .= " OR (`name` LIKE '%$name_33%') OR (`detail` LIKE '%$name_33%') "; $SqlSearchNewsPur_count .= " OR (`name` LIKE '%$name_33%') OR (`detail` LIKE '%$name_33%') "; } if(!empty($name_44)) { $SqlSearchNewsPur .= " OR (`name` LIKE '%$name_44%') OR (`detail` LIKE '%$name_44%') "; $SqlSearchNewsPur_count .= " OR (`name` LIKE '%$name_44%') OR (`detail` LIKE '%$name_44%') "; } $SqlSearchNewsPur .= ") ORDER BY `id` Desc "; $SqlSearchNewsPur_count .= ") "; /*News ประกาศจัดซื้อจัดจ้าง e-GP*/ $SqlSearchNewsEgp = "SELECT `id`,`egp_projectId`,`egp_title`,`egp_link`,`egp_date` FROM `tbl_egp_rss` WHERE (`egp_title` LIKE '%$se_var%') OR (`egp_date`= '$se_var') "; /*num_rows ประกาศจัดซื้อจัดจ้าง e-GP*/ $SqlSearchNewsEgp_count = "SELECT COUNT(*) AS num_rows_2 FROM `tbl_egp_rss` WHERE (`egp_title` LIKE '%$se_var%') OR (`egp_date` = '$se_var') "; if(!empty($name_11)) { $SqlSearchNewsEgp .= " OR (`egp_title` LIKE '%$name_11%') "; $SqlSearchNewsEgp_count .= " OR (`egp_title` LIKE '%$name_11%') "; } if(!empty($name_22)) { $SqlSearchNewsEgp .= " OR (`egp_title` LIKE '%$name_22%') "; $SqlSearchNewsEgp_count .= " OR (`egp_title` LIKE '%$name_22%') "; } if(!empty($name_33)) { $SqlSearchNewsEgp .= " OR (`egp_title` LIKE '%$name_33%') "; $SqlSearchNewsEgp_count .= " OR (`egp_title` LIKE '%$name_33%') "; } if(!empty($name_44)) { $SqlSearchNewsEgp .= " OR (`egp_title` LIKE '%$name_44%') "; $SqlSearchNewsEgp_count .= " OR (`egp_title` LIKE '%$name_44%') "; } $SqlSearchNewsEgp .= " ORDER BY `id` Desc "; /*กระดานเสวนา*/ $board_name = "board"; $Result_bcat = mysql_query("SELECT * FROM `webboard_category` WHERE 1 "); $num_rows_bcat = mysql_num_rows($Result_bcat); if( ($num_rows_bcat>0) ){ $row = mysql_fetch_assoc($Result_bcat); $board_name = $row["cat_name"]; unset($Result_bcat); } $SqlSearchBoard = "SELECT `No`,`Category`,`Question`,`Note`,`Date` FROM `webboard_data` WHERE (`Category` = '$board_name') AND ((`Question` LIKE '%$se_var%') OR (`Note` LIKE '%$se_var%') "; /*Num rows กระดานเสวนา*/ $SqlSearchBoard_count = "SELECT COUNT(*) AS num_rows_2 FROM `webboard_data` WHERE (`Category` = '$board_name') AND ((`Question` LIKE '%$se_var%') OR (`Note` LIKE '%$se_var%') "; if(!empty($name_11)) { $SqlSearchBoard .= " OR (`Question` LIKE '%$name_11%') OR (`Note` LIKE '%$name_11%') "; $SqlSearchBoard_count .= " OR (`Question` LIKE '%$name_11%') OR (`Note` LIKE '%$name_11%') "; } if(!empty($name_22)) { $SqlSearchBoard .= " OR (`Question` LIKE '%$name_22%') OR (`Note` LIKE '%$name_11%') "; $SqlSearchBoard_count .= " OR (`Question` LIKE '%$name_22%') OR (`Note` LIKE '%$name_11%') "; } if(!empty($name_33)) { $SqlSearchBoard .= " OR (`Question` LIKE '%$name_33%') OR (`Note` LIKE '%$name_11%') "; $SqlSearchBoard_count .= " OR (`Question` LIKE '%$name_33%') OR (`Note` LIKE '%$name_11%') "; } if(!empty($name_44)) { $SqlSearchBoard .= " OR (`Question` LIKE '%$name_44%') OR (`Note` LIKE '%$name_11%') "; $SqlSearchBoard_count .= " OR (`Question` LIKE '%$name_44%') OR (`Note` LIKE '%$name_11%') "; } $SqlSearchBoard .= ") ORDER BY `No` Desc "; $SqlSearchBoard_count .= ") "; /*Otop*/ $SqlSearchOtop = "SELECT `id`,`alb_title`,`alb_description`,`date_publish` FROM `otop_album` WHERE (`alb_title` LIKE '%$se_var%') OR (`alb_description` LIKE '%$se_var%') "; /*num rows Otop*/ $SqlSearchOtop_count = "SELECT COUNT(*) AS num_rows_2 FROM `otop_album` WHERE (`alb_title` LIKE '%$se_var%') OR (`alb_description` LIKE '%$se_var%') "; if(!empty($name_11)) { $SqlSearchOtop .= " OR (`alb_title` LIKE '%$name_11%') OR (`alb_description` LIKE '%$name_11%') "; $SqlSearchOtop_count .= " OR (`alb_title` LIKE '%$name_11%') OR (`alb_description` LIKE '%$name_11%') "; } if(!empty($name_22)) { $SqlSearchOtop .= " OR (`alb_title` LIKE '%$name_22%') OR (`alb_description` LIKE '%$name_11%') "; $SqlSearchOtop_count .= " OR (`alb_title` LIKE '%$name_22%') OR (`alb_description` LIKE '%$name_11%') "; } if(!empty($name_33)) { $SqlSearchOtop .= " OR (`alb_title` LIKE '%$name_33%') OR (`alb_description` LIKE '%$name_11%') "; $SqlSearchOtop_count .= " OR (`alb_title` LIKE '%$name_33%') OR (`alb_description` LIKE '%$name_11%') "; } if(!empty($name_44)) { $SqlSearchOtop .= " OR (`alb_title` LIKE '%$name_44%') OR (`alb_description` LIKE '%$name_11%') "; $SqlSearchOtop_count .= " OR (`alb_title` LIKE '%$name_44%') OR (`alb_description` LIKE '%$name_11%') "; } $SqlSearchOtop .= " ORDER BY `id` Desc "; /*ท่องเที่ยว*/ $SqlSearchTravel = "SELECT `id`,`alb_title`,`alb_description`,`date_publish` FROM `travel_album` WHERE (`alb_title` LIKE '%$se_var%') OR (`alb_description` LIKE '%$se_var%') "; /*num rows ท่องเที่ยว*/ $SqlSearchTravel_count = "SELECT COUNT(*) AS num_rows_2 FROM `travel_album` WHERE (`alb_title` LIKE '%$se_var%') OR (`alb_description` LIKE '%$se_var%') "; if(!empty($name_11)) { $SqlSearchTravel .= " OR (`alb_title` LIKE '%$name_11%') OR (`alb_description` LIKE '%$name_11%') "; $SqlSearchTravel_count .= " OR (`alb_title` LIKE '%$name_11%') OR (`alb_description` LIKE '%$name_11%') "; } if(!empty($name_22)) { $SqlSearchTravel .= " OR (`alb_title` LIKE '%$name_22%') OR (`alb_description` LIKE '%$name_11%') "; $SqlSearchTravel_count .= " OR (`alb_title` LIKE '%$name_22%') OR (`alb_description` LIKE '%$name_11%') "; } if(!empty($name_33)) { $SqlSearchTravel .= " OR (`alb_title` LIKE '%$name_33%') OR (`alb_description` LIKE '%$name_11%') "; $SqlSearchTravel_count .= " OR (`alb_title` LIKE '%$name_33%') OR (`alb_description` LIKE '%$name_11%') "; } if(!empty($name_44)) { $SqlSearchTravel .= " OR (`alb_title` LIKE '%$name_44%') OR (`alb_description` LIKE '%$name_11%') "; $SqlSearchTravel_count .= " OR (`alb_title` LIKE '%$name_44%') OR (`alb_description` LIKE '%$name_11%') "; } $SqlSearchTravel .= " ORDER BY `id` Desc "; /*News ข่าวอื่นที่ไม่ใช่ cat_id=1,13,37*/ $SqlSearchNewsOther = "SELECT `id`,`cat_id`,`name`,`detail`,`d_date` FROM `news_detail` WHERE (`cat_id`not in (1,13,37)) AND ((`name` LIKE '%$se_var%') OR (`detail` LIKE '%$se_var%') OR (`d_date`= '$se_var') "; /*num_rows ข่าวอื่นที่ไม่ใช่ cat_id=1,13,37*/ $SqlSearchNewsOther_count = "SELECT COUNT(*) AS num_rows_2 FROM `news_detail` WHERE (`cat_id`not in (1,13,37)) AND ((`name` LIKE '%$se_var%') OR (`detail` LIKE '%$se_var%') OR (`d_date` = '$se_var') "; if(!empty($name_11)) { $SqlSearchNewsOther .= " OR (`name` LIKE '%$name_11%') OR (`detail` LIKE '%$name_11%') "; $SqlSearchNewsOther_count .= " OR (`name` LIKE '%$name_11%') OR (`detail` LIKE '%$name_11%') "; } if(!empty($name_22)) { $SqlSearchNewsOther .= " OR (`name` LIKE '%$name_22%') OR (`detail` LIKE '%$name_22%') "; $SqlSearchNewsOther_count .= " OR (`name` LIKE '%$name_22%') OR (`detail` LIKE '%$name_22%') "; } if(!empty($name_33)) { $SqlSearchNewsOther .= " OR (`name` LIKE '%$name_33%') OR (`detail` LIKE '%$name_33%') "; $SqlSearchNewsOther_count .= " OR (`name` LIKE '%$name_33%') OR (`detail` LIKE '%$name_33%') "; } if(!empty($name_44)) { $SqlSearchNewsOther .= " OR (`name` LIKE '%$name_44%') OR (`detail` LIKE '%$name_44%') "; $SqlSearchNewsOther_count .= " OR (`name` LIKE '%$name_44%') OR (`detail` LIKE '%$name_44%') "; } $SqlSearchNewsOther .= ") ORDER BY `id` Desc "; $SqlSearchNewsOther_count .= ") "; $refserver = getenv('HTTP_REFERER'); $refserver = substr($refserver,0,23); $chk_tar = ' target=\"_balnk\"'; /*if(empty($refserver) or ($refserver =="http://www.thungtor.go.th/")){ $chk_tar = ''; }*/ ?> <div style="background-color: #ffffff;magin: 3px;padding: 5px;border-radius: 8px;"><a name="search_top"></a> <div style="border-bottom: 1px solid #ff9900;"><strong>ค้นหา <font id="stext_font" color="#FF0000"><? echo '"'.stripslashes($se_var).'"'; ?></font></strong></div> <div> <? $Per_Page = 100; $skeyword = $se_var; /*News Category*/ if(!$Page) $Page=1; $Prev_Page = $Page-1; $Next_Page = $Page+1; $Page_start = ($Per_Page*$Page)-$Per_Page; $Result_count = mysql_query($SqlSearchNewsCat_count); $Num_Rows_count = mysql_num_rows($Result_count); if($Num_Rows_count>0){ $result = mysql_fetch_assoc($Result_count); $Num_Rows_count = $result["num_rows_2"]; } unset($Result_count); if($Num_Rows_count<=$Per_Page) $Num_Pages =1; else if(($Num_Rows_count % $Per_Page)==0) $Num_Pages =($Num_Rows_count/$Per_Page) ; else $Num_Pages =($Num_Rows_count/$Per_Page) +1; $Num_Pages = (int)$Num_Pages; $more_html = "<div style=\"text-align:center;\">"; if($Prev_Page) $more_html .= " <a href='$PHP_SELF?Page=1&sevalue=".$se_var."#newscat_top'><< </a><a href='$PHP_SELF?Page=$Prev_Page&sevalue=".$se_var."#newscat_top'><</a> "; $Show_Page = 2; $s1 = $Page - $Show_Page; if($s1 <= 0 ){$s1 = 1;} $s2 = $Page + $Show_Page; if($s2 > $Num_Pages){$s2 = $Num_Pages;} if($s1 == 1 ){ $s2 = $Show_Page+2; if($s2 > $Num_Pages){$s2 = $Num_Pages;} } if(($s2 == $Num_Pages) &&($s1 != 1)){ $s1 = $Num_Pages-4; if($s1 <= 0 ){$s1 = 1;} } for($i=$s1; $i<=$s2; $i++) { if($i != $Page) { $more_html .= "[<a href='$PHP_SELF?Page=$i&sevalue=".$se_var."#newscat_top'>$i</a>]"; } else { if($Num_Rows_count > $Per_Page){ $more_html .= "<b> $i </b>"; } } } if($Page!=$Num_Pages) $more_html .= " <a href ='$PHP_SELF?Page=$Next_Page&sevalue=".$se_var."#newscat_top'>> </a><a href ='$PHP_SELF?Page=$Num_Pages&sevalue=".$se_var."#newscat_top'>></a> "; $more_html .= "</div>"; $SqlSearchNewsCat .= "LIMIT $Page_start , $Per_Page"; $Result_cat= mysql_query($SqlSearchNewsCat); $num_rows = mysql_num_rows($Result_cat); if( ($num_rows>0) ){ $chk_found=1; echo "<div style=\"color:#006699;padding-top:10px;\">"; echo "<a name=\"newscat_top\"></a>"; $sTart_i = ($Page-1) * $Per_Page; $sTart_i += 1; $sTop_i = $Page * $Per_Page; if($sTop_i > $Num_Rows_count) $sTop_i = $Num_Rows_count; if($Num_Rows_count >= $Per_Page){ echo "<div> <b>ข้อมูลหน่วยงาน ( ".$sTart_i."-".$sTop_i." จาก ".$Num_Rows_count." รายการ )</b> </div>"; echo $more_html; }else{ echo "<div> <b>ข้อมูลหน่วยงาน ( ".$Num_Rows_count." รายการ )</b></div>"; } echo "</div>"; $i = ($Page-1) * $Per_Page; while ($row_cat = mysql_fetch_assoc($Result_cat)) { $i++; $c_by_name = $row_cat['cat_name']; $c_by_name = replace_redfont($c_by_name,$skeyword,$name_1,$name_2,$name_3,$name_4); echo "<div>$i. <a href='".$_web_path."/news.php?cat_id=".$row_cat['cat_id']."'".$chk_tar." class=\"styles2\">" .$c_by_name."</a>"; } } unset($Result_cat); /*Album กิจกรรมเด่น*/ if(!$Page) $Page=1; $Prev_Page = $Page-1; $Next_Page = $Page+1; $Page_start = ($Per_Page*$Page)-$Per_Page; $Result_count = mysql_query($SqlSearchAlbum_count); $Num_Rows_count = mysql_num_rows($Result_count); if($Num_Rows_count>0){ $result = mysql_fetch_assoc($Result_count); $Num_Rows_count = $result["num_rows_2"]; } unset($Result_count); if($Num_Rows_count<=$Per_Page) $Num_Pages =1; else if(($Num_Rows_count % $Per_Page)==0) $Num_Pages =($Num_Rows_count/$Per_Page) ; else $Num_Pages =($Num_Rows_count/$Per_Page) +1; $Num_Pages = (int)$Num_Pages; $more_html = "<div style=\"text-align:center\">\r\n"; if($Prev_Page) $more_html .= " <a href='$PHP_SELF?Page=1&sevalue=".$se_var."#search_top'><< </a><a href='$PHP_SELF?Page=$Prev_Page&sevalue=".$se_var."#search_top'><</a> \r\n"; $Show_Page = 2; $s1 = $Page - $Show_Page; if($s1 <= 0 ){$s1 = 1;} $s2 = $Page + $Show_Page; if($s2 > $Num_Pages){$s2 = $Num_Pages;} if($s1 == 1 ){ $s2 = $Show_Page+2; if($s2 > $Num_Pages){$s2 = $Num_Pages;} } if(($s2 == $Num_Pages) &&($s1 != 1)){ $s1 = $Num_Pages-4; if($s1 <= 0 ){$s1 = 1;} } for($i=$s1; $i<=$s2; $i++) { if($i != $Page) { $more_html .= "[<a href='$PHP_SELF?Page=$i&sevalue=".$se_var."#search_top'>$i</a>]\r\n"; } else { if($Num_Rows_count > $Per_Page){ $more_html .= "<b> $i </b>\r\n"; } } } if($Page!=$Num_Pages) $more_html .= " <a href ='$PHP_SELF?Page=$Next_Page&sevalue=".$se_var."#search_top'>> </a><a href ='$PHP_SELF?Page=$Num_Pages&sevalue=".$se_var."#search_top'>>></a>\r\n "; $more_html .= "</div>\r\n"; $SqlSearchAlbum .= "LIMIT $Page_start , $Per_Page"; $Result_album= mysql_query($SqlSearchAlbum); $num_rows = mysql_num_rows($Result_album); if($num_rows>0){ $chk_found=1; echo "<div style=\"color:#006699;padding-top:10px;\">"; $sTart_i = ($Page-1) * $Per_Page; $sTart_i += 1; $sTop_i = $Page * $Per_Page; if($sTop_i > $Num_Rows_count) $sTop_i = $Num_Rows_count; if($Num_Rows_count >= $Per_Page){ echo "<div> <b>กิจกรรมเด่น ( ".$sTart_i."-".$sTop_i." จาก ".$Num_Rows_count." รายการ )</b> </div>"; echo $more_html; } else { echo "<div valign=\"top\"> <b>กิจกรรมเด่น ( ".$Num_Rows_count." รายการ )</b></div>"; } echo "</div>"; $i = ($Page-1) * $Per_Page; while ($row_album = mysql_fetch_assoc($Result_album)) { $i++; $c_by_album_name = $row_album['album_name']; $c_by_album_name = trim($c_by_album_name); $c_by_album_name = replace_redfont($c_by_album_name,$skeyword,$name_1,$name_2,$name_3,$name_4); echo "<div>$i. <a href='$_web_path/album/view.php?album_id=".$row_album['album_id']."'".$chk_tar." class=\"styles2\">" .$c_by_album_name."</a> "; if(substr($row_album['created'] , 0, 4)!='0000'){ echo " <font color='#999999'>(".substr($row_album['created'],8,2)."/".substr($row_album['created'],5,2)."/".substr($row_album['created'],0,4). ")</font> " ; }else echo " "; echo "</div>"; }//while } unset($Result_album); /*News ข่าวประชาสัมพันธ์*/ if(!$Page) $Page=1; $Prev_Page = $Page-1; $Next_Page = $Page+1; $Page_start = ($Per_Page*$Page)-$Per_Page; $Result_count = mysql_query($SqlSearchNewsInfo_count); $Num_Rows_count = mysql_num_rows($Result_count); if($Num_Rows_count>0){ $result = mysql_fetch_assoc($Result_count); $Num_Rows_count = $result["num_rows_2"]; } unset($Result_count); if($Num_Rows_count<=$Per_Page) $Num_Pages =1; else if(($Num_Rows_count % $Per_Page)==0) $Num_Pages =($Num_Rows_count/$Per_Page) ; else $Num_Pages =($Num_Rows_count/$Per_Page) +1; $Num_Pages = (int)$Num_Pages; $more_html = "<div style=\"text-align:center;\">"; if($Prev_Page) $more_html .= " <a href='$PHP_SELF?Page=1&sevalue=".$se_var."#newsinfo_top'><< </a><a href='$PHP_SELF?Page=$Prev_Page&sevalue=".$se_var."#newsinfo_top'><</a> "; $Show_Page = 2; $s1 = $Page - $Show_Page; if($s1 <= 0 ){$s1 = 1;} $s2 = $Page + $Show_Page; if($s2 > $Num_Pages){$s2 = $Num_Pages;} if($s1 == 1 ){ $s2 = $Show_Page+2; if($s2 > $Num_Pages){$s2 = $Num_Pages;} } if(($s2 == $Num_Pages) &&($s1 != 1)){ $s1 = $Num_Pages-4; if($s1 <= 0 ){$s1 = 1;} } for($i=$s1; $i<=$s2; $i++) { if($i != $Page) { $more_html .= "[<a href='$PHP_SELF?Page=$i&sevalue=".$se_var."#newsinfo_top'>$i</a>]"; } else { if($Num_Rows_count > $Per_Page){ $more_html .= "<b> $i </b>"; } } } if($Page!=$Num_Pages) $more_html .= " <a href ='$PHP_SELF?Page=$Next_Page&sevalue=".$se_var."#newsinfo_top'>> </a><a href ='$PHP_SELF?Page=$Num_Pages&sevalue=".$se_var."#newsinfo_top'>></a> "; $more_html .= "</div>"; $SqlSearchNewsInfo .= "LIMIT $Page_start , $Per_Page"; $Result_info= mysql_query($SqlSearchNewsInfo); $num_rows = mysql_num_rows($Result_info); if( ($num_rows>0) ){ $chk_found=1; echo "<div style=\"color:#006699;padding-top:10px;\">"; echo "<a name=\"newsinfo_top\"></a>"; $sTart_i = ($Page-1) * $Per_Page; $sTart_i += 1; $sTop_i = $Page * $Per_Page; if($sTop_i > $Num_Rows_count) $sTop_i = $Num_Rows_count; if($Num_Rows_count >= $Per_Page){ echo "<div> <b>ข่าวประชาสัมพันธ์ ( ".$sTart_i."-".$sTop_i." จาก ".$Num_Rows_count." รายการ )</b> </div>"; echo $more_html; } else { echo "<div> <b>ข่าวประชาสัมพันธ์ ( ".$Num_Rows_count." รายการ )</b></div>"; } echo "</div>"; $i = ($Page-1) * $Per_Page; while ($row_info = mysql_fetch_assoc($Result_info)) { $i++; $c_by_name = $row_info['name']; $c_by_name = replace_redfont($c_by_name,$skeyword,$name_1,$name_2,$name_3,$name_4); echo "<div>$i. <a href='".$_web_path."/detail.php?id=".$row_info['id']."'".$chk_tar." class=\"styles2\">" .$c_by_name."</a>"; if(substr($row_info['d_date'] , 0, 4)!='0000'){ echo " <font color='#999999'>(".substr($row_info['d_date'],8,2)."/".substr($row_info['d_date'],5,2)."/".substr($row_info['d_date'],0,4). ")</font> " ; }else echo " "; } } unset($Result_info); /*News ประกาศจัดซื้อจัดจ้าง*/ if(!$Page) $Page=1; $Prev_Page = $Page-1; $Next_Page = $Page+1; $Page_start = ($Per_Page*$Page)-$Per_Page; $Result_count = mysql_query($SqlSearchNewsPur_count); $Num_Rows_count = mysql_num_rows($Result_count); if($Num_Rows_count>0){ $result = mysql_fetch_assoc($Result_count); $Num_Rows_count = $result["num_rows_2"]; } unset($Result_count); if($Num_Rows_count<=$Per_Page) $Num_Pages =1; else if(($Num_Rows_count % $Per_Page)==0) $Num_Pages =($Num_Rows_count/$Per_Page) ; else $Num_Pages =($Num_Rows_count/$Per_Page) +1; $Num_Pages = (int)$Num_Pages; $more_html = "<div style=\"text-align:center;\">"; if($Prev_Page) $more_html .= " <a href='$PHP_SELF?Page=1&sevalue=".$se_var."#newsPur_top'><< </a><a href='$PHP_SELF?Page=$Prev_Page&sevalue=".$se_var."#newsPur_top'><</a> "; $Show_Page = 2; $s1 = $Page - $Show_Page; if($s1 <= 0 ){$s1 = 1;} $s2 = $Page + $Show_Page; if($s2 > $Num_Pages){$s2 = $Num_Pages;} if($s1 == 1 ){ $s2 = $Show_Page+2; if($s2 > $Num_Pages){$s2 = $Num_Pages;} } if(($s2 == $Num_Pages) &&($s1 != 1)){ $s1 = $Num_Pages-4; if($s1 <= 0 ){$s1 = 1;} } for($i=$s1; $i<=$s2; $i++) { if($i != $Page) { $more_html .= "[<a href='$PHP_SELF?Page=$i&sevalue=".$se_var."#newsPur_top'>$i</a>]"; } else { if($Num_Rows_count > $Per_Page){ $more_html .= "<b> $i </b>"; } } } if($Page!=$Num_Pages) $more_html .= " <a href ='$PHP_SELF?Page=$Next_Page&sevalue=".$se_var."#newsPur_top'>> </a><a href ='$PHP_SELF?Page=$Num_Pages&sevalue=".$se_var."#newsPur_top'>></a> "; $more_html .= "</div>"; $SqlSearchNewsPur .= "LIMIT $Page_start , $Per_Page"; $Result_Pur= mysql_query($SqlSearchNewsPur); $num_rows = mysql_num_rows($Result_Pur); if( ($num_rows>0) ){ $chk_found=1; echo "<div style=\"color:#006699;padding-top:10px;\">"; echo "<a name=\"newsPur_top\"></a>"; $sTart_i = ($Page-1) * $Per_Page; $sTart_i += 1; $sTop_i = $Page * $Per_Page; if($sTop_i > $Num_Rows_count) $sTop_i = $Num_Rows_count; if($Num_Rows_count >= $Per_Page){ echo "<div> <b>ประกาศจัดซื้อจัดจ้าง ( ".$sTart_i."-".$sTop_i." จาก ".$Num_Rows_count." รายการ )</b> </div>"; echo $more_html; } else { echo "<div> <b>ประกาศจัดซื้อจัดจ้าง ( ".$Num_Rows_count." รายการ )</b></div>"; } echo "</div>"; $i = ($Page-1) * $Per_Page; while ($row_Pur = mysql_fetch_assoc($Result_Pur)) { $i++; $c_by_name = $row_Pur['name']; $c_by_name = replace_redfont($c_by_name,$skeyword,$name_1,$name_2,$name_3,$name_4); echo "<div>$i. <a href='".$_web_path."/detail.php?id=".$row_Pur['id']."'".$chk_tar." class=\"styles2\">" .$c_by_name."</a>"; if(substr($row_Pur['d_date'] , 0, 4)!='0000'){ echo " <font color='#999999'>(".substr($row_Pur['d_date'],8,2)."/".substr($row_Pur['d_date'],5,2)."/".substr($row_Pur['d_date'],0,4). ")</font> " ; }else echo " "; } } unset($Result_Pur); /*News ประกาศจัดซื้อจัดจ้าง e-GP*/ if(!$Page) $Page=1; $Prev_Page = $Page-1; $Next_Page = $Page+1; $Page_start = ($Per_Page*$Page)-$Per_Page; $Result_count = mysql_query($SqlSearchNewsEgp_count); $Num_Rows_count = mysql_num_rows($Result_count); if($Num_Rows_count>0){ $result = mysql_fetch_assoc($Result_count); $Num_Rows_count = $result["num_rows_2"]; } unset($Result_count); if($Num_Rows_count<=$Per_Page) $Num_Pages =1; else if(($Num_Rows_count % $Per_Page)==0) $Num_Pages =($Num_Rows_count/$Per_Page) ; else $Num_Pages =($Num_Rows_count/$Per_Page) +1; $Num_Pages = (int)$Num_Pages; $more_html = "<div style=\"text-align:center;\">"; if($Prev_Page) $more_html .= " <a href='$PHP_SELF?Page=1&sevalue=".$se_var."#newsEgp_top'><< </a><a href='$PHP_SELF?Page=$Prev_Page&sevalue=".$se_var."#newsEgp_top'><</a> "; $Show_Page = 2; $s1 = $Page - $Show_Page; if($s1 <= 0 ){$s1 = 1;} $s2 = $Page + $Show_Page; if($s2 > $Num_Pages){$s2 = $Num_Pages;} if($s1 == 1 ){ $s2 = $Show_Page+2; if($s2 > $Num_Pages){$s2 = $Num_Pages;} } if(($s2 == $Num_Pages) &&($s1 != 1)){ $s1 = $Num_Pages-4; if($s1 <= 0 ){$s1 = 1;} } for($i=$s1; $i<=$s2; $i++) { if($i != $Page) { $more_html .= "[<a href='$PHP_SELF?Page=$i&sevalue=".$se_var."#newsEgp_top'>$i</a>]"; } else { if($Num_Rows_count > $Per_Page){ $more_html .= "<b> $i </b>"; } } } if($Page!=$Num_Pages) $more_html .= " <a href ='$PHP_SELF?Page=$Next_Page&sevalue=".$se_var."#newsEgp_top'>> </a><a href ='$PHP_SELF?Page=$Num_Pages&sevalue=".$se_var."#newsEgp_top'>></a> "; $more_html .= "</div>"; $SqlSearchNewsEgp .= "LIMIT $Page_start , $Per_Page"; $Result_Egp= mysql_query($SqlSearchNewsEgp); $num_rows = mysql_num_rows($Result_Egp); if( ($num_rows>0) ){ $chk_found=1; echo "<div style=\"color:#006699;padding-top:10px;\">"; echo "<a name=\"newsEgp_top\"></a>"; $sTart_i = ($Page-1) * $Per_Page; $sTart_i += 1; $sTop_i = $Page * $Per_Page; if($sTop_i > $Num_Rows_count) $sTop_i = $Num_Rows_count; if($Num_Rows_count >= $Per_Page){ echo "<div> <b>ประกาศจัดซื้อจัดจ้าง e-GP ( ".$sTart_i."-".$sTop_i." จาก ".$Num_Rows_count." รายการ )</b> </div>"; echo $more_html; } else { echo "<div> <b>ประกาศจัดซื้อจัดจ้าง e-GP ( ".$Num_Rows_count." รายการ )</b></div>"; } echo "</div>"; $i = ($Page-1) * $Per_Page; while ($row_Egp = mysql_fetch_assoc($Result_Egp)) { $i++; $c_by_name = $row_Egp['egp_title']; $c_by_name = replace_redfont($c_by_name,$skeyword,$name_1,$name_2,$name_3,$name_4); echo "<div>$i. <a href='".$row_Egp['egp_link']."'".$chk_tar." class=\"styles2\">" .$c_by_name."</a>"; if(substr($row_Egp['egp_date'] , 0, 4)!='0000'){ echo " <font color='#999999'>(".substr($row_Egp['egp_date'],8,2)."/".substr($row_Egp['egp_date'],5,2)."/".substr($row_Egp['egp_date'],0,4). ")</font> " ; }else echo " "; } } unset($Result_Egp); /*กระดานเสวนา*/ if(!$Page) $Page=1; $Prev_Page = $Page-1; $Next_Page = $Page+1; $Page_start = ($Per_Page*$Page)-$Per_Page; $Result_count = mysql_query($SqlSearchBoard_count); $Num_Rows_count = mysql_num_rows($Result_count); if($Num_Rows_count>0){ $result = mysql_fetch_assoc($Result_count); $Num_Rows_count = $result["num_rows_2"]; } unset($Result_count); if($Num_Rows_count<=$Per_Page) $Num_Pages =1; else if(($Num_Rows_count % $Per_Page)==0) $Num_Pages =($Num_Rows_count/$Per_Page) ; else $Num_Pages =($Num_Rows_count/$Per_Page) +1; $Num_Pages = (int)$Num_Pages; $more_html = "<div style=\"text-align:center;\">"; if($Prev_Page) $more_html .= " <a href='$PHP_SELF?Page=1&sevalue=".$se_var."#Board_top'><< </a><a href='$PHP_SELF?Page=$Prev_Page&sevalue=".$se_var."#Board_top'><</a> "; $Show_Page = 2; $s1 = $Page - $Show_Page; if($s1 <= 0 ){$s1 = 1;} $s2 = $Page + $Show_Page; if($s2 > $Num_Pages){$s2 = $Num_Pages;} if($s1 == 1 ){ $s2 = $Show_Page+2; if($s2 > $Num_Pages){$s2 = $Num_Pages;} } if(($s2 == $Num_Pages) &&($s1 != 1)){ $s1 = $Num_Pages-4; if($s1 <= 0 ){$s1 = 1;} } for($i=$s1; $i<=$s2; $i++) { if($i != $Page) { $more_html .= "[<a href='$PHP_SELF?Page=$i&sevalue=".$se_var."#Board_top'>$i</a>]"; } else { if($Num_Rows_count > $Per_Page){ $more_html .= "<b> $i </b>"; } } } if($Page!=$Num_Pages) $more_html .= " <a href ='$PHP_SELF?Page=$Next_Page&sevalue=".$se_var."#Board_top'>> </a><a href ='$PHP_SELF?Page=$Num_Pages&sevalue=".$se_var."#Board_top'>></a> "; $more_html .= "</div>"; $SqlSearchBoard .= "LIMIT $Page_start , $Per_Page"; $Result_Board= mysql_query($SqlSearchBoard); $num_rows = mysql_num_rows($Result_Board); if( ($num_rows>0) ){ $chk_found=1; echo "<div style=\"color:#006699;padding-top:10px;\">"; echo "<a name=\"Board_top\"></a>"; $sTart_i = ($Page-1) * $Per_Page; $sTart_i += 1; $sTop_i = $Page * $Per_Page; if($sTop_i > $Num_Rows_count) $sTop_i = $Num_Rows_count; if($Num_Rows_count >= $Per_Page){ echo "<div> <b>กระดานเสวนา ( ".$sTart_i."-".$sTop_i." จาก ".$Num_Rows_count." รายการ )</b> </div>"; echo $more_html; } else { echo "<div> <b>กระดานเสวนา ( ".$Num_Rows_count." รายการ )</b></div>"; } echo "</div>"; $i = ($Page-1) * $Per_Page; while ($row_Board = mysql_fetch_assoc($Result_Board)) { $i++; $c_by_name = $row_Board['Question']; $c_by_name = replace_redfont($c_by_name,$skeyword,$name_1,$name_2,$name_3,$name_4); echo "<div>$i. <a href='".$_web_path."/webboard/show.php?Category=".$board_name."&No=".$row_Board['No']."'".$chk_tar." class=\"styles2\">" .$c_by_name."</a>"; if(substr($row_Board['Date'] , 0, 4)!='0000'){ echo " <font color='#999999'>(".substr($row_Board['Date'],8,2)."/".substr($row_Board['Date'],5,2)."/".substr($row_Board['Date'],0,4). ")</font> " ; }else echo " "; } } unset($Result_Board); /*Otop*/ if(!$Page) $Page=1; $Prev_Page = $Page-1; $Next_Page = $Page+1; $Page_start = ($Per_Page*$Page)-$Per_Page; $Result_count = mysql_query($SqlSearchOtop_count); $Num_Rows_count = mysql_num_rows($Result_count); if($Num_Rows_count>0){ $result = mysql_fetch_assoc($Result_count); $Num_Rows_count = $result["num_rows_2"]; } unset($Result_count); if($Num_Rows_count<=$Per_Page) $Num_Pages =1; else if(($Num_Rows_count % $Per_Page)==0) $Num_Pages =($Num_Rows_count/$Per_Page) ; else $Num_Pages =($Num_Rows_count/$Per_Page) +1; $Num_Pages = (int)$Num_Pages; $more_html = "<div style=\"text-align:center;\">"; if($Prev_Page) $more_html .= " <a href='$PHP_SELF?Page=1&sevalue=".$se_var."#Otop_top'><< </a><a href='$PHP_SELF?Page=$Prev_Page&sevalue=".$se_var."#Otop_top'><</a> "; $Show_Page = 2; $s1 = $Page - $Show_Page; if($s1 <= 0 ){$s1 = 1;} $s2 = $Page + $Show_Page; if($s2 > $Num_Pages){$s2 = $Num_Pages;} if($s1 == 1 ){ $s2 = $Show_Page+2; if($s2 > $Num_Pages){$s2 = $Num_Pages;} } if(($s2 == $Num_Pages) &&($s1 != 1)){ $s1 = $Num_Pages-4; if($s1 <= 0 ){$s1 = 1;} } for($i=$s1; $i<=$s2; $i++) { if($i != $Page) { $more_html .= "[<a href='$PHP_SELF?Page=$i&sevalue=".$se_var."#Otop_top'>$i</a>]"; } else { if($Num_Rows_count > $Per_Page){ $more_html .= "<b> $i </b>"; } } } if($Page!=$Num_Pages) $more_html .= " <a href ='$PHP_SELF?Page=$Next_Page&sevalue=".$se_var."#Otop_top'>> </a><a href ='$PHP_SELF?Page=$Num_Pages&sevalue=".$se_var."#Otop_top'>></a> "; $more_html .= "</div>"; $SqlSearchOtop .= " LIMIT $Page_start , $Per_Page"; $Result_Otop= mysql_query($SqlSearchOtop); $num_rows = mysql_num_rows($Result_Otop); if( ($num_rows>0) ){ $chk_found=1; echo "<div style=\"color:#006699;padding-top:10px;\">"; echo "<a name=\"Otop_top\"></a>"; $sTart_i = ($Page-1) * $Per_Page; $sTart_i += 1; $sTop_i = $Page * $Per_Page; if($sTop_i > $Num_Rows_count) $sTop_i = $Num_Rows_count; if($Num_Rows_count >= $Per_Page){ echo "<div> <b>สินค้าชุมชน ( ".$sTart_i."-".$sTop_i." จาก ".$Num_Rows_count." รายการ )</b> </div>"; echo $more_html; } else { echo "<div> <b>สินค้าชุมชน ( ".$Num_Rows_count." รายการ )</b></div>"; } echo "</div>"; $i = ($Page-1) * $Per_Page; while ($row_Otop = mysql_fetch_assoc($Result_Otop)) { $i++; $c_by_name = $row_Otop['alb_title']; $c_by_name = replace_redfont($c_by_name,$skeyword,$name_1,$name_2,$name_3,$name_4); echo "<div>$i. <a href='".$_web_path."/otops/otop.php?salb_id=".$row_Otop['id']."'".$chk_tar." class=\"styles2\">" .$c_by_name."</a>"; if(substr($row_Otop['date_publish'] , 0, 4)!='0000'){ echo " <font color='#999999'>(".substr($row_Otop['date_publish'],8,2)."/".substr($row_Otop['date_publish'],5,2)."/".substr($row_Otop['date_publish'],0,4). ")</font> " ; }else echo " "; } } unset($Result_Otop); /*ท่องเที่ยว*/ if(!$Page) $Page=1; $Prev_Page = $Page-1; $Next_Page = $Page+1; $Page_start = ($Per_Page*$Page)-$Per_Page; $Result_count = mysql_query($SqlSearchTravel_count); $Num_Rows_count = mysql_num_rows($Result_count); if($Num_Rows_count>0){ $result = mysql_fetch_assoc($Result_count); $Num_Rows_count = $result["num_rows_2"]; } unset($Result_count); if($Num_Rows_count<=$Per_Page) $Num_Pages =1; else if(($Num_Rows_count % $Per_Page)==0) $Num_Pages =($Num_Rows_count/$Per_Page) ; else $Num_Pages =($Num_Rows_count/$Per_Page) +1; $Num_Pages = (int)$Num_Pages; $more_html = "<div style=\"text-align:center;\">"; if($Prev_Page) $more_html .= " <a href='$PHP_SELF?Page=1&sevalue=".$se_var."#Travel_top'><< </a><a href='$PHP_SELF?Page=$Prev_Page&sevalue=".$se_var."#Travel_top'><</a> "; $Show_Page = 2; $s1 = $Page - $Show_Page; if($s1 <= 0 ){$s1 = 1;} $s2 = $Page + $Show_Page; if($s2 > $Num_Pages){$s2 = $Num_Pages;} if($s1 == 1 ){ $s2 = $Show_Page+2; if($s2 > $Num_Pages){$s2 = $Num_Pages;} } if(($s2 == $Num_Pages) &&($s1 != 1)){ $s1 = $Num_Pages-4; if($s1 <= 0 ){$s1 = 1;} } for($i=$s1; $i<=$s2; $i++) { if($i != $Page) { $more_html .= "[<a href='$PHP_SELF?Page=$i&sevalue=".$se_var."#Travel_top'>$i</a>]"; } else { if($Num_Rows_count > $Per_Page){ $more_html .= "<b> $i </b>"; } } } if($Page!=$Num_Pages) $more_html .= " <a href ='$PHP_SELF?Page=$Next_Page&sevalue=".$se_var."#Travel_top'>> </a><a href ='$PHP_SELF?Page=$Num_Pages&sevalue=".$se_var."#Travel_top'>></a> "; $more_html .= "</div>"; $SqlSearchTravel .= " LIMIT $Page_start , $Per_Page"; $Result_Travel= mysql_query($SqlSearchTravel); $num_rows = mysql_num_rows($Result_Travel); if( ($num_rows>0) ){ $chk_found=1; echo "<div style=\"color:#006699;padding-top:10px;\">"; echo "<a name=\"Travel_top\"></a>"; $sTart_i = ($Page-1) * $Per_Page; $sTart_i += 1; $sTop_i = $Page * $Per_Page; if($sTop_i > $Num_Rows_count) $sTop_i = $Num_Rows_count; if($Num_Rows_count >= $Per_Page){ echo "<div> <b>ท่องเที่ยว ( ".$sTart_i."-".$sTop_i." จาก ".$Num_Rows_count." รายการ )</b> </div>"; echo $more_html; } else { echo "<div> <b>ท่องเที่ยว ( ".$Num_Rows_count." รายการ )</b></div>"; } echo "</div>"; $i = ($Page-1) * $Per_Page; while ($row_Travel = mysql_fetch_assoc($Result_Travel)) { $i++; $c_by_name = $row_Travel['alb_title']; $c_by_name = replace_redfont($c_by_name,$skeyword,$name_1,$name_2,$name_3,$name_4); echo "<div>$i. <a href='".$_web_path."/travels/travel.php?salb_id=".$row_Travel['id']."'".$chk_tar." class=\"styles2\">" .$c_by_name."</a>"; if(substr($row_Travel['date_publish'] , 0, 4)!='0000'){ echo " <font color='#999999'>(".substr($row_Travel['date_publish'],8,2)."/".substr($row_Travel['date_publish'],5,2)."/".substr($row_Travel['date_publish'],0,4). ")</font> " ; }else echo " "; } } unset($Result_Travel); /*News อื่นๆ ที่ไม่ใช่ cat_id=1,13,37*/ if(!$Page) $Page=1; $Prev_Page = $Page-1; $Next_Page = $Page+1; $Page_start = ($Per_Page*$Page)-$Per_Page; $Result_count = mysql_query($SqlSearchNewsOther_count); $Num_Rows_count = mysql_num_rows($Result_count); if($Num_Rows_count>0){ $result = mysql_fetch_assoc($Result_count); $Num_Rows_count = $result["num_rows_2"]; } unset($Result_count); if($Num_Rows_count<=$Per_Page) $Num_Pages =1; else if(($Num_Rows_count % $Per_Page)==0) $Num_Pages =($Num_Rows_count/$Per_Page) ; else $Num_Pages =($Num_Rows_count/$Per_Page) +1; $Num_Pages = (int)$Num_Pages; $more_html = "<div style=\"text-align:center;\">"; if($Prev_Page) $more_html .= " <a href='$PHP_SELF?Page=1&sevalue=".$se_var."#newsOther_top'><< </a><a href='$PHP_SELF?Page=$Prev_Page&sevalue=".$se_var."#newsOther_top'><</a> "; $Show_Page = 2; $s1 = $Page - $Show_Page; if($s1 <= 0 ){$s1 = 1;} $s2 = $Page + $Show_Page; if($s2 > $Num_Pages){$s2 = $Num_Pages;} if($s1 == 1 ){ $s2 = $Show_Page+2; if($s2 > $Num_Pages){$s2 = $Num_Pages;} } if(($s2 == $Num_Pages) &&($s1 != 1)){ $s1 = $Num_Pages-4; if($s1 <= 0 ){$s1 = 1;} } for($i=$s1; $i<=$s2; $i++) { if($i != $Page) { $more_html .= "[<a href='$PHP_SELF?Page=$i&sevalue=".$se_var."#newsOther_top'>$i</a>]"; } else { if($Num_Rows_count > $Per_Page){ $more_html .= "<b> $i </b>"; } } } if($Page!=$Num_Pages) $more_html .= " <a href ='$PHP_SELF?Page=$Next_Page&sevalue=".$se_var."#newsOther_top'>> </a><a href ='$PHP_SELF?Page=$Num_Pages&sevalue=".$se_var."#newsOther_top'>></a> "; $more_html .= "</div>"; $SqlSearchNewsOther .= "LIMIT $Page_start , $Per_Page"; $Result_Other= mysql_query($SqlSearchNewsOther); $num_rows = mysql_num_rows($Result_Other); if( ($num_rows>0) ){ $chk_found=1; echo "<div style=\"color:#006699;padding-top:10px;\">"; echo "<a name=\"newsOther_top\"></a>"; $sTart_i = ($Page-1) * $Per_Page; $sTart_i += 1; $sTop_i = $Page * $Per_Page; if($sTop_i > $Num_Rows_count) $sTop_i = $Num_Rows_count; if($Num_Rows_count >= $Per_Page){ echo "<div> <b> อื่นๆ ( ".$sTart_i."-".$sTop_i." จาก ".$Num_Rows_count." รายการ )</b> </div>"; echo $more_html; } else { echo "<div> <b>อื่นๆ ( ".$Num_Rows_count." รายการ )</b></div>"; } echo "</div>"; $i = ($Page-1) * $Per_Page; while ($row_Other = mysql_fetch_assoc($Result_Other)) { $i++; $c_by_name = $row_Other['name']; $c_by_name = replace_redfont($c_by_name,$skeyword,$name_1,$name_2,$name_3,$name_4); echo "<div>$i. <a href='".$_web_path."/detail.php?id=".$row_Other['id']."'".$chk_tar." class=\"styles2\">" .$c_by_name."</a>"; if(substr($row_Other['d_date'] , 0, 4)!='0000'){ echo " <font color='#999999'>(".substr($row_Other['d_date'],8,2)."/".substr($row_Other['d_date'],5,2)."/".substr($row_Other['d_date'],0,4). ")</font> " ; }else echo " "; } } unset($Result_Other); ?> <p align="center"> <? if($chk_found==0) { $msg_notfound = "... ขออภัย ไม่พบ ".stripslashes($se_var)." ในฐานข้อมูล ..."; echo "<font color=\"red\"><b>".$msg_notfound."</b></font>"; } ?> </p> </div> </div> <? } ?>
©
2018.