"; exit; } } public function CheckLoginTrue($userlogin){ if(!empty($userlogin)){ echo ""; exit; } } public function format_date($date){ $d=explode("-",$date); $dd=$d[2]+0; $mm=$this->getMonth($d[1]-1); $yy = $d[0]+543; return "$dd $mm $yy"; } public function format_datecute($date){ $date2=explode(" ",$date); $d=explode("-",$date2[0]); $dd=$d[2]+0; if($_SESSION['language']=="th") $mm=$this->getMonth($d[1]-1); else $mm=$this->getMonthEN($d[1]-1); $yy = $d[0]+543; return "$dd $mm $yy"; } public function format_dateshot($date){ $date2=explode(" ",$date); $d=explode("-",$date2[0]); $dd=$d[2]+0; if($_SESSION['language']=="th") $mm=$this->getMonthShot($d[1]-1); else $mm=$this->getMonthShotEN($d[1]-1); $yy = ($d[0]+543)-2500; return "$dd $mm $yy"; } public function format_dateshot2($date){ $date2=explode(" ",$date); $d=explode("-",$date2[0]); $dd=$d[2]+0; $mm=$this->getMonthShot($d[1]-1); $yy = ($d[0]+543)-2500; return "$dd $mm $yy"; } public function format_date2($date){ $date2=explode(" ",$date); $d=explode("-",$date2[0]); $dd = $d[2]; $mm = $d[1]; $yy = $d[0]+543; return "$dd/$mm/$yy"; } public function format_datetime($date){ $dd = explode(" ",$date); $tt=explode(":",$dd[1]); $d=explode("-",$dd[0]); $dd=$d[2]+0; $mm=$this->getMonth($d[1]-1); $yy = $d[0]+543; return "$dd $mm $yy เวลา $tt[0]:$tt[1] น."; } public function format_datetime2($date){ $dd = explode(" ",$date); $tt=explode(":",$dd[1]); $d=explode("-",$dd[0]); $dd=$d[2]+0; $mm=$this->getMonth($d[1]-1); $yy = $d[0]+543; return "$dd $mm $yy $tt[0]:$tt[1]น."; } public function format_datetimeshot($date){ $dd = explode(" ",$date); $tt=explode(":",$dd[1]); $d=explode("-",$dd[0]); $dd=$d[2]+0; $mm=$this->getMonthShot($d[1]-1); $yy = ($d[0]+543)-2500; return "$dd $mm $yy $tt[0]:$tt[1]"; } public function format_datetime3($date){ $dd = explode(" ",$date); $tt=explode(":",$dd[1]); $d=explode("-",$dd[0]); $dd=$d[2]; $mm=$d[1]; $yy = $d[0]; return "$dd/$mm/$yy $tt[0]:$tt[1]"; } public function format_datetime4($date){ $dd = explode(" ",$date); $d=explode("-",$dd[0]); $dd=$d[2]+0; $mm=$d[1]+0; $yy = $d[0]; return $dd.".".$mm.".".$yy; } public function getMonth($set){ $monthfull = array("มกราคม", "กุมภาพันธ์","มีนาคม","เมษายน","พฤษาภาคม","มิถุนายน","กรกฏาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม"); return $monthfull[$set]; } public function getMonthShot($set){ $monthfull = array("ม.ค.", "ก.พ.","มี.ค.","เม.ย.","พ.ค.","มิ.ย.","ก.ค.","ส.ค.","ก.ย.","ต.ค.","พ.ย.","ธ.ค."); return $monthfull[$set]; } public function getMonthEN($set){ $monthfull = array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ); return $monthfull[$set]; } public function getMonthShotEN($set){ $monthfull = array('Jan','Feb','March','April','may','June','July','Aug','Sep','Oct','Nov','Dec'); return $monthfull[$set]; } public function getMktime($num){ $date1=mktime(0, 0, 0, date("m"), date("d")-$num, date("Y")); $dates_range = date('Y-m-d', $date1); return $dates_range; } public function cutStr($str, $maxChars, $holder=''){ $str = trim(str_replace(" "," ",strip_tags($str))); if (strlen($str) > $maxChars ) $str = mb_substr($str, 0, $maxChars,"UTF-8").$holder; return $str; } public function date_Diff($d1,$d2){ //ห่างกันกี่วัน รับค่า วันที่ 1 , วันที่ 2 $da = (strtotime($d1) - strtotime($d2))/ ( 60 * 60 * 24 ); // 1 day = 60*60*24 $da2 = $da; if($da2<0) $da2 = 0; return $da2; } function getIP(){ // ตรวจสอบ IP กรณีการใช้งาน share internet if(!empty($_SERVER['HTTP_CLIENT_IP'])){ $ip=$_SERVER['HTTP_CLIENT_IP']; }else{ $ip=$_SERVER['REMOTE_ADDR']; } return $ip; } } ?>