###################################################################################### ## ## Program : ## Description : ## Programmer : äªÂÃѵ¹ì Êع·ÃÇÔÀÒµ ## Email : webmaster@sixhead.net,sixheadz@hotmail.com ## Website : http://www.sixhead.net ## Date : ## Modify log : ## ###################################################################################### ##################################################################### #### start setup #### $template_search = "_template_Form7_v4.html"; #### end of setup #### ##################################################################### ##################################################################### #### start program #### require "_config.php"; require "_module.php"; ob_start(); global $tp; if (!$keyword) { $tp[record_all] = 0; Template($template_search); exit; } $arrKeyword = preg_split('/ /', $keyword, -1, PREG_SPLIT_NO_EMPTY); $gen_search = ""; foreach ($arrKeyword as $strKeyword) { $gen_search .= "NAME like '%$strKeyword%' OR DESCRIPTION like '%$strKeyword%' OR COMPANY like '%$strKeyword%' OR COMPANY_URL like '%$strKeyword%' OR URL like '%$strKeyword%' OR URL_MIRROR like '%$strKeyword%' OR\n"; } $gen_search = preg_replace("/ OR$/","",$gen_search); # áºè§Ë¹éÒ # if (!$p) { $p = 1; } @$db = mysql_connect($db_host,$db_user,$db_pass); mysql_select_db($config_db_name); if (!$db) { echo "Error connect to Database: " . mysql_error(); ob_end_flush(); exit; } $sql = "SELECT * FROM $config_table_program WHERE ($gen_search)"; $result = mysql_query($sql); $record_all = mysql_num_rows($result); mysql_free_result($result); mysql_close($db); $x1 = $record_all % $config_list_per_page; $x2 = $record_all / $config_list_per_page; if ($x1 > 0) { $all_page = (int)($x2) + 1; } else { $all_page = $x2; } # �ӹdz�� record �������Ш��ͧ����˹�� if ($p == 1) { $start_loop = 0; } else { $p2 = $p - 1; $start_loop = $p2 * $config_list_per_page; } # /�ӹdz�� record �������Ш��ͧ����˹�� # /��˹�� # # �Ţ˹������Ѻ���ԧ�� # $url_keyword = urlencode($keyword); $url_sort = urlencode($sort); for ($i=1;$i<=$all_page;$i++) { $p_temp = $p + 1; $p_temp2 = $p - 1; if ($i == 1) { if ($i == $p) { $page_link .= "[ $i ] "; } else { $page_link .= "<< Prev [ $i ] "; } } elseif ($i == $all_page) { if ($i == $p) { $page_link .= "[ $i ] "; } else { $page_link .= "[ $i ] Next >>"; } } else { if ($i == $p) { $page_link .= "[ $i ] "; } else { $page_link .= "[ $i ] "; } } } # /�Ţ˹������Ѻ���ԧ�� # $DESC = "DESC"; if (!$sort) { $sort = "ID"; } if ($sort == "NAME") { $DESC = ""; } @$db = mysql_connect($db_host,$db_user,$db_pass); mysql_select_db($config_db_name); if (!$db) { echo "Error connect to Database: " . mysql_error(); ob_end_flush(); exit; } $sql = "SELECT * FROM $config_table_program WHERE ($gen_search) ORDER BY $sort $DESC limit $start_loop,$config_list_per_page"; $result = mysql_query($sql); while($row = mysql_fetch_array($result)) { $DESCRIPTION = preg_replace('/\<(.|\s)*?\>/',' ',$row[DESCRIPTION]); $DESCRIPTION = preg_replace('/\<.+/',' ',$DESCRIPTION); $DESCRIPTION = substr($DESCRIPTION,0,100); $NAME = ucfirst($row[NAME]); $SIZE = Gen_File_Size($row[SIZE]); list($DATE_ADD) = split(" ", $row[DATE_ADD]); $DOWNLOAD_THIS_WEEK = Gen_Comify($row[DOWNLOAD_THIS_WEEK]); $DOWNLOAD_ALL = Gen_Comify($row[DOWNLOAD_ALL]); $DOWNLOAD_WEEK = $row[DOWNLOAD_WEEK]; $week_of_year = strftime("%W"); if ($DOWNLOAD_WEEK != $week_of_year) { $DOWNLOAD_THIS_WEEK = 0; } $flag_th = ""; if ($row[NATION] == "TH") { $flag_th = " "; } $tp[DATA] .= "