$longUrl, 'key' => $apiKey); $jsonData = json_encode($postData); $curlObj = curl_init(); curl_setopt($curlObj, CURLOPT_URL, 'https://www.googleapis.com/urlshortener/v1/url?key='.$apiKey); curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curlObj, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curlObj, CURLOPT_HEADER, 0); curl_setopt($curlObj, CURLOPT_HTTPHEADER, array('Content-type:application/json')); curl_setopt($curlObj, CURLOPT_POST, 1); curl_setopt($curlObj, CURLOPT_POSTFIELDS, $jsonData); $response = curl_exec($curlObj); $json = json_decode($response); curl_close($curlObj); //echo 'Shortened URL ->'.$json->id; return $json->id; } function member_com($sid){ $qs ="SELECT *,(SELECT product_name from product WHERE product_id = cus_cart_detail.product_id) as product_name FROM `cus_cart_detail` WHERE `sid` LIKE '$sid' "; $qrs =mysql_query($qs); while($rs =mysql_fetch_array($qrs)){ $product = db_quick("SELECT product_point1 FROM product WHERE product_id = '$rs[product_id]' "); $price = $rs[product_num] * $product[product_point1]; $res .= "$rs[product_name] $rs[price] x $rs[product_num] = $price
"; $total = $total + $price; } $res .= "Total : $total "; return $total; } function spon_com($sid){ $qs ="SELECT *,(SELECT product_name from product WHERE product_id = cus_cart_detail.product_id) as product_name FROM `cus_cart_detail` WHERE `sid` LIKE '$sid' "; $qrs =mysql_query($qs); while($rs =mysql_fetch_array($qrs)){ $product = db_quick("SELECT product_point2 FROM product WHERE product_id = '$rs[product_id]' "); $price = $rs[product_num] * $product[product_point2]; $res .= "$rs[product_name] $rs[price] x $rs[product_num] = $price
"; $total = $total + $price; } $res .= "Total : $total "; return $total; } function set_com_aff($sid,$order_id){ $qs ="SELECT * FROM `cus_cart_detail` WHERE `sid` LIKE '$sid' "; $qrs =mysql_query($qs); while($rs =mysql_fetch_array($qrs)){ $cus_arr = db_quick("SELECT `aff_id`,`cus_id` FROM `cus_order` WHERE `order_sid` = '$sid' "); $cus_id = $cus_arr[cus_id]; $aff_id = $cus_arr[aff_id]; $spon = db_quick("SELECT `sponsor_id` FROM `af_member` WHERE `id` = '$aff_id' "); $spon_id = $spon[sponsor_id]; $date_comm = date("Y-m"); $today =date("Y-m-d"); $comm =member_com($sid); $comm_spon =spon_com($sid); if($aff_id){ $num_comm_month_m = db_num("SELECT * FROM `commission_pay` WHERE `member_id` = '$aff_id' AND `date` LIKE '%$date_comm%' AND `status` = 'ยังไม่จ่าย' "); if($num_comm_month_m == 0){ $qm = "INSERT INTO `commission_pay` (`id`,`order_id`, `member_id`, `date`, `comm`, `comm_spon`, `status`) VALUES (NULL, '$order_id', '$aff_id', '$today', '$comm', '', 'ยังไม่จ่าย');"; }else{ $qm ="UPDATE `commission_pay` SET `date`='$today',`comm`=`comm`+$comm WHERE `member_id` = '$aff_id' AND `date` LIKE '%$date_comm%' AND `status` = 'ยังไม่จ่าย';"; } if(db_query($qm)){ }else{ } } if($spon_id){ $num_comm_month_s = db_num("SELECT * FROM `commission_pay` WHERE `member_id` = '$spon_id' AND `date` LIKE '%$date_comm%' "); if($num_comm_month_s == 0){ $qs = "INSERT INTO `commission_pay` (`id`,`order_id`, `member_id`, `date`, `comm`, `comm_spon`, `status`) VALUES (NULL, '$order_id', '$spon_id', '$today', '', '$comm_spon', 'ยังไม่จ่าย');"; }else{ $qs ="UPDATE `commission_pay` SET `date`='$today',`comm_spon`=`comm_spon`+$comm_spon WHERE `member_id` = '$spon_id' AND `date` LIKE '%$date_comm%' ;"; } if(db_query($qs)){ }else{ } } $num_permission_com = ""; $num_comm_month_m = ""; $num_permission_spon_com = ""; $num_comm_month_s = ""; $pro_id = ""; } } function set_com_aff_detail($sid,$order_id){ $qs ="SELECT * FROM `cus_cart_detail` WHERE `sid` LIKE '$sid' "; $qrs =mysql_query($qs); while($rs =mysql_fetch_array($qrs)){ $cus_arr = db_quick("SELECT `aff_id`,`cus_id` FROM `cus_order` WHERE `order_sid` = '$sid' "); $cus_id = $cus_arr[cus_id]; $aff_id = $cus_arr[aff_id]; $spon = db_quick("SELECT `sponsor_id` FROM `af_member` WHERE `id` = '$aff_id' "); $spon_id = $spon[sponsor_id]; $date_comm = date("Y-m"); $today =date("Y-m-d"); $comm =member_com($sid); $comm_spon =spon_com($sid); if($aff_id){ $qm = "INSERT INTO `commission_detail` (`id`,`order_id`, `member_id`, `date`, `comm`, `comm_spon`, `status`) VALUES (NULL, '$order_id', '$aff_id', '$today', '$comm', '', 'ยังไม่จ่าย');"; if(db_query($qm)){ }else{ } } if($spon_id){ $qs = "INSERT INTO `commission_detail` (`id`,`order_id`, `member_id`, `date`, `comm`, `comm_spon`, `status`) VALUES (NULL, '$order_id', '$spon_id', '$today', '', '$comm_spon', 'ยังไม่จ่าย');"; if(db_query($qs)){ }else{ } } $num_permission_com = ""; $num_comm_month_m = ""; $num_permission_spon_com = ""; $num_comm_month_s = ""; $pro_id = ""; } } function get_comm_by_member_id($member_id,$date){ $member_com = db_quick("SELECT * FROM `commission_pay` WHERE member_id = '$member_id' AND `date` LIKE '$date%' "); $sum_comm = $member_com[comm]+$member_com[comm_spon]; return "$sum_comm"; } function get_bank_id_by_member_id($member_id){ $member_bank = db_quick("SELECT * FROM `af_member_bank` WHERE member_id = '$member_id' "); $bank_id_for_member = $member_bank[bank_id]; return "$bank_id_for_member"; } function get_account_name_by_member_id($member_id){ $member_bank = db_quick("SELECT * FROM `af_member_bank` WHERE member_id = '$member_id' "); $bank_id_for_member = $member_bank[account_name]; return "$bank_id_for_member"; } function get_bank_name_by_member_id($member_id){ $member_bank = db_quick("SELECT * FROM `af_member_bank` WHERE member_id = '$member_id' "); $bank_id_for_member = $member_bank[bank_name]; return "$bank_id_for_member"; } function get_brand_name($brand_id){ $brand = db_quick("SELECT name FROM `brand` WHERE brand_id = '$brand_id' "); $brand_name = $brand[name]; return "$brand_name"; } function order_status($q){ switch($q){ case "": $q_word = ""; break; case "1": $q_word = "ยืนยันการสั่งซื้อ-รอชำระเงิน"; break; case "2": $q_word = "แจ้งชำระเงิน"; break; case "3": $q_word = "ยืนยันการชำระ-รอจัดส่ง"; break; case "4": $q_word = "กำลังจัดส่ง"; break; case "5": $q_word = "จัดส่งสินค้าแล้ว"; break; case "6": $q_word = "ยกเลิกการสั่งซื้อ"; break; } return " ($q_word) "; } function aff_class($aff_id){ $c = db_quick("SELECT `class_level` FROM `af_member` WHERE `id` ='$aff_id'"); return $c['class_level']; } function q_val($field,$table,$field2,$id){ $q = db_quick("SELECT $field FROM $table WHERE $field2 = '$id' "); return $q[$field]; } function searchtext($target,$search) { if(strstr($target,$search)) { return true; }else { return false; } } function content_detail($id){ $content = db_quick("SELECT content_name,content_des FROM content WHERE content_id = '$id' "); $content['name'] = $content[content_name]; $content['des'] = htmlspecialchars_decode($content[content_des]); return $content; } function content_pic($bis_id,$module,$id,$size){ $content_pic = db_quick("SELECT filename,des,store FROM picture WHERE module = '$module' AND module_id = '$id' ORDER BY `picture`.`store` DESC LIMIT 1 "); if($content_pic[filename]){ $pic = " "; }else{ $pic = " Picture"; } return $pic; } function content_pic_admin($bis_id,$module,$id,$size){ $content_pic = db_quick("SELECT filename,des,store FROM picture WHERE module = '$module' AND module_id = '$id' ORDER BY `picture`.`store` DESC LIMIT 1 "); if($content_pic[filename]){ $pic = " "; }else{ $pic = " Picture"; } return $pic; } function getUserIpAddr() { if (!empty($_SERVER['HTTP_CLIENT_IP'])) //if from shared { return $_SERVER['HTTP_CLIENT_IP']; } else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) //if from a proxy { return $_SERVER['HTTP_X_FORWARDED_FOR']; } else { return $_SERVER['REMOTE_ADDR']; } } $referer = $_SERVER["HTTP_REFERER"]; $user_agent = $_SERVER['HTTP_USER_AGENT']; $ip = getUserIpAddr(); function change_date_format($dt){ $dt = explode(" ",$dt); $d = $dt[0]; $d = explode("-",$dt[0]); $date = "$d[2]/$d[1]/$d[0]"; $time = $dt[1]; return "$date $time"; } function get_product_name($id){ $name = db_quick("SELECT product_name,product_code FROM product WHERE product_id = '$id' "); return "$name[product_code] "; } function get_sales_name($id){ $name = db_quick("SELECT name FROM user WHERE user_id = '$id' "); if($name[name] == ""){ $name = db_quick("SELECT name as first_name FROM user WHERE user_id = '$id' "); } return "$name[name] ($id)"; } function get_cus_name($id){ $name = db_quick("SELECT first_name,family_name FROM my_member_profile WHERE member_id = '$id' "); return "$name[first_name] ($id)"; } function get_aff_name($id){ $name = db_quick("SELECT CONCAT_WS(' ',first_name,' ',family_name) as name FROM af_member_profile WHERE member_id = '$id' "); return "$name[name] ($id)"; } function get_aff_address($id){ $q = db_quick("SELECT mobile FROM `af_member_address` WHERE member_id = '$id'"); return "$q[mobile]"; } function get_aff_line($id){ $q = db_quick("SELECT line FROM `af_member_address` WHERE member_id = '$id'"); return "$q[line]"; } function get_sales_name_by_sub_domain($sub_domain){ $aff_id = db_quick("SELECT member_id FROM member_web WHERE sub_domain = '$sub_domain' "); $aff_id = $aff_id[member_id]; $aff_name = db_quick("SELECT first_name FROM user_profile WHERE user_id = '$aff_id[member_id]' "); if($aff_name[first_name] == ""){ $aff_name = db_quick("SELECT name as first_name FROM user WHERE user_id = '$aff_id' "); } return "$aff_name[first_name] ($aff_id)"; } function get_sales_id_by_sub_domain($sub_domain){ $aff_id = db_quick("SELECT member_id FROM member_web WHERE sub_domain = '$sub_domain' "); $aff_id = $aff_id[member_id]; $aff_name = db_quick("SELECT first_name FROM user_profile WHERE user_id = '$aff_id[member_id]' "); if($aff_name[first_name] == ""){ $aff_name = db_quick("SELECT name as first_name FROM user WHERE user_id = '$aff_id' "); } return "$aff_id"; } function get_aff_name_by_sub_domain($sub_domain){ $aff_id = db_quick("SELECT member_id FROM af_web WHERE sub_domain = '$sub_domain' "); $aff_id = $aff_id[member_id]; $aff_name = db_quick("SELECT first_name FROM af_member_profile WHERE member_id = '$aff_id[member_id]' "); return "$aff_name[first_name] ($aff_id)"; } function cus_name($id){ $name = db_quick("SELECT first_name,family_name FROM cus_profile WHERE cus_id = '$id' "); $address = db_quick("SELECT mobile FROM cus_address WHERE cus_id = '$id' "); return "$name[first_name] $name[family_name] T.$address[mobile] ($id)"; } function aff_name($id){ $name = db_quick("SELECT first_name FROM af_member_profile WHERE member_id = '$id' "); return "$name[first_name] ($id)"; } function get_member_name($id){ $name = db_quick("SELECT first_name FROM my_member_profile WHERE member_id = '$id' "); return "$name[first_name] ($id)"; } function logistic_name($id){ $name = db_quick("select logistic_name from logistic WHERE logistic_id = '$id' "); return $name[logistic_name]; } //แปลงค่า id เป็น ชื่อ จ. อ. ต. function get_province_name($val){ $q = db_quick("SELECT PROVINCE_NAME FROM `province` WHERE `PROVINCE_ID` = '$val' "); return $q[PROVINCE_NAME]; } function get_amphur_name($val){ $q = db_quick("SELECT AMPHUR_NAME FROM `amphur` WHERE `AMPHUR_ID` = '$val' "); return $q[AMPHUR_NAME]; } function get_district_name($val){ $q = db_quick("SELECT DISTRICT_NAME FROM `district` WHERE `DISTRICT_ID` = '$val' "); return $q[DISTRICT_NAME]; } function grand_total($order_id){ global $sub_domain,$domain_name,$memo; $order_des = db_quick("SELECT * FROM `cus_order` WHERE `order_id` = '$order_id' "); $qs_cart ="SELECT * FROM `cus_cart_detail` WHERE `sid` LIKE '$order_des[order_sid]' AND `status` NOT LIKE '' "; $qrs_cart =mysql_query($qs_cart); while($rs_cart = mysql_fetch_array($qrs_cart)){ $price = $rs_cart[price]; $total = $rs_cart[product_num]*$price; $grand = $grand + $total; $trans = $trans+($rs_cart[logistic_price]*$rs_cart[product_num]); $n_price = number_format($price); $n_total = number_format($total); } $logistic_price = $order_des[order_logistic_price]; $grand_total = $grand + $trans - $dc; return $grand_total; } function grand_total2($order_id){ $order_des = db_quick("SELECT * FROM `order` WHERE `order_id` = '$order_id' "); $cus_id = $order_des[member_id]; $session_id = $order_des[order_sid]; $order_status = $order_des[order_status]; if($cus_id){ $order_by_sid = db_quick("SELECT * FROM `order` WHERE `member_id` = '$cus_id' AND `member_id` NOT LIKE '' AND `order_sid` LIKE '$session_id' LIMIT 1 "); $logistic = db_quick("SELECT * FROM `logistic` WHERE `logistic_id` = '$order_by_sid[order_logistic]' "); $coupons = db_quick("SELECT * FROM `coupons` WHERE `coupons_id` = '$order_by_sid[order_coupons]' "); } $qs_cart ="SELECT * FROM `cart_detail` WHERE `sid` LIKE '$session_id' AND `status` LIKE '1' "; $qrs_cart =mysql_query($qs_cart); while($rs_cart = mysql_fetch_array($qrs_cart)){ $q_product = db_quick("SELECT * FROM `product` WHERE `product_id` = '$rs_cart[product_id]' "); $product_pic = db_quick("SELECT filename,des,store,freedom_id FROM picture WHERE module = 'product' AND module_id = '$rs_cart[product_id]' ORDER BY `picture`.`store` DESC "); if(($q_product[product_price_dc] == 0) or ($q_product[product_price_dc] == "")){ $price = $q_product[product_price]; }else{ $price = $q_product[product_price_dc]; } $total = $rs_cart[product_num]*$price; $grand = $grand + $total; } return $grand_total = $grand; } function grand_total_and_dc_no_logistic($order_id){ $order_des = db_quick("SELECT * FROM `order` WHERE `order_id` = '$order_id' "); $cus_id = $order_des[member_id]; $session_id = $order_des[order_sid]; $order_status = $order_des[order_status]; if($cus_id){ $order_by_sid = db_quick("SELECT * FROM `order` WHERE `member_id` = '$cus_id' AND `member_id` NOT LIKE '' AND `order_sid` LIKE '$session_id' LIMIT 1 "); $logistic = db_quick("SELECT * FROM `logistic` WHERE `logistic_id` = '$order_by_sid[order_logistic]' "); $coupons = db_quick("SELECT * FROM `coupons` WHERE `coupons_id` = '$order_by_sid[order_coupons]' "); } $qs_cart ="SELECT * FROM `cart_detail` WHERE `sid` LIKE '$session_id' AND `status` LIKE '1' "; $qrs_cart =mysql_query($qs_cart); while($rs_cart = mysql_fetch_array($qrs_cart)){ $q_product = db_quick("SELECT * FROM `product` WHERE `product_id` = '$rs_cart[product_id]' "); $product_pic = db_quick("SELECT filename,des,store,freedom_id FROM picture WHERE module = 'product' AND module_id = '$rs_cart[product_id]' ORDER BY `picture`.`store` DESC "); if(($q_product[product_price_dc] == 0) or ($q_product[product_price_dc] == "")){ $price = $q_product[product_price]; }else{ $price = $q_product[product_price_dc]; } $total = $rs_cart[product_num]*$price; $grand = $grand + $total; } $logistic_price = $order_des[order_logistic_price]; switch($coupons[coupons_type]){ case "dc_logistic": $logistic_price = 0; $coupons_des = " $coupons[coupons_name] ฟรีค่าจัดส่ง"; break; case "dc_percent": $dc = ($coupons[coupons_command]*$grand)/100; $coupons_des = " $coupons[coupons_name] ลด $coupons[coupons_command] % จากราคาสินค้า"; break; case "dc_price": $dc = $coupons[coupons_command]; $coupons_des = " $coupons[coupons_name] ลด $coupons[coupons_command] จากราคาสินค้า"; break; } return $grand_total = $grand - $dc; } // แปลงค่าตัวแปร เป็น ค่า function trans_to_val($val){ global $cus_id,$cus_name,$cus_mobile,$cus_password,$aff_id,$aff_name,$aff_mobile,$total_price,$order_id,$order_table,$url,$domain_name,$sub_domain; $url = "$sub_domain.$domain_name"; if($order_id){ // ถ้ามี Order ID ให้ get amt $amt = grand_total($order_id); } if($cus_id != ""){ $val = str_replace("{cus_id}",$cus_id,$val); } if($cus_name != ""){ $val = str_replace("{cus_name}",$cus_name,$val); } if($cus_email != ""){ $val = str_replace("{cus_email}",$cus_email,$val); } if($cus_mobile != ""){ $val = str_replace("{cus_mobile}",$cus_mobile,$val); } if($cus_password != ""){ $val = str_replace("{customer_password}",$cus_password,$val); } if($aff_name != ""){ $val = str_replace("{aff_name}",$aff_name,$val); } if($aff_email != ""){ $val = str_replace("{aff_email}",$aff_email,$val); } if($aff_mobile != ""){ $val = str_replace("{aff_mobile}",$aff_mobile,$val); } if($total_price != ""){ $val = str_replace("{total_price}",$total_price,$val); } if($order_id != ""){ $val = str_replace("{order_id}",$order_id,$val); } if($order_table != ""){ $val = str_replace("{order_table}",$order_table,$val); } if($url != ""){ $val = str_replace("{url}",$url,$val); } if($domain_name != ""){ $val = str_replace("{domain_name}",$domain_name,$val); } if($sub_domain != ""){ $val = str_replace("{sub_domain}",$sub_domain,$val); } if($amt != ""){ $val = str_replace("{amt}",$amt,$val); } return $val; } function freedom_sms($s_number,$r_number,$msg){ $s_number = mobile_num($s_number); $r_number = mobile_num($r_number); $smsurl = "http://www.thaiwebsms.com/vip/api_rics.php"; $ch = curl_init(); // initialize curl handle curl_setopt($ch, CURLOPT_URL,$smsurl); // set url to post to curl_setopt($ch, CURLOPT_FAILONERROR, 1); // curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable curl_setopt($ch, CURLOPT_TIMEOUT, 3); // times out after 4s curl_setopt($ch, CURLOPT_POST, 1); // set POST method curl_setopt($ch, CURLOPT_POSTFIELDS, "username=richinter&password=iloverich&secret=hy9213g8&sender=$s_number&dest=$r_number&msg=$msg"); // add POST fields // $result = curl_exec($ch); // run the whole process curl_close($ch); return $result; } // สำหรับคำนวนวันหมดอายุ function dateEstimate($date) { // format 2012-12-30 $newdate = explode("-",$date); $theMonth = $newdate[1]; $theDay = $newdate[2]; $theYear = $newdate[0]; return mktime(0,0,0,$theMonth,$theDay,$theYear); } function add_to_date($givendate,$day=0,$mth=0,$yr=0) { // สุดยอดฟังก์ชั่น บวกเวลา $cd = strtotime($givendate); $newdate = date('Y-m-d', mktime(date('h',$cd), date('i',$cd), date('s',$cd), date('m',$cd)+$mth, date('d',$cd)+$day, date('Y',$cd)+$yr)); return $newdate; } function trans_to_day($date){ //$d1=dateEStime($dd[2], $dd[1], $dd[0]); //1 มกราคม คศ.2000 (ต้องเป็น คศ เท่านั้น) $dexp=dateEstimate($date); //2 มกราคม คศ.2000 $now_date = date("Y-m-d"); $dnow=dateEstimate($now_date); //2 มกราคม คศ.2000 $offset=$dexp-$dnow; return $days=floor($offset/60/60/24); //แปลงเป็นจำนวนวัน } function permis_module() {} function getIpAddress() { return (empty($_SERVER['HTTP_CLIENT_IP'])?(empty($_SERVER['HTTP_X_FORWARDED_FOR'])? $_SERVER['REMOTE_ADDR']:$_SERVER['HTTP_X_FORWARDED_FOR']):$_SERVER['HTTP_CLIENT_IP']); } function mobile_num($number){ $number = trim($number); $number = str_replace("-","",$number); $number = str_replace(" ","",$number); if(strlen($number) >= 10){ return $number; }else{ return false; } } function aletbox($result,$message,$reflashtime,$repage){ $reflashtime = $reflashtime*200; echo "
$message
"; } /* @ การใช้งาน : mymsgbox($พูด,$เวลา,$ไปที่ไหนต่อ) @ ตัวอย่าง : mymsgbox("Add OK","2","module.php?module=user"); @ เพื่อ : แสดงผลเมื่อ Action @ เพิ่มโดย : Skylab 28/03/2550 */ function mymsgbox($talk,$reflashtime,$repage) { echo "
$talk
"; exit(); } function msgbox($result,$message,$reflashtime,$repage) { echo ""; switch($result){ case "success": $box_title = "Success!"; $box_class = "nSuccess"; break; case "warning": $box_title = "Warning!"; $box_class = "nWarning"; break; case "error": $box_title = "Error!"; $box_class = "nFailure"; break; } echo "
$box_title

$message

"; echo ""; exit(); } function msg_box2($box_title,$message,$reflashtime,$repage) { echo "

$box_title

$message.

"; exit(); } function msg_box($box_title,$message,$reflashtime,$repage) { echo "

$box_title

$message.

"; exit(); } function message_box($result,$message,$reflashtime,$repage) { switch($result){ case "success": $box_title = "Success!"; $box_class = "success"; break; case "warning": $box_title = "Warning!"; $box_class = "warning closeable"; break; case "error": $box_title = "Error!"; $box_class = "error closeable"; break; } echo "

$box_title

$message.

"; exit(); } function message_web($box_title,$message,$reflashtime,$repage) { echo "


$box_title


$message.

"; exit(); } function message_pay($box_title,$message,$reflashtime,$repage) { echo "

$box_title

$message.

"; exit(); } function alertbox($talk,$reflashtime,$repage) { ?>
"; exit(); } function myok($message,$link){ echo "onclick=\"if (confirm('$message')) location.href='$link' \""; } function check_page(){ global $page; echo "$page"; } function foldersize( $path ) { $size = 0; if( $dir = @opendir( $path )) { while(($file = readdir($dir)) !== false ) { if( is_dir( "$path/$file" ) && $file != '.' && $file != '..' ) { $size += foldersize( "$path/$file" ); } if( is_file( "$path/$file" )) { $size += filesize( "$path/$file" ); } } closedir($dir); } return $size; } function for_active_member ($member_status,$content_id){ // echo "$member_status - $content_id"; if(($member_status == "")or($member_status == "0")){ $page_content = db_quick("SELECT page_title,page_detail FROM page WHERE page_id = '$content_id' "); alertbox("$page_content[page_detail]","30","module.php?module=welcome"); } } // เอาไว้สำหรั บบวก ลบ เวลา function dateEStime($theDay,$theMonth,$theYear) { return mktime(0,0,0,$theMonth,$theDay,$theYear); } function trans_date($dd, $mm, $yy){ //$d1=dateEStime($dd[2], $dd[1], $dd[0]); //1 มกราคม คศ.2000 (ต้องเป็น คศ เท่านั้น) $dexp=dateEStime($dd, $mm, $yy); //2 มกราคม คศ.2000 $dnow = date("d-m-Y"); $d_now = explode("-",$dnow); $dnow=dateEStime($d_now[0], $d_now[1], $d_now[2]); //2 มกราคม คศ.2000 $offset=$dexp-$dnow; return $days=floor($offset/60/60/24); //แปลงเป็นจำนวนวัน } function add_date($givendate,$day=0,$mth=0,$yr=0) { // สุดยอดฟังก์ชั่น บวกเวลา $cd = strtotime($givendate); $newdate = date('Y-m-d', mktime(date('h',$cd), date('i',$cd), date('s',$cd), date('m',$cd)+$mth, date('d',$cd)+$day, date('Y',$cd)+$yr)); return $newdate; } //สำหรับ + เดือนหมดอายุ /* $n=1; // จำนวนเดือน $y=2011; $m=03; $d=30; $t="+"; // + คือบวกเดือน - คือลบเดือน แต่พบว่าลบเดือน มีนา ลงมา กพ. จำนวนวันจะผิด แต่ + ใช้งานได้ดี echo $rr=NewMonthDate($n,$y,$m,$d,$t); */ function NewMonthDate($n,$y,$m,$d,$t) { for($i=1; $i <= $n; $i++) { if($t=="+") { $pmonth=$m+$i; } if($t=="-") { $pmonth=$m-$i; } $pyear=$y; $aa=1; /////////////////this will show lastmonth////////////// $lastmonth = mktime(0, 0, 0, $pmonth, $aa, $pyear); $smonth=date("m",$lastmonth); $syear=date("Y",$lastmonth); $ndays=date("t",$lastmonth); $valarray=array($smonth,$syear,$ndays); $mm=$mm+$ndays; } $basedate="$pyear-$m-$d"; $date2 = strtotime("$basedate $t$mm days"); $date1=date("Y-m-d",$date2); return $date1; } if (preg_match("/function_component.php/i", $_SERVER['PHP_SELF'])) { Header("Location: ../index.php"); die(); } function permission($menu_id,$opt,$var_user_id){ if($var_user_id == 1){ $per_num =1; }else{ $per_num = db_num("SELECT * FROM `user_permission` WHERE `user_id` = '$var_user_id' AND `permission` LIKE '%#$menu_id#%'"); } //echo $menu_id; if($per_num){ switch($opt){ case "select": echo "checked=\"checked\""; break; case "": return 1; break; } }else{ switch($opt){ case "select": echo ""; break; case "": return 0; break; } } } function page_navigator($before_p,$plus_p,$total,$total_p,$chk_page,$morelink){ global $urlquery_str,$module,$pg; $pPrev=$chk_page-1; $pPrev=($pPrev>=0)?$pPrev:0; $pNext=$chk_page+1; $pNext=($pNext>=$total_p)?$total_p-1:$pNext; $lt_page=$total_p-4; echo "
    "; // เติมเพิ่มเพื่อให้เป็น ul li /*
  • 1
  • 2
  • 3
  • 4
  • ...
  • 20
  • */ if($chk_page>0){ echo "
  • "; } if($total_p>=11){ if($chk_page>=4){ echo "
  • 1. . .
  • "; } if($chk_page<4){ for($i=0;$i<$total_p;$i++){ $nClass=($chk_page==$i)?"class='active'":""; if($i<=4){ echo "
  • ".intval($i+1)."
  • "; } if($i==$total_p-1 ){ echo "
  • . . .".intval($i+1)."
  • "; } } } if($chk_page>=4 && $chk_page<$lt_page){ $st_page=$chk_page-3; for($i=1;$i<=5;$i++){ $nClass=($chk_page==($st_page+$i))?"class='active'":""; echo "
  • ".intval($st_page+$i+1)."
  • "; } for($i=0;$i<$total_p;$i++){ if($i==$total_p-1 ){ $nClass=($chk_page==$i)?"class='active'":""; echo "
  • . . .".intval($i+1)."
  • "; } } } if($chk_page>=$lt_page){ for($i=0;$i<=4;$i++){ $nClass=($chk_page==($lt_page+$i-1))?"class='active'":""; echo "
  • ".intval($lt_page+$i)."
  • "; } } }else{ for($i=0;$i<$total_p;$i++){ $nClass=($chk_page==$i)?"class='active'":""; echo "
  • ".intval($i+1)."
  • "; } } if($chk_page<$total_p-1){ echo "
  • "; } echo "
"; // เติมเพิ่มเพื่อให้เป็น ul li } function page_navi($before_p,$plus_p,$total,$total_p,$chk_page,$morelink){ global $module,$pg,$id,$cur,$ope; $link = "index.php?cur=$cur&ope=$ope&module=$module&pg=$pg&p="; $pPrev=$chk_page-1; $pPrev=($pPrev>=0)?$pPrev:0; $pNext=$chk_page+1; $pNext=($pNext>=$total_p)?$total_p-1:$pNext; $lt_page=$total_p-4; if($chk_page>0){ echo "«"; } if($total_p>=11){ if($chk_page>=4){ echo "1. . ."; } if($chk_page<4){ for($i=0;$i<$total_p;$i++){ $nClass=($chk_page==$i)?"class='selectPage'":""; if($i<=4){ echo "".intval($i+1)." "; } if($i==$total_p-1 ){ echo ". . .".intval($i+1)." "; } } } if($chk_page>=4 && $chk_page<$lt_page){ $st_page=$chk_page-3; for($i=1;$i<=5;$i++){ $nClass=($chk_page==($st_page+$i))?"class='selectPage'":""; echo "".intval($st_page+$i+1)." "; } for($i=0;$i<$total_p;$i++){ if($i==$total_p-1 ){ $nClass=($chk_page==$i)?"class='selectPage'":""; echo ". . .".intval($i+1)." "; } } } if($chk_page>=$lt_page){ for($i=0;$i<=4;$i++){ $nClass=($chk_page==($lt_page+$i-1))?"class='selectPage'":""; echo "".intval($lt_page+$i)." "; } } }else{ for($i=0;$i<$total_p;$i++){ $nClass=($chk_page==$i)?"class='selectPage'":""; echo "".intval($i+1)." "; } } if($chk_page<$total_p-1){ echo "»"; } } function convert($number){ $txtnum1 = array('ศูนย์','หนึ่ง','สอง','สาม','สี่','ห้า','หก','เจ็ด','แปด','เก้า','สิบ'); $txtnum2 = array('','สิบ','ร้อย','พัน','หมื่น','แสน','ล้าน'); $number = str_replace(",","",$number); $number = str_replace(" ","",$number); $number = str_replace("บาท","",$number); $number = explode(".",$number); if(sizeof($number)>2){ return 'ทศนิยมหลายตัวนะจ๊ะ'; exit; } $strlen = strlen($number[0]); $convert = ''; for($i=0;$i<$strlen;$i++){ $n = substr($number[0], $i,1); if($n!=0){ if($i==($strlen-1) AND $n==1){ $convert .= 'เอ็ด'; } elseif($i==($strlen-2) AND $n==2){ $convert .= 'ยี่'; } elseif($i==($strlen-2) AND $n==1){ $convert .= ''; } else{ $convert .= $txtnum1[$n]; } $convert .= $txtnum2[$strlen-$i-1]; } } $convert .= 'บาท'; if($number[1]=='0' OR $number[1]=='00' OR $number[1]==''){ $convert .= 'ถ้วน'; }else{ $strlen = strlen($number[1]); for($i=0;$i<$strlen;$i++){ $n = substr($number[1], $i,1); if($n!=0){ if($i==($strlen-1) AND $n==1){$convert .= 'เอ็ด';} elseif($i==($strlen-2) AND $n==2){$convert .= 'ยี่';} elseif($i==($strlen-2) AND $n==1){$convert .= '';} else{ $convert .= $txtnum1[$n];} $convert .= $txtnum2[$strlen-$i-1]; } } $convert .= 'สตางค์'; } return $convert; } function fb_link_product($caption,$link,$redirect_uri){ global $web_status, $web_fb, $myweb, $member_name, $redirect_to,$my_subdomain,$bis_id,$sub_domain,$domain_name; $myweb = db_quick("SELECT sub_domain,domain_name FROM `af_web` WHERE `member_id` LIKE '$bis_id' ORDER BY `af_web`.`id` ASC LIMIT 1"); $myweb = "http://www.$myweb[domain_name]"; //$myweb .= $domain_name_s; $description = $caption; $description = str_replace("{url}",$myweb,$description); $description = str_replace("#","%23",$description); $description = str_replace(".","%2E",$description); $description = str_replace("-","%2D",$description); $description = str_replace('"',"",$description); $description = str_replace("{name}",$member_name,$description); $picture = str_replace("#","%23",$picture); $picture = str_replace(".","%2E",$picture); $picture = str_replace("-","%2D",$picture); $myurl = $myweb; $link = "$myweb/product-$description-$link.html"; $myurl = "https://www.facebook.com/dialog/feed?app_id=420165251443019&display=popup&caption=$caption&link=$link&redirect_uri=http://$sub_domain.$domain_name/aff/index.php?module=share"; return $myurl; } function line_msg_product($caption,$link){ global $web_status, $web_fb, $myweb, $member_name, $redirect_to,$my_subdomain,$bis_id,$sub_domain,$domain_name; $myweb = db_quick("SELECT sub_domain,domain_name FROM `af_web` WHERE `member_id` LIKE '$bis_id' ORDER BY `af_web`.`id` ASC LIMIT 1"); $myweb = "http://$myweb[sub_domain].$myweb[domain_name]"; //$myweb .= $domain_name_s; $description = $caption; $description = str_replace("{url}",$myweb,$description); $description = str_replace("#","%23",$description); $description = str_replace(".","%2E",$description); $description = str_replace("-","%2D",$description); $description = str_replace(" ","_",$description); $description = str_replace('"',"",$description); $description = str_replace("{name}",$member_name,$description); $picture = str_replace("#","%23",$picture); $picture = str_replace(".","%2E",$picture); $picture = str_replace("-","%2D",$picture); $myurl = $myweb; // $link = "$myweb/product-$description-$link.html"; $link = "$myweb/product-product$link-$link.html"; $myurl = "$caption $link"; return $myurl; } function line_msg_article($caption,$link){ global $web_status, $web_fb, $myweb, $member_name, $redirect_to,$my_subdomain,$bis_id,$sub_domain,$domain_name; $myweb = db_quick("SELECT sub_domain,domain_name FROM `af_web` WHERE `member_id` LIKE '$bis_id' ORDER BY `af_web`.`id` ASC LIMIT 1"); $myweb = "http://$myweb[sub_domain].$myweb[domain_name]"; //$myweb .= $domain_name_s; $description = $caption; $description = str_replace("{url}",$myweb,$description); $description = str_replace("#","%23",$description); $description = str_replace(".","%2E",$description); $description = str_replace("-","%2D",$description); $description = str_replace(" ","_",$description); $description = str_replace('"',"",$description); $description = str_replace("{name}",$member_name,$description); $picture = str_replace("#","%23",$picture); $picture = str_replace(".","%2E",$picture); $picture = str_replace("-","%2D",$picture); $myurl = $myweb; // $link = "$myweb/article_detail-$description-$link.html"; $link = "$myweb/article_detail-article_detail$link-$link.html"; $myurl = "$caption $link"; return $myurl; } function fb_link($caption,$link,$redirect_uri){ global $web_status, $web_fb, $myweb, $member_name, $redirect_to,$my_subdomain,$bis_id,$sub_domain,$domain_name; $myweb = db_quick("SELECT sub_domain,domain_name FROM `af_web` WHERE `member_id` LIKE '$bis_id' ORDER BY `af_web`.`id` ASC LIMIT 1"); $myweb = "http://$myweb[sub_domain].$myweb[domain_name]"; //$myweb .= $domain_name_s; $description = $caption; $description = str_replace("{url}",$myweb,$description); $description = str_replace("#","%23",$description); $description = str_replace(".","%2E",$description); $description = str_replace("-","%2D",$description); $description = str_replace('"',"",$description); $description = str_replace("{name}",$member_name,$description); $picture = str_replace("#","%23",$picture); $picture = str_replace(".","%2E",$picture); $picture = str_replace("-","%2D",$picture); $myurl = $myweb; //$link = "$myweb/product-$description-$link.html"; $myurl = "https://www.facebook.com/dialog/feed?app_id=420165251443019&display=popup&caption=$caption&link=$link&redirect_uri=http://$sub_domain.$domain_name/aff/index.php?module=share"; return $myurl; } function line_msg($caption,$link){ global $web_status, $web_fb, $myweb, $member_name, $redirect_to,$my_subdomain,$bis_id,$sub_domain,$domain_name; $myweb = db_quick("SELECT sub_domain,domain_name FROM `af_web` WHERE `member_id` LIKE '$bis_id' ORDER BY `af_web`.`id` ASC LIMIT 1"); $myweb = "http://$myweb[sub_domain].$myweb[domain_name]"; //$myweb .= $domain_name_s; $description = $caption; $description = str_replace("{url}",$myweb,$description); $description = str_replace("#","%23",$description); $description = str_replace(".","%2E",$description); $description = str_replace("-","%2D",$description); $description = str_replace(" ","_",$description); $description = str_replace('"',"",$description); $description = str_replace("{name}",$member_name,$description); $picture = str_replace("#","%23",$picture); $picture = str_replace(".","%2E",$picture); $picture = str_replace("-","%2D",$picture); $myurl = $myweb; //$link = "$myweb/product-$description-$link.html"; $myurl = "$caption $link"; return $myurl; } function fb_link_special($caption,$link,$redirect_uri){ global $web_status, $web_fb, $myweb, $member_name, $redirect_to,$my_subdomain,$bis_id,$sub_domain,$domain_name; $myweb = db_quick("SELECT sub_domain,domain_name FROM `af_web` WHERE `member_id` LIKE '$bis_id' ORDER BY `af_web`.`id` ASC LIMIT 1"); $myweb = "http://$myweb[sub_domain].$myweb[domain_name]"; //$myweb .= $domain_name_s; $description = $caption; $description = str_replace("{url}",$myweb,$description); $description = str_replace("#","%23",$description); $description = str_replace(".","%2E",$description); $description = str_replace("-","%2D",$description); $description = str_replace('"',"",$description); $description = str_replace("{name}",$member_name,$description); $picture = str_replace("#","%23",$picture); $picture = str_replace(".","%2E",$picture); $picture = str_replace("-","%2D",$picture); $myurl = $myweb; //$link = "$myweb/product-$description-$link.html"; $myurl = "https://www.facebook.com/dialog/feed?app_id=420165251443019&display=popup&caption=$caption&link=$link&redirect_uri=http://$sub_domain.$domain_name/aff/index.php?module=share&pg=special"; return $myurl; } function line_msg_special($caption,$link){ global $web_status, $web_fb, $myweb, $member_name, $redirect_to,$my_subdomain,$bis_id,$sub_domain,$domain_name; $myweb = db_quick("SELECT sub_domain,domain_name FROM `af_web` WHERE `member_id` LIKE '$bis_id' ORDER BY `af_web`.`id` ASC LIMIT 1"); $myweb = "http://$myweb[sub_domain].$myweb[domain_name]"; //$myweb .= $domain_name_s; $description = $caption; $description = str_replace("{url}",$myweb,$description); $description = str_replace("#","%23",$description); $description = str_replace(".","%2E",$description); $description = str_replace("-","%2D",$description); $description = str_replace(" ","_",$description); $description = str_replace('"',"",$description); $description = str_replace("{name}",$member_name,$description); $picture = str_replace("#","%23",$picture); $picture = str_replace(".","%2E",$picture); $picture = str_replace("-","%2D",$picture); $myurl = $myweb; //$link = "$myweb/product-$description-$link.html"; $myurl = "$caption $link"; return $myurl; } class Spintax { public function process($text) { return preg_replace_callback( '/\{(((?>[^\{\}]+)|(?R))*)\}/x', array($this, 'replace'), $text ); } public function replace($text) { $text = $this->process($text[1]); $parts = explode('|', $text); return $parts[array_rand($parts)]; } } function isBot() { $bot_regex = '/BotLink|bingbot|AhrefsBot|ahoy|AlkalineBOT|anthill|appie|arale|araneo|AraybOt|ariadne|arks|ATN_Worldwide|Atomz|bbot|Bjaaland|Ukonline|borg\-bot\/0\.9|boxseabot|bspider|calif|christcrawler|CMC\/0\.01|combine|confuzzledbot|CoolBot|cosmos|Internet Cruiser Robot|cusco|cyberspyder|cydralspider|desertrealm, desert realm|digger|DIIbot|grabber|downloadexpress|DragonBot|dwcp|ecollector|ebiness|elfinbot|esculapio|esther|fastcrawler|FDSE|FELIX IDE|ESI|fido|H�m�h�kki|KIT\-Fireball|fouineur|Freecrawl|gammaSpider|gazz|gcreep|golem|googlebot|griffon|Gromit|gulliver|gulper|hambot|havIndex|hotwired|htdig|iajabot|INGRID\/0\.1|Informant|InfoSpiders|inspectorwww|irobot|Iron33|JBot|jcrawler|Teoma|Jeeves|jobo|image\.kapsi\.net|KDD\-Explorer|ko_yappo_robot|label\-grabber|larbin|legs|Linkidator|linkwalker|Lockon|logo_gif_crawler|marvin|mattie|mediafox|MerzScope|NEC\-MeshExplorer|MindCrawler|udmsearch|moget|Motor|msnbot|muncher|muninn|MuscatFerret|MwdSearch|sharp\-info\-agent|WebMechanic|NetScoop|newscan\-online|ObjectsSearch|Occam|Orbsearch\/1\.0|packrat|pageboy|ParaSite|patric|pegasus|perlcrawler|phpdig|piltdownman|Pimptrain|pjspider|PlumtreeWebAccessor|PortalBSpider|psbot|Getterrobo\-Plus|Raven|RHCS|RixBot|roadrunner|Robbie|robi|RoboCrawl|robofox|Scooter|Search\-AU|searchprocess|Senrigan|Shagseeker|sift|SimBot|Site Valet|skymob|SLCrawler\/2\.0|slurp|ESI|snooper|solbot|speedy|spider_monkey|SpiderBot\/1\.0|spiderline|nil|suke|http:\/\/www\.sygol\.com|tach_bw|TechBOT|templeton|titin|topiclink|UdmSearch|urlck|Valkyrie libwww\-perl|verticrawl|Victoria|void\-bot|Voyager|VWbot_K|crawlpaper|wapspider|WebBandit\/1\.0|webcatcher|T\-H\-U\-N\-D\-E\-R\-S\-T\-O\-N\-E|WebMoose|webquest|webreaper|webs|webspider|WebWalker|wget|winona|whowhere|wlm|WOLP|WWWC|none|XGET|Nederland\.zoek|AISearchBot|woriobot|NetSeer|Nutch|YandexBot|YandexMobileBot|SemrushBot|FatBot|MJ12bot|DotBot|AddThis|baiduspider|SeznamBot|mod_pagespeed|CCBot|openstat.ru\/Bot|m2e/i'; $userAgent = empty($_SERVER['HTTP_USER_AGENT']) ? FALSE : $_SERVER['HTTP_USER_AGENT']; $isBot = !$userAgent || preg_match($bot_regex, $userAgent); return $isBot; } function big_pic($pic_name){ $big_pic_name = str_replace("-pic","",$pic_name); $filename = "seller/files/1/$big_pic_name"; if (file_exists($filename)) { }else{ $big_pic_name = $pic_name; } return $big_pic_name; } function DateDiff($strDate1,$strDate2){ return (strtotime($strDate2) - strtotime($strDate1))/ ( 60 * 60 * 24 ); // 1 day = 60*60*24 } function TimeDiff($strTime1,$strTime2){ return (strtotime($strTime2) - strtotime($strTime1))/ ( 60 * 60 ); // 1 Hour = 60*60 } function DateTimeDiff($strDateTime1,$strDateTime2){ return (strtotime($strDateTime2) - strtotime($strDateTime1))/ ( 60 * 60 ); // 1 Hour = 60*60 } function DateThai($strDate) { $strYear = date("Y",strtotime($strDate))+543; $strMonth= date("n",strtotime($strDate)); $strDay= date("j",strtotime($strDate)); $strHour= date("H",strtotime($strDate)); $strMinute= date("i",strtotime($strDate)); $strSeconds= date("s",strtotime($strDate)); $strMonthCut = Array("","ม.ค.","ก.พ.","มี.ค.","เม.ย.","พ.ค.","มิ.ย.","ก.ค.","ส.ค.","ก.ย.","ต.ค.","พ.ย.","ธ.ค."); $strMonthThai=$strMonthCut[$strMonth]; //return "$strDay $strMonthThai $strYear, $strHour:$strMinute"; return "$strDay $strMonthThai $strYear"; } function DateThai2($strDate) { $strYear = date("Y",strtotime($strDate))+543; $strMonth= date("n",strtotime($strDate)); $strDay= date("j",strtotime($strDate)); $strHour= date("H",strtotime($strDate)); $strMinute= date("i",strtotime($strDate)); $strSeconds= date("s",strtotime($strDate)); $strMonthCut = Array("","ม.ค.","ก.พ.","มี.ค.","เม.ย.","พ.ค.","มิ.ย.","ก.ค.","ส.ค.","ก.ย.","ต.ค.","พ.ย.","ธ.ค."); $strMonthThai=$strMonthCut[$strMonth]; //return "$strDay $strMonthThai $strYear, $strHour:$strMinute"; $dt[d] = "$strDay"; $dt[m] = "$strMonthThai"; $dt[Y] = "$strYear"; return $dt; } function DateThaiEN($strDate) { $strYear = date("Y",strtotime($strDate)); $strMonth= date("n",strtotime($strDate)); $strDay= date("j",strtotime($strDate)); $strHour= date("H",strtotime($strDate)); $strMinute= date("i",strtotime($strDate)); $strSeconds= date("s",strtotime($strDate)); $strMonthCut = Array("","JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"); $strMonthThai=$strMonthCut[$strMonth]; //return "$strDay $strMonthThai $strYear, $strHour:$strMinute"; $dt[d] = "$strDay"; $dt[m] = "$strMonthThai"; $dt[Y] = "$strYear"; return $dt; } function menu_download_name($id) { $qb = db_quick("SELECT menu_download_id, menu_download_name FROM menu_download WHERE menu_download_id = '$id' "); return $qb[menu_download_name]; } // nook function menu_download_name_en($id) { $qb = db_quick("SELECT menu_download_name_en FROM menu_download WHERE menu_download_id = '$id' "); return $qb[menu_download_name_en]; } function page_navi_morelink($before_p,$plus_p,$total,$total_p,$chk_page){ global $module,$pg,$id,$m1,$m2,$link,$morelink; $pPrev=$chk_page-1; $pPrev=($pPrev>=0)?$pPrev:0; $pNext=$chk_page+1; $pNext=($pNext>=$total_p)?$total_p-1:$pNext; $lt_page=$total_p-4; if($chk_page>0){ echo "
  • "; } if($total_p>=11){ if($chk_page>=4){ echo "
  • 1. . .
  • "; } if($chk_page<4){ for($i=0;$i<$total_p;$i++){ $nClass=($chk_page==$i)?"class='btn btn-default active'":""; if($i<=4){ echo "
  • ".intval($i+1)."
  • "; } if($i==$total_p-1 ){ echo "
  • . . .
  • ".intval($i+1)."
  • "; } } // return $chk_page; } if($chk_page>=4 && $chk_page<$lt_page){ $st_page=$chk_page-3; for($i=1;$i<=5;$i++){ $nClass=($chk_page==($st_page+$i))?"class='btn btn-default active'":""; echo "
  • ".intval($st_page+$i+1)."
  • "; } for($i=0;$i<$total_p;$i++){ if($i==$total_p-1 ){ $nClass=($chk_page==$i)?"class='btn btn-default active'":""; echo "
  • . . .
  • ".intval($i+1)."
  • "; } } } if($chk_page>=$lt_page){ for($i=0;$i<=4;$i++){ $nClass=($chk_page==($lt_page+$i-1))?"class='btn btn-default active'":""; echo "
  • ".intval($lt_page+$i)."
  • "; } } }else{ for($i=0;$i<$total_p;$i++){ $nClass=($chk_page==$i)?"class='btn btn-default active'":""; echo "
  • ".intval($i+1)."
  • "; } } if($chk_page<$total_p-1){ echo "
  • "; } // return $chk_page; } function set_lang ($slang){ global $lang; if($lang == '' || $slang != $lang){ $_SESSION["lang"] = $slang; return $slang; } } function func_conv_month($input){ $arr_month = array("","ม.ค.","ก.พ.","มี.ค","เม.ษ.","พ.ค.","มิ.ย","ก.ค.","ส.ค.","ก.ย.","ต.ค.","พ.ย.","ธ.ค."); return $arr_month[$input]; } function func_conv_month_en($input){ $arr_month = array("","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"); return $arr_month[$input]; } ?> "; exit; } ?> "; } if($lang ==""){ $lang = 'th';} // echo "
    "; // echo "$lang"; ?>
    Warning: include(/head.php): failed to open stream: No such file or directory in /var/www/vhosts/roadsafetythai.org/public_html/index.php on line 12

    Warning: include(): Failed opening '/head.php' for inclusion (include_path='.:/usr/share/php') in /var/www/vhosts/roadsafetythai.org/public_html/index.php on line 12

    Warning: include(/themes.php): failed to open stream: No such file or directory in /var/www/vhosts/roadsafetythai.org/public_html/index.php on line 13

    Warning: include(): Failed opening '/themes.php' for inclusion (include_path='.:/usr/share/php') in /var/www/vhosts/roadsafetythai.org/public_html/index.php on line 13

    Warning: include(/js.php): failed to open stream: No such file or directory in /var/www/vhosts/roadsafetythai.org/public_html/index.php on line 14

    Warning: include(): Failed opening '/js.php' for inclusion (include_path='.:/usr/share/php') in /var/www/vhosts/roadsafetythai.org/public_html/index.php on line 14

    Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /var/www/vhosts/roadsafetythai.org/public_html/includes/function_component.php:1597) in /var/www/vhosts/roadsafetythai.org/public_html/includes/config.php on line 5

    Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /var/www/vhosts/roadsafetythai.org/public_html/includes/function_component.php:1597) in /var/www/vhosts/roadsafetythai.org/public_html/includes/config.php on line 5

    Fatal error: Call to undefined function mysql_connect() in /var/www/vhosts/roadsafetythai.org/public_html/includes/config.php on line 56