โทร. 054-237369,054-237399 ต่อ 170 โทรสาร 054-237368'; $config["list4page"] =40; $config["list4pagePrint"]=20; $imagesPath = ""; ?> " , ">" , $temp ) ; } $temp = eregi_replace ( "\r\n", "
" , $temp ) ; $temp =ereg_replace(" ", "   ",$temp ); //ป้องกันคำสั่งควบคุม (ถ้ามีมากกว่านี้ก็เพิ่มกันเองแล้วกัน i ไม่ค่อยรู้ แต่ถ้ารู้มากกว่านี้จะทำออกมาให้) $temp = eregi_replace ( "", "</script>" , $temp ) ; $temp = eregi_replace ( "", "</embed>" , $temp ) ; //สำหรับเปลี่ยนอักขระที่กำหนด ให้เป็นแทก html ต่างๆ $temp = eregi_replace ( "\[br\]", "
" , $temp ) ; $temp = eregi_replace ( "\[b\]", "" , $temp ) ; $temp = eregi_replace ( "\[/b\]", "" , $temp ) ; $temp = eregi_replace ( "\[i\]", "" , $temp ) ; $temp = eregi_replace ( "\[/i\]", "" , $temp ) ; $temp = eregi_replace ( "\[u\]", "" , $temp ) ; $temp = eregi_replace ( "\[/u\]", "" , $temp ) ; $temp = eregi_replace ( "\[\-\-\-\]", "     " , $temp ) ; $temp = eregi_replace ( "\[color=red\]", "" , $temp ) ; $temp = eregi_replace ( "\[color=green\]", "" , $temp ) ; $temp = eregi_replace ( "\[color=blue\]", "" , $temp ) ; $temp = eregi_replace ( "\[color=orange\]", "" , $temp ) ; $temp = eregi_replace ( "\[color=pink\]", "" , $temp ) ; $temp = eregi_replace ( "\[color=gray\]", "" , $temp ) ; $temp = eregi_replace ( "\[/color\]", "" , $temp ) ; // คำสั่งแสดงรูปที่แทรกคำสั่งเข้ามา $temp = eregi_replace ("\[img\]([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]])\[/img\]", "",$temp ) ; $temp = eregi_replace ("\[img\]\./img/([^[:space:]]*)\[/img\]", "",$temp ) ; // สร้างลิงค์ URL ที่แทรกคำสั่งเข้ามา (กรณีให้คำสั่ง url เข้ามา) $temp = eregi_replace ("\[url\]([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=])\[/url\]"," \\1://\\2\\3",$temp ) ; // สร้างลิงค์ URL ที่แทรกคำสั่งเข้ามา (ต่างกันที่การเว้นช่องว่างหน้าหลัง) $temp = eregi_replace (" ([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=]) "," \\1://\\2\\3 ",$temp ) ; // สร้างลิงค์ URL ที่แทรกคำสั่งเข้ามา (ต่างกันที่การเว้นช่องว่างหลังอย่างเดียว) $temp = eregi_replace ("([[:alnum:]]+)://([^[:space:]]*)([[:alnum:]#?/&=]) "," \\1://\\2\\3 ",$temp ) ; //สร้างลิงค์อีเมล์ $temp = eregi_replace ("([^[:space:]]*)@([^[:space:]]*)([[:alnum:]])","\\1@\\2\\3",$temp ) ; return ( $temp ) ; } //เปรียบเทียบเวลาปีเป็นพ.ศ. function compareTime($c_date,$c_time,$c_date2,$c_time2){ $Cdd=Substr($c_date,8,2); $Cmm=Substr($c_date,5,2); $Cdd2=Substr($c_date2,8,2); $Cmm2=Substr($c_date2,5,2); $Cyy=Substr($c_date,0,4)-543; $Cyy2=Substr($c_date2,0,4)-543; $Ch=Substr($c_time,0,2); $Cm=Substr($c_time,3,2); //$Cs=Substr($c_time,6,2); $Cs="00"; $Ch2=Substr($c_time2,0,2); $Cm2=Substr($c_time2,3,2); $Cs="00"; //$Cs2=Substr($c_time2,6,2); $std= gmmktime($Ch,$Cm,$Cs,$Cmm,$Cdd,$Cyy); $std2= gmmktime($Ch2,$Cm2,$Cs2,$Cmm2,$Cdd2,$Cyy2); //echo "$Ch,$Cm,$Cs,$Cmm,$Cdd,$Cyy=$Ch2,$Cm2,$Cs2,$Cmm2,$Cdd2,$Cyy2
"; if($std2>$std){ $std=$std2-$std; }else { $std=$std-$std2; } $HH=0; if($std/60>1440){ $HH=$std/3600; settype($HH, "integer"); $MM=($std-($HH*3600))/60; if(strlen($MM)==1){ $MM="0$MM"; } $HH= "$HH.$MM"; }else { $HH=$std/3600; $HH=substr($HH,0,strpos($HH,".")); $MM=($std-($HH*3600))/60; if(strlen($MM)==1){ $MM="0$MM"; } $HH= "$HH.$MM"; } return $HH; } function filecount($FolderPath) { $filescount = 0; // Open the directory $dir = opendir($FolderPath); // if the directory doesn't exist return 0 if (!$dir){return 0;} // Read the directory and get the files while (($file = readdir($dir)) !== false) { if ($file[0] == '.'){ continue; } //if '.' it is a sub folder and call the function recursively if (is_dir($FolderPath.$file)){ // Call the function if it is a folder type $filescount += filecount($FolderPath.$file.DIRECTORY_SEPARATOR); } else { // Increment the File Count. $filescount++; } } // close the directory closedir($dir); return $filescount; } function DirDisply($data) { $TrackDir=opendir($data); $data=""; while ($file = readdir($TrackDir)) { if ($file == "." || $file == "..") { } else { $pos1=strrchr($file,"."); $ftype=str_replace(".","",$pos1); $ftype=strtolower($ftype); echo " "; if(empty($data)){ $data="$file:$ftype"; }else { $data=$data.",$file:$ftype"; } } } closedir($TrackDir); return $data; } // ฟังก์ชั่นตัดคำหยาบซึ่งสามารถเพิ่มคำที่ต้องการตัดได้ function CheckRude($temp){ $wordrude = array("ashole","a s h o l e","a.s.h.o.l.e","bitch","b i t c h","b.i.t.c.h","shit","s h i t","s.h.i.t","fuck","dick","f u c k","d i c k","f.u.c.k","d.i.c.k","มึง","มึ ง","กู","ควย","ค ว ย","ค.ว.ย","คอ วอ ยอ","คอ-วอ-ยอ","ปี้","เหี้ย","เฮี้ย","ชาติหมา","ชาดหมา","ช า ด ห ม า","ช.า.ด.ห.ม.า","ช า ติ ห ม า","ช.า.ติ.ห.ม.า","ไอ้","สัดหมา","สัด","เย็ด","หี","สันดาน","แม่ง","ระยำ","ส้นตีน","แตด") ; $wordchange = ("+++") ; for ( $i=0 ; $i dbconnection = @mysql_connect($server, $username, $password); if ($this->dbconnection !== false) { $db = @mysql_select_db($dbname); @mysql_query("SET NAMES $language", $this->dbconnection); $cs1 = "SET character_set_results=utf8"; @mysql_query($cs1) or die('Error query: ' . mysql_error()); $cs2 = "SET character_set_client = utf8"; @mysql_query($cs2) or die('Error query: ' . mysql_error()); $cs3 = "SET character_set_connection = utf8"; @mysql_query($cs3) or die('Error query: ' . mysql_error()); } return ($this->dbconnection === false || $db === false) ? false : true; } // ׹ resource connection function connection() { return $this->dbconnection; } // ¡ԡ mysql function close() { @mysql_close($this->dbconnection); } // ׹ error ͧ mysql function Error() { return @mysql_error($this->dbconnection); } // 蹢ͧ class function Version() { return $this->vesion; } // ׹Ҩӹǹŷͧҧ function recCount($sql) { $query = @mysql_query($sql, $this->dbconnection); $result = @mysql_num_rows($query); return $result; } // Ңźҧ $table 稤׹ҧ 稤׹ array record function dbSearch($sql) { $query = @mysql_query($sql, $this->dbconnection); $recArr = array(); if (@mysql_num_rows($query) == 0) { return $recArr; } else { while ($row = @mysql_fetch_array($query)) { $recArr[] = $row; } @mysql_free_result($query); return $recArr; } } //㹡óյͧ 1 Reccord function getRec($sql) { $query = @mysql_query($sql, $this->dbconnection); if (@mysql_num_rows($query) == 0) { return false; } else { $result = mysql_fetch_array($query, MYSQL_ASSOC); mysql_free_result($query); return $result; } } // Ңźҧ $table 稤׹ҧ 稤׹ array record ˹ function dbSearch_Page($sql,$page,$perpage) { if(empty($page)){$page=1;} $start=($page*$perpage)-$perpage; $sql=$sql." limit $start,$perpage"; $query = @mysql_query($sql, $this->dbconnection); $recArr = array(); if (@mysql_num_rows($query) == 0) { return $recArr; } else { while ($row = @mysql_fetch_array($query, MYSQL_ASSOC)) { $recArr[] = $row; } @mysql_free_result($query); return $recArr; } } function show_Page($sql,$nrow,$perpage,$page,$link) { $allpage = floor($nrow/$perpage); if ($nrow % $perpage > 0){ $allpage=$allpage+1; } for ($i=1; $i<=$allpage; $i++){ if($page==$i){ $pagelist =$pagelist." $i   "; }else { $pagelist =$pagelist." $i   "; } } return $pagelist; } function show_Page2($sql,$nrow,$perpage,$page,$link,$txt) { $allpage = floor($nrow/$perpage); if ($nrow % $perpage > 0){ $allpage=$allpage+1; } if(!empty($txt)){$txt="&$txt";} for ($i=1; $i<=$allpage; $i++){ if($page==$i){ $pagelist =$pagelist." $i   "; }else { $pagelist =$pagelist." $i   "; } } return $pagelist; } function show_Page3($sql,$nrow,$perpage,$page,$link,$txt) { $allpage = floor($nrow/$perpage); if ($nrow%$perpage > 0){ $allpage=$allpage+1; } if($page>1){ $pagePrev=$page-1; }else { $pagePrev=1; } $pagelist= "
    "; if($page>1){ $pagelist= $pagelist."
  • «
  • "; } for ($i=1; $i<=$allpage; $i++){ if($page==$i){ $pagelist =$pagelist."
  • $i
  • "; }else { $pagelist =$pagelist."
  • $i
  • "; } } if($page==$allpage){ $pageNext=$allpage; }else { $pageNext=$page+1; } if($page<$allpage){ $pagelist =$pagelist. "
  • »
  • "; } $pagelist =$pagelist. "
"; return $pagelist; } function show_PagejavaScript($sql,$nrow,$perpage,$page,$link,$txt) { $allpage = floor($nrow/$perpage); if ($nrow % $perpage > 0){ $allpage=$allpage+1; } $pos=strpos($txt, ","); for ($i=1; $i<=$allpage; $i++){ if($pos==0){ if($page==$i){ $pagelist =$pagelist." $i   "; }else { $pagelist =$pagelist." $i   "; } }else { $Link="$link($i,$txt)"; if($page==$i){ $pagelist =$pagelist." $i   "; }else { $pagelist =$pagelist." $i   "; } } } return $pagelist; } // ŧ $table ׹ id ͧ record 稤׹ false function dbAdd($table, $recArr) { $keys = array(); $values = array(); foreach ($recArr as $key => $value) { $keys[] = $key; $values[] = $value; } $sql = 'INSERT INTO `'.$table.'` (`'.implode('`,`', $keys); $sql .= "`) VALUES ('".implode("','", $values); $sql .= "');"; $query = @mysql_query($sql, $this->dbconnection); return ($query === false) ? false : mysql_affected_rows(); } // ¡÷ $id 稤׹ false function dbUpdate($table, $condition, $recArr) { $keys = array(); $values = array(); foreach ($recArr as $key => $value) { $datas[] = "`$key`='$value'"; } $sql = "UPDATE `$table` SET ".implode(",", $datas)." WHERE $condition;"; $query = @mysql_query($sql, $this->dbconnection); return mysql_affected_rows(); } // ź 礤¡÷ $id 稤׹ false function dbDelete($table, $condition) { $sql = "DELETE FROM `$table` WHERE $condition;"; $query = @mysql_query($sql, $this->dbconnection); return mysql_affected_rows(); } // query ׹Ңͧ true=1 or false=0 // ѺӤ觷ͧäҤ׹Ѻ function query($sql) { $query = @mysql_query($sql, $this->dbconnection); return ($query === false) ? false : mysql_affected_rows(); } // string / function sql_quote($value) { if (get_magic_quotes_gpc()) { $value = stripslashes($value); } // check function if (function_exists("mysql_real_escape_string")) { $value = mysql_real_escape_string($value); } else { // PHP version < 4.3.0 use addslashes $value = addslashes($value); } return $value; } // ѴâͤẺ trim function sql_trim_str($value) { return $this->sql_quote(htmlspecialchars(trim($value))); } // ѴâͤẺ trim function sql_str($value) { return $this->sql_quote(htmlspecialchars($value)); } // ŧ mktime ѹ sql function sql_mktimetodate($mktime) { return date("Y-m-d", $mktime); } // ŧ mktime ѹҢͧ sql function sql_mktimetodatetime($mktime) { return date("Y-m-d H:i:s", $mktime); } // ѧ蹾Ѻ ҹ config ͧкԴŧ db // ͧٻẺ˹ҹ function getConfig($table, $module, &$config) { $query = @mysql_query("SELECT `name`,`value`,`type` FROM `$table` WHERE `module`='$module';"); while ($row = @mysql_fetch_array($query, MYSQL_ASSOC)) { $config[$module][$row[name]] = $row[type] == 'option' ? explode(',', $row[value]) : $row[value]; } @mysql_free_result($query); } } class Timer { private $elapsedTime; // start timer public function start() { if (!$this->elapsedTime = $this->getMicrotime()) { throw new Exception('Error obtaining start time!'); } } // stop timer public function stop() { if (!$this->elapsedTime = round($this->getMicrotime() - $this->elapsedTime, 10)) { throw new Exception('Error obtaining stop time!'); } return $this->elapsedTime; } // define private 'getMicrotime()' method private function getMicrotime() { list($useg, $seg) = explode(' ', microtime()); return ((float)$useg + (float)$seg); } } ?>