Query: $query
Please, contact nipon@beeplusjay.com

"; exit; return $QID; }else{ return $QID; } } function queryERROR($str){ echo"Can't run query: ".htmlspecialchars($str)."
"; echo "MySQL Said: ".mysql_error(); exit; } function getProvince($name,$value='',$lang="thai") { $sql = "SELECT * FROM beeplusjay_province"; $result = $this->query($sql); $str .= ""; return $str; } function maxRank($field,$table,$status){ $sel = "select max($field) as max from $table where bStatus ='".$status."' "; $m = mysql_fetch_array($this->query($sel)); return ($m['max']+1); } function ranking($fid,$fid_value,$fname, $table,$value,$flag,$con,$status){ if($flag == 'increase'){ $con1 = "$fname > '$value' or $fname = '$value'"; } if($flag == 'decrease'){ $con1 = "$fname < '$value' or $fname = '$value'"; $value = 0; } $sel ="select * from $table where ($con1) and $fid != '$fid_value' ".$con." and bStatus ='".$status."' order by $fname asc"; $r = $this->query($sel); $num = mysql_num_rows($r); if($num > 0){ while($R = mysql_fetch_array($r)){ $value++ ; $upd = "update $table set $fname = '$value' where $fid = '$R[0]'"; $this->query($upd); } } } } function show($str){ $str = ereg_replace(" "," ",$str) ; $str = ereg_replace(chr(13),"
",$str); echo $str ; return $str ; } function showbr($str){ $str = ereg_replace(chr(13),"
",$str); echo $str ; return $str ; } function substring($str,$start,$finish){ $str = substr($str,$start,$finish); return $str ; } function ramTag($str) { $str=str_replace("<","<",$str); $str=str_replace(">",">",$str); $str=str_replace("[url=","",$str); return $str; } function ramTagadmin($str) { $str=str_replace("<","<",$str); $str=str_replace(">",">",$str); $str=str_replace("","]",$str); return $str; } function explodetime($str){ list($day,$time) = explode (" ",$str) ; list($h,$m,$s) = explode(":",$time) ; list($year,$month,$days)=explode("-",$day) ; echo "$days-$month-$year" ; return $str; } $_month_name = array(); $_month_name[1] = "มกราคม"; $_month_name[2] = "กุมภาพันธ์"; $_month_name[3] = "มีนาคม"; $_month_name[4] = "เมษายน"; $_month_name[5] = "พฤษภาคม"; $_month_name[6] = "มิถุนายน"; $_month_name[7] = "กรกฏาคม"; $_month_name[8] = "สิงหาคม"; $_month_name[9] = "กันยายน"; $_month_name[10] = "ตุลาคม"; $_month_name[11] = "พฤศจิกายน"; $_month_name[12] = "ธันวาคม"; // when is now? ;-) $now = gmdate( "Y-m-d" ); $curdate = split( "-", $now ); $cur_year = intval($curdate[0]); $cur_month = intval($curdate[1]); $cur_day = intval($curdate[2]); if ( !empty( $HTTP_GET_VARS[ "Y" ] ) ) { $cal_year = $HTTP_GET_VARS[ "Y" ]; } else $cal_year = $cur_year; if ( !empty( $HTTP_GET_VARS[ "m" ] ) ) { $cal_month = $HTTP_GET_VARS[ "m" ]; } else $cal_month = $cur_month; if ( !empty( $HTTP_GET_VARS[ "d" ] ) ) { $cal_day = $HTTP_GET_VARS[ "d" ]; } else { $cal_day = $cur_day; } // คำนวณเดือนและปีถัดไป $cal_next_year = $cal_year; if ( $cal_month < 12 ) { $cal_next_month = $cal_month + 1; } else { $cal_next_month = 1; $cal_next_year = $cal_year + 1; } // คำนวณเดือนและปีก่อนหน้า $cal_prev_year = $cal_year; if ( $cal_month > 1 ) { $cal_prev_month = $cal_month - 1; } else { $cal_prev_month = 12; $cal_prev_year = $cal_year - 1; } function num_days( $year, $month ) { $num = 31; while (!checkdate( $month, $num, $year ) ) { $num--; } return $num; } function monththai ($month){ if($month =="01"){ echo "1 ประจำเดือน มกราคม" ; }else if($month =="02"){ echo "2 ประจำเดือน กุมภาพันธ์" ; }else if($month =="03"){ echo "3 ประจำเดือน มีนาคม"; }else if($month =="04"){ echo "4 ประจำเดือน เมษายน"; }else if($month =="05"){ echo "5 ประจำเดือน พฤษภาคม"; }else if($month =="06"){ echo "6 ประจำเดือน มิถุนายน"; }else if($month =="07"){ echo "7 ประจำเดือน กรกฏาคม"; }else if($month =="08"){ echo "8 ประจำเดือน สิงหาคม"; }else if($month =="09") { echo "9 ประจำเดือน กันยายน"; }else if($month =="10"){echo "10 ประจำเดือน ตุลาคม" ; }else if($month =="11"){ echo "11 ประจำเดือน พฤษศจิกายน"; }else if($month =="12"){ echo "12 ประจำเดือน ธันวาคม" ; }return $month ; } function HilightText($text,$search){ $text = strip_tags($text) ; $length = strlen($text); if ($length >500){ $text = substring($text,0,500)."..." ; } return str_replace($search,''.$search.'',$text); } function close($dbID) { mysql_close($dbID) ; return ($dbID) ; } function webtime($times){ list($day,$time) = explode (" ",$times) ; list($h,$m,$s) = explode(":",$time) ; list ($year,$month,$days)=explode("-",$day) ; echo "$days-$month-$year" ; return $times ; } function checkseminar($position){ $db = new mydb ; $date = (date("Y"))."-".date('m-d'); $selseminar = "select * from seminar where sPosition ='$position' limit 0,1 "; $rseminar = $db->query($selseminar) ; $Rseminar = mysql_fetch_array($rseminar); $numseminar = mysql_num_rows($rseminar) ; $title = $Rseminar['sTitle'] ; $sID = $Rseminar['sID'] ; if ($numseminar != '0'){ echo"$title
"; $detail = strip_tags($Rseminar['sDetail']) ; $length = strlen($detail); if ($length >100 ){ echo substring($detail,0,100)."..." ; }else{ echo $detail ; }return $sID ; }else if ($numseminar == '0'){ $selseminar = "SELECT * FROM calendar WHERE cEnd >= '$date' order by cEnd asc limit 0,1"; $rseminar = $db->query($selseminar) ; $Rseminar = mysql_fetch_array($rseminar); $sID = $Rseminar['sID'] ; $selseminar1 = "SELECT * FROM seminar WHERE sID='$sID'"; $rseminar1 = $db->query($selseminar1) ; $Rseminar1 = mysql_fetch_array($rseminar1); $title = $Rseminar1['sTitle'] ; echo "$title
"; $detail = strip_tags($Rseminar1['sDetail']) ; $length = strlen($detail); if ($length >100 ){ echo substring($detail,0,100)."..." ; }else{ echo $detail ; } return $sID ; } } function selectbox($name,$id){ $db = new mydb ; echo ""; return $name ; } function banner($status,$connect,$ID,$width){ $db = new mydb ; $selbanner = "select * from banner where bStatus = '$status' $connect " ; $rbanner = $db->query($selbanner) ; $num = mysql_num_rows($rbanner) ; $i = 0; if($num != 0){ while($Rbanner= mysql_fetch_array($rbanner)){ $id = $Rbanner['bID'] ; $img[$i]['pic'] = $Rbanner['bPicture']; $img[$i]['ID'] = $Rbanner['bID']; $i++; } @srand((float) microtime() * 100000); @$rn = array_rand($img); $picture = $img[$rn]['pic']; $ID= $img[$rn]['ID']; if($status =='2'){ $checkpic =substring($picture,-4,4) ; $flash = $picture; if ($checkpic ==".swf" ){ echo "

"; }else{ echo "

"; } }else{ $checkpic =substring($picture,-4,4) ; $flash = $picture; if ($checkpic ==".swf" ){ echo " "; }else{ echo "

"; } } return $ID ; } } function dateseminar($start,$end){ if ($start == $end) { list ($yearss,$monthss,$daysss)=explode("-",$start) ; $yearss = $yearss+543 ; $monthss = (int)$monthss-1 ; $thaimonth = array("ม.ค.","ก.พ.","มี.ค.","เม.ย.","พ.ค.","มิ.ย.","ก.ค.","ส.ค.","ก.ย.","ต.ค.","พ.ย.","ธ.ค."); $monthss = $thaimonth[$monthss]; $daysss = (int)$daysss ; echo "$daysss $monthss $yearss"; } elseif ($start != $end ) { list ($startyear,$startmonth,$startday)=explode("-",$start) ; list ($endyear,$endmonth,$endday)=explode("-",$end) ; $endyear = $endyear+543 ; $endmonth = (int)$endmonth-1 ; $thaimonth = array("ม.ค.","ก.พ.","มี.ค.","เม.ย.","พ.ค.","มิ.ย.","ก.ค.","ส.ค.","ก.ย.","ต.ค.","พ.ย.","ธ.ค."); $endmonth = $thaimonth[$endmonth]; $startday = (int)$startday ; $endday = (int)$endday ; echo "$startday-$endday $endmonth $endyear" ; } } function webboardtime($time){ list ($day,$times)=explode(" ",$time) ; list($h,$m,$s) = explode(":",$times) ; list ($yearss,$monthss,$daysss)=explode("-",$day) ; $yearss = $yearss ; $monthss = (int)$monthss-1 ; $thaimonth = array("ม.ค.","ก.พ.","มี.ค.","เม.ย.","พ.ค.","มิ.ย.","ก.ค.","ส.ค.","ก.ย.","ต.ค.","พ.ย.","ธ.ค."); $monthss = $thaimonth[$monthss]; $daysss = (int)$daysss ; echo "$daysss $monthss $yearss $h:$m"; } function lecturer($lID){ $db = new mydb ; $sellecturer = "select * from lecturer where lID = '$lID' "; $rlecturer = $db->query($sellecturer) ; $Rlecturer = mysql_fetch_array($rlecturer) ; $picturer = $Rlecturer['lPicture'] ; $lID = $Rlecturer['lID'] ; $lecturer["name"] = $Rlecturer['lName']; $lecturer["surname"] = $Rlecturer['lSurname']; $lecturer["original"] = $Rlecturer['lOriginal']; $lecturer["position"] = $Rlecturer['lPosition']; echo "" ; return $lecturer ; } function buildNavigation($pageNum_Recordset1,$totalPages_Recordset1,$prev_Recordset1,$next_Recordset1,$separator=" | ",$max_links=5, $show_page=true) { global $maxRows_select,$totalRows_select; $pagesArray = ""; $firstArray = ""; $lastArray = ""; if($max_links<2)$max_links=2; if($pageNum_Recordset1<=$totalPages_Recordset1 && $pageNum_Recordset1>=0) { if ($pageNum_Recordset1 > ceil($max_links/2)) { $fgp = $pageNum_Recordset1 - ceil($max_links/2) > 0 ? $pageNum_Recordset1 - ceil($max_links/2) : 1; $egp = $pageNum_Recordset1 + ceil($max_links/2); if ($egp >= $totalPages_Recordset1) { $egp = $totalPages_Recordset1+1; $fgp = $totalPages_Recordset1 - ($max_links-1) > 0 ? $totalPages_Recordset1 - ($max_links-1) : 1; } } else { $fgp = 0; $egp = $totalPages_Recordset1 >= $max_links ? $max_links : $totalPages_Recordset1+1; } if($totalPages_Recordset1 >= 1) { # ------------------------ # Searching for $_GET vars # ------------------------ $_get_vars = ''; if(!empty($_GET) || !empty($HTTP_GET_VARS)){ $_GET = empty($_GET) ? $HTTP_GET_VARS : $_GET; foreach ($_GET as $_get_name => $_get_value) { if ($_get_name != "pageNum_select") { $_get_vars .= "&$_get_name=$_get_value"; } } } $successivo = $pageNum_Recordset1+1; $precedente = $pageNum_Recordset1-1; $firstArray = ($pageNum_Recordset1 > 0) ? "$prev_Recordset1" : "$prev_Recordset1"; # ---------------------- # page numbers # ---------------------- for($a = $fgp+1; $a <= $egp; $a++){ $theNext = $a-1; if($show_page) { $textLink = $a; } else { $min_l = (($a-1)*$maxRows_select) + 1; $max_l = ($a*$maxRows_select >= $totalRows_select) ? $totalRows_select : ($a*$maxRows_select); $textLink = "$min_l - $max_l"; } $_ss_k = floor($theNext/26); if ($theNext != $pageNum_Recordset1) { $pagesArray .= ""; $pagesArray .= "$textLink" . ($theNext < $egp-1 ? $separator : ""); } else { $pagesArray .= "$textLink" . ($theNext < $egp-1 ? $separator : ""); } } $theNext = $pageNum_Recordset1+1; $offset_end = $totalPages_Recordset1; $lastArray = ($pageNum_Recordset1 < $totalPages_Recordset1) ? "$next_Recordset1" : "$next_Recordset1"; } } return array($firstArray,$pagesArray,$lastArray); } function webmembertime($time){ list ($day,$times)=explode(" ",$time) ; list($h,$m,$s) = explode(":",$times) ; list ($yearss,$monthss,$daysss)=explode("-",$day) ; $yearss = $yearss ; $monthss = (int)$monthss-1 ; $thaimonth = array("ม.ค.","ก.พ.","มี.ค.","เม.ย.","พ.ค.","มิ.ย.","ก.ค.","ส.ค.","ก.ย.","ต.ค.","พ.ย.","ธ.ค."); $monthss = $thaimonth[$monthss]; $daysss = (int)$daysss ; echo "$daysss $monthss $yearss"; } function check_null($str) { if(trim($str)=="") { return "-"; } return $str; } function utf8_to_tis620($string) { $str = $string; $res = ""; for ($i = 0; $i < strlen($str); $i++) { if (ord($str[$i]) == 224) { $unicode = ord($str[$i+2]) & 0x3F; $unicode |= (ord($str[$i+1]) & 0x3F) << 6; $unicode |= (ord($str[$i]) & 0x0F) << 12; $res .= chr($unicode-0x0E00+0xA0); $i += 2; } else { $res .= $str[$i]; } } return $res ; } function tis620_to_utf8($text) { $utf8 = ""; for ($i = 0; $i < strlen($text); $i++) { $a = substr($text, $i, 1); $val = ord($a); if ($val < 0x80) { $utf8 .= $a; } elseif ((0xA1 <= $val && $val < 0xDA) || (0xDF <= $val && $val <= 0xFB)) { $unicode = 0x0E00+$val-0xA0; $utf8 .= chr(0xE0 | ($unicode >> 12)); $utf8 .= chr(0x80 | (($unicode >> 6) & 0x3F)); $utf8 .= chr(0x80 | ($unicode & 0x3F)); } } return $utf8; } function getDates($str) { if($str=="0000-00-00 00:00:00") { return "-"; } $a = explode(" ",$str); $b = explode("-",$a['0']); return $b['2']."-".$b['1']."-".$b['0']; } function getDatesThai($str) { if($str=="0000-00-00 00:00:00") { return "-"; } $a = explode(" ",$str); $b = explode("-",$a['0']); return $b['2']."-".$b['1']."-".($b['0']+543); } function getDatetime($str) { if($str=="0000-00-00 00:00:00") { return "-"; } $a = explode(" ",$str); $b = explode("-",$a['0']); return $b['2']."-".$b['1']."-".$b['0']." ".$a['1']; } function getDateDB($str) { $a = explode("-",$str); return $a['2']."-".$a['1']."-".$a['0']; } function page_text($p_max,$pade,$url,$lang) { if($lang == "thai") { $prv = "ย้อนกลับ"; $nex = "ถัดไป"; } else { $prv = "Previous"; $nex = "Next"; } if($pade>1) { print " ".$prv." "; } if($p_max<=5) { for($i = 1; $i<=$p_max;$i++) { if($i == $pade) { print " ".$i." "; } else { print " ".$i." "; } } } else { if($pade!=1) { print " 1 ..."; } if($pade>=$p_max-4) { for($i = $p_max-4; $i<=$p_max;$i++) { if($i == $pade) { print " ".$i." "; } else { print " ".$i." "; } } } else { for($i = $pade; $i<=$pade+4;$i++) { if($i == $pade) { print " ".$i." "; } else { print " ".$i." "; } } print "... ".$p_max." "; } } if($pade<$p_max) { print " ".$nex." "; } } function page_split($p_max,$pade,$url,$lang) { if($lang == "thai") { $prv = "ย้อนกลับ"; $nex = "ถัดไป"; } else { $prv = "Previous"; $nex = "Next"; } if($pade>1) { print " ".$prv." "; } if($p_max<=15) { for($i = 1; $i<=$p_max;$i++) { if($i == $pade) { print " ".$i." "; } else { print " ".$i." "; } } } else { if($pade!=1) { print " 1 ..."; } if($pade>=$p_max-14) { for($i = $p_max-14; $i<=$p_max;$i++) { if($i == $pade) { print " ".$i." "; } else { print " ".$i." "; } } } else { for($i = $pade; $i<=$pade+14;$i++) { if($i == $pade) { print " ".$i." "; } else { print " ".$i." "; } } print "... ".$p_max." "; } } if($pade<$p_max) { print " ".$nex." "; } } function getTimestamp($str) { $dateTime = explode(" ",$str); $date = explode("-",$dateTime['0']); $time = explode(":",$dateTime['1']); return mktime($time['0'],$time['1'],$time['2'],$date['1'],$date['2'],$date['0']); } ?>