?
Path : /home/admin/domains/happytokorea.com/private_html/libs-bak/ |
Current File : /home/admin/domains/happytokorea.com/private_html/libs-bak/function.php |
<?php function curPageURL() { $pageURL = 'http'; if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";} $pageURL .= "://"; if ($_SERVER["SERVER_PORT"] != "80") { $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; } else { $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; } return $pageURL; } function Browser(){ $useragent = $_SERVER['HTTP_USER_AGENT']; if (preg_match('|MSIE ([0-9].[0-9]{1,2})|',$useragent,$matched)) { $browser_version=$matched[1]; $browser = 'IE'; } elseif (preg_match( '|Opera ([0-9].[0-9]{1,2})|',$useragent,$matched)) { $browser_version=$matched[1]; $browser = 'Opera'; } elseif(preg_match('|Firefox/([0-9\.]+)|',$useragent,$matched)) { $browser_version=$matched[1]; $browser = 'Firefox'; } elseif(preg_match('|Safari/([0-9\.]+)|',$useragent,$matched)) { $browser_version=$matched[1]; $browser = 'Safari'; } else { // browser not recognized! $browser_version = 0; $browser= 'other'; } $Browser=Array('browser'=>$browser,'version'=>$browser_version); return $Browser; } function uploadfiles($input_name,$new_name,$file_dir,$limit_size,$numfiles){ if ($_POST) { $msg=''; $picname=array(); $j=1; for($i=0;$i<$numfiles;$i++){ if (trim($_FILES[$input_name]['name'][$i])!="") { $filesize=$_FILES[$input_name]['size'][$i]; $exp_dot=explode(".",$_FILES[$input_name]['name'][$i]); $arr_type=count($exp_dot)-1; $filetype=$exp_dot[$arr_type]; $newname=$new_name."_".$j."_.".$filetype; array_push($picname, $newname); $newfile = $file_dir."/".$newname; move_uploaded_file($_FILES[$input_name]['tmp_name'][$i], $newfile); $j++; }else{ array_push($picname,''); } } } return $picname; }//end function upload file function getClientIp(){ if ($_SERVER['HTTP_CLIENT_IP']) { $IP = $_SERVER['HTTP_CLIENT_IP']; } elseif (preg_match("[0-9]",$_SERVER["HTTP_X_FORWARDED_FOR"] )) { $IP = $_SERVER["HTTP_X_FORWARDED_FOR"]; } else { $IP = $_SERVER["REMOTE_ADDR"]; } return $IP; } function msg_feedback(){ global $msg_feedback,$db; $msg=$_GET['msg']; if($msg!=''){ $msg2=$msg_feedback[$msg]; $output.="<table width=\"99%\" height=\"100%\" class=\"table_feedback\"> <tr> <td width=\"100%\" align=\"center\" valign=\"bottom\"> <span style=\"color:red;font-weight:bold;\">$msg2</span> </td> </tr> <tr></table>"; } return $output; } $_Year_En2Th=Array( '2007'=>"2550", '2006'=>"2549", '2005'=>"2548", '2004'=>"2547", '2003'=>"2546", '2002'=>"2545", '2001'=>"2544", '2000'=>"2543", '1999'=>"2542", '1998'=>"2541", '1997'=>"2540", '1996'=>"2539", '1995'=>"2538", '1994'=>"2537", '1993'=>"2536", '1992'=>"2535", '1991'=>"2534", '1990'=>"2533", '1989'=>"2532", '1988'=>"2531", '1987'=>"2530", '1986'=>"2529", '1985'=>"2528", '1984'=>"2527", '1983'=>"2526", '1982'=>"2525", '1981'=>"2524", '1980'=>"2523", '1979'=>"2522", '1978'=>"2521", '1977'=>"2520", '1976'=>"2519", '1975'=>"2518", '1974'=>"2517", '1973'=>"2516", '1972'=>"2515", '1971'=>"2514", '1970'=>"2513", '1969'=>"2512", '1968'=>"2511", '1967'=>"2510", '1966'=>"2509", '1965'=>"2508", '1964'=>"2507", '1963'=>"2506", '1962'=>"2505", '1961'=>"2504", '1960'=>"2503", '1959'=>"2502", '1958'=>"2501", '1957'=>"2500", '1956'=>"2499", '1955'=>"2498", '1954'=>"2497", '1953'=>"2496", '1952'=>"2495", '1951'=>"2494", '1950'=>"2493", '1949'=>"2492", '1948'=>"2491", '1947'=>"2490", '1946'=>"2489", '1945'=>"2488", '1944'=>"2487", '1943'=>"2486", '1942'=>"2485", '1941'=>"2484", '1940'=>"2483", '1939'=>"2482", '1938'=>"2481", '1937'=>"2480", '1936'=>"2479" ); //end list year $_Province_Array=Array( '1'=>'กรุงเทพๆ', '2'=>"กระบี่", '3'=>"กาญจนบุรี", '4'=>"กาฬสินธุ์", '5'=>"กำแพงเพชร", '6'=>"ขอนแก่น", '7'=>"จันทบุรี", '8'=>"ฉะเชิงเทรา", '9'=>"ชลบุรี", '10'=>"ชัยนาท", '11'=>"ชัยภูมิ", '12'=>"ชุมพร", '13'=>"เชียงราย", '14'=>"เชียงใหม่", '15'=>"ตรัง", '16'=>"ตราด", '17'=>"ตาก", '18'=>"นครนายก", '19'=>"นครปฐม", '20'=>"นครพนม", '21'=>"นครราชสีมา", '22'=>"นครศรีธรรมราช", '23'=>"นครสวรรค์", '24'=>"นนทบุรี", '25'=>"นราธิวาส", '26'=>"น่าน", '27'=>"บุรีรัมย์", '28'=>"ปทุมธานี", '29'=>"ประจวบคีรีขันธ์", '30'=>"ปราจีนบุรี", '31'=>"ปัตตานี", '32'=>"พะเยา", '33'=>"พังงา", '34'=>"พัทลุง", '35'=>"พิจิตร", '36'=>"พิษณุโลก", '37'=>"เพชรบุรี", '38'=>"เพชรบูรณ์", '39'=>"แพร่", '40'=>"ภูเก็ต", '41'=>"มหาสารคาม", '42'=>"มุกดาหาร", '43'=>"แม่ฮ่องสอน", '44'=>"ยโสธร", '45'=>"ยะลา", '46'=>"ร้อยเอ็ด", '47'=>"ระนอง", '48'=>"ระยอง", '49'=>"ราชบุรี", '50'=>"ลพบุรี", '51'=>"ลำปาง", '52'=>"ลำพูน", '53'=>"เลย", '54'=>"ศรีสะเกษ", '55'=>"สกลนคร", '56'=>"สงขลา", '57'=>"สตูล", '58'=>"สมุทรปราการ", '59'=>"สมุทรสงคราม", '60'=>"สมุทรสาคร", '61'=>"สระแก้ว", '62'=>"สระบุรี", '63'=>"สิงห์บุรี", '64'=>"สุโขทัย", '65'=>"สุพรรณบุรี", '66'=>"สุราษฎร์ธานี", '67'=>"สุรินทร์", '68'=>"หนองคาย", '69'=>"หนองบัวลำภู", '70'=>"อยุธยา", '71'=>"อ่างทอง", '72'=>"อำนาจเจริญ", '73'=>"อุดรธานี", '74'=>"อุตรดิตถ์", '75'=>"อุทัยธานี", '76'=>"อุบลราชธานี" ); function conver_YYYYMMDD_to_thai($date){ $Year=Array( '2016'=>"59", '2015'=>"58", '2014'=>"57", '2013'=>"56", '2012'=>"55", '2011'=>"54", '2010'=>"53", '2009'=>"52", '2008'=>"51", '2007'=>"50", '2006'=>"49", '2005'=>"48", '2004'=>"47", '2003'=>"46", '2002'=>"45", '2001'=>"44", '2000'=>"43", '1999'=>"42", '1998'=>"41", '1997'=>"40", '1996'=>"39", '1995'=>"38", '1994'=>"37", '1993'=>"36", '1992'=>"35", '1991'=>"34", '1990'=>"33", '1989'=>"32", '1988'=>"31", '1987'=>"30", '1986'=>"29", '1985'=>"28", '1984'=>"27", '1983'=>"26", '1982'=>"", '1981'=>"24", '1980'=>"23", '1979'=>"22", '1978'=>"21", '1977'=>"20", '1976'=>"19", '1975'=>"18", '1974'=>"17", '1973'=>"16", '1972'=>"15", '1971'=>"14", '1970'=>"13", '1969'=>"12", '1968'=>"11", '1967'=>"10", '1966'=>"09", '1965'=>"08", '1964'=>"07", '1963'=>"06", '1962'=>"05", '1961'=>"04", '1960'=>"03", '1959'=>"02", '1958'=>"01", '1957'=>"00", '1956'=>"2499", '1955'=>"2498", '1954'=>"2497", '1953'=>"2496", '1952'=>"2495", '1951'=>"2494", '1950'=>"2493", '1949'=>"2492", '1948'=>"2491", '1947'=>"2490", '1946'=>"2489", '1945'=>"2488", '1944'=>"2487", '1943'=>"2486", '1942'=>"2485", '1941'=>"2484", '1940'=>"2483", '1939'=>"2482", '1938'=>"2481", '1937'=>"2480", '1936'=>"2479" ); list($year,$M,$day)=explode("-",$date); $year=$Year[$year]; $month= array ("ม.ค.", "ก.พ.", "มี.ค.", "เม.ย.", "พ.ค.", "มิ.ย.", "ก.ค.","ส.ค.", "ก.ย.", "ต.ค.", "พ.ย.", "ธ.ค." ); $date=$day." ".$month[$M-1].$year; return $date; } function Wonderful_Schedule($startdate,$enddate){ $Year=Array( '2016'=>"59", '2015'=>"58", '2014'=>"57", '2013'=>"56", '2012'=>"55", '2011'=>"54", '2010'=>"53", '2009'=>"52", '2008'=>"51", '2007'=>"50", '2006'=>"49", '2005'=>"48", '2004'=>"47", '2003'=>"46", '2002'=>"45", '2001'=>"44", '2000'=>"43", '1999'=>"42", '1998'=>"41", '1997'=>"40", '1996'=>"39", '1995'=>"38", '1994'=>"37", '1993'=>"36", '1992'=>"35", '1991'=>"34", '1990'=>"33", '1989'=>"32", '1988'=>"31", '1987'=>"30", '1986'=>"29", '1985'=>"28", '1984'=>"27", '1983'=>"26", '1982'=>"", '1981'=>"24", '1980'=>"23", '1979'=>"22", '1978'=>"21", '1977'=>"20", '1976'=>"19", '1975'=>"18", '1974'=>"17", '1973'=>"16", '1972'=>"15", '1971'=>"14", '1970'=>"13", '1969'=>"12", '1968'=>"11", '1967'=>"10", '1966'=>"09", '1965'=>"08", '1964'=>"07", '1963'=>"06", '1962'=>"05", '1961'=>"04", '1960'=>"03", '1959'=>"02", '1958'=>"01", '1957'=>"00", '1956'=>"2499", '1955'=>"2498", '1954'=>"2497", '1953'=>"2496", '1952'=>"2495", '1951'=>"2494", '1950'=>"2493", '1949'=>"2492", '1948'=>"2491", '1947'=>"2490", '1946'=>"2489", '1945'=>"2488", '1944'=>"2487", '1943'=>"2486", '1942'=>"2485", '1941'=>"2484", '1940'=>"2483", '1939'=>"2482", '1938'=>"2481", '1937'=>"2480", '1936'=>"2479" ); list($year,$M,$day)=explode("-",$startdate); $year=$Year[$year]; list($eyear,$eM,$eday)=explode("-",$enddate); $eyear=$Year[$eyear]; $month= array ("ม.ค.", "ก.พ.", "มี.ค.", "เม.ย.", "พ.ค.", "มิ.ย.", "ก.ค.","ส.ค.", "ก.ย.", "ต.ค.", "พ.ย.", "ธ.ค." ); if($year==$eyear&&$M==$eM){ return $day." - ".$eday." ".$month[$M-1]." ".$year; }else if($year==$eyear&&$M!=$eM){ return $day." ".$month[$M-1]." - ".$eday." ".$month[$eM-1]." ".$year; }else{ return $date=$day." ".$month[$M-1].$year." - ".$eday." ".$month[$eM-1]." ".$eyear; } } function Wonderful_Schedule_Eng($startdate,$enddate){ $Year=Array( '2017'=>"17", '2016'=>"16", '2015'=>"15", '2014'=>"14", '2013'=>"13", '2012'=>"12", '2011'=>"11", '2010'=>"10", '2009'=>"09", '2008'=>"08", '2007'=>"07", '2006'=>"06", '2005'=>"05", '2004'=>"04", '2003'=>"03", '2002'=>"02", '2001'=>"01", '2000'=>"00", '1999'=>"99", '1998'=>"98", '1997'=>"97", '1996'=>"96", '1995'=>"95", '1994'=>"94", '1993'=>"93", '1992'=>"92", '1991'=>"91", '1990'=>"90", '1989'=>"89", '1988'=>"88", '1987'=>"87", '1986'=>"86", '1985'=>"85", '1984'=>"84", '1983'=>"83", '1982'=>"82", '1981'=>"81", '1980'=>"80", ); list($year,$M,$day)=explode("-",$startdate); $year=$Year[$year]; list($eyear,$eM,$eday)=explode("-",$enddate); $eyear=$Year[$eyear]; $month= array ("JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL","AUS", "SEP", "OCT", "NOV", "DEC" ); if($year==$eyear&&$M==$eM){ return $day." - ".$eday." ".$month[$M-1]." ".$year; }else if($year==$eyear&&$M!=$eM){ return $day." ".$month[$M-1]." - ".$eday." ".$month[$eM-1]." ".$year; }else{ return $date=$day." ".$month[$M-1].$year." - ".$eday." ".$month[$eM-1]." ".$eyear; } } function month1() { $month= array ("ม.ก.", "ก.พ.", "มี.ค.", "เม.ย.", "พ.ค.", "มิ.ย.", "ก.ค.","ส.ค.", "ก.ย.", "ต.ค.", "พ.ย.", "ธ.ค." ); $b = date( "n" )-1; return "$month[$b]"; } function month2($time) { $month = array ("มกราคม", "กุมภาพันธ์", "มีนาคม","เมษายน","พฤษภาคม", "มิถุนายน", "กรกฏาคม","สิงหาคม","กันยายน", "ตุลาคม", "พฤษจิกายน","ธันวาคม" ); $b=$time-1; return "$month[$b]"; } function thai_date($time){ if($time!=""){ $a = date( "j",$time ); // วัน $b = month2($time); // เดือน $c = date( "Y" ,$time)+543; // ปี $d = date("H:i",$time); // เวลา $f = date( "n",$time ); // เดือน ตัวเลข (อัพโหลด) $g = date("H-i",$time); // เวลา (อัพโหลด) // ค่าวันที่ ที่จะบันทึกลงฐานข้อมูล $dateadd = "$a $b $c เวลา $d"; }else{ $dateadd='-'; } return $dateadd; } function thai_date_time($time){ if($time!=""){ $a = date( "j",$time ); // วัน $b = month2($time); // เดือน $c = date( "Y" ,$time)+543; // ปี $d = date("H:i",$time); // เวลา $f = date( "n",$time ); // เดือน ตัวเลข (อัพโหลด) $g = date("H-i",$time); // เวลา (อัพโหลด) // ค่าวันที่ ที่จะบันทึกลงฐานข้อมูล $dateadd = "$a $b $c"; }else{ $dateadd='-'; } return $dateadd; } function changNumber2Image($number){ if($number<10){$number="00$number";}else if($number<100){$number="0$number";}else{$number="$number";} $j=strlen($number); for($i=0;$i<$j;$i++){ $image[$i].="<img src=\"Image/comment_block/no_".$number[$i].".gif\" border=\"0\">"; $html.=$image[$i]; }//end for return $html; } function Success($link,$comment){ echo "$comment"; echo"<meta http-equiv=\"refresh\" content=\"0;url=$link\">"; } function Error($comment){ global $f_btCloseWindow,$f_btBack; echo"<br><center>"; echo "<b>$comment</b>"; echo "<br><br>"; echo "<input type=\"button\" value=\" ".f_btBack." \" class=\"MainButton\" onClick=\"javascript:history.back()\">"; echo "<input type=\"button\" value=\" ".f_btCloseWindow." \" class=\"MainButton\" onClick=\"javascript:window.close()\">"; } /* function confirm_del($link,$comment,$alt) { global $_Config_template_path; $output="<script language=\"JavaScript\"> function tmt_confirm(msg){ document.MM_returnValue=(confirm(unescape(msg))); } </script><a href=\"$link\"><img src=\"images/bt_delete.png\" border=\"0\" alt=\"$alt\" onClick=\"tmt_confirm('$comment'); return document.MM_returnValue\"></a>"; return $output; }//end function AcceptDelete */ function confirm_del($link,$comment,$alt) { global $_Config_template_path; $output="<script language=\"JavaScript\"> function tmt_confirm(msg){ document.MM_returnValue=(confirm(unescape(msg))); } </script><a href=\"$link\" class=\"btn14 mr5\" onClick=\"tmt_confirm('$comment'); return document.MM_returnValue\" ><img src=\"images/icons/dark/close.png\" alt=\"$alt\" > ลบ</a> "; return $output; }//end function AcceptDelete function calendar($month,$year,$lastMonth,$lastYear,$nextMonth,$nextYear,$dayadd){ if($day==''){ $day = "01"; }if($month==''){ $month = date("m"); }if($year==''){ $year = date("Y"); } if($lastMonth!= "" and $lastMonth != 1){ $month = $lastMonth - 1; }if($lastMonth != "" and $lastMonth == 1){ $month = 12; $year = $year - 1; }if($nextMonth != "" and $nextMonth != 12){ $month = $nextMonth + 1; }if($nextMonth != "" and $nextMonth == 12){ $month = 1; $year = $year + 1; }if($lastYear != ""){ $year = $lastYear - 1; }if($nextYear != ""){ $year = $nextYear + 1; } $zzz = strtotime($year."-".$month."-".$day); $yyy = getdate($zzz); $www = $yyy['wday']; $lastday = mktime(0,0,0,$month+1,0,$year); $lastday = strftime("%d", $lastday); $rows_cal = ceil($lastday/7); if($www == 5 and $lastday > 30){ $data_day[0] = $lastday; }if($www == 6 and $lastday == 30){ $data_day[0] = $lastday; }if($www == 6 and $lastday > 30){ $data_day[0] = $lastday-1; $data_day[1] = $lastday; }if($www < 5){ for($f=2;$f<$www;$f++){ $data_day[$f] = ""; } } $m = 1; for($i=$www;$i<=($lastday + ($www - 1));$i++){ $data_day[$i] = $m; $m++; } if($month == '01' or $month == 1){ $que_month = 'January'; }if($month == '02' or $month == 2){ $que_month = 'February'; }if($month == '03' or $month == 3){ $que_month = 'March'; }if($month == '04' or $month == 4){ $que_month = 'April'; }if($month == '05' or $month == 5){ $que_month = 'May'; }if($month == '06' or $month == 6){ $que_month = 'June'; }if($month == '07' or $month == 7){ $que_month = 'July'; }if($month == '08' or $month == 8){ $que_month = 'August'; }if($month == '09' or $month == 9){ $que_month = 'September'; }if($month == '10' or $month == 10){ $que_month = 'October'; }if($month == '11' or $month == 11){ $que_month = 'November'; }if($month == '12' or $month == 12){ $que_month = 'December'; } if($month > 0 and $month < 10){ $lastMonth = substr($month,1,1); }else{ $lastMonth = $month; } $output="<table width=\"150\"> <tr bgcolor=#BBEEFF> <td> "; if(($year >= 1970 and $month > 1) or ($year > 1970)){ $output.="<a href=\"$PHP_SELF?lastMonth=$month&Year=$year\"> <font face=verdana size=1><</a> "; } $output.="</td> <td> "; if($year > 1970){ $output.="<a href=\"$PHP_SELF?lastYear=$year&month=$month\"> <font face=verdana size=1><<</a> "; } $output.="</td> <td colspan=\"3\"><center> <font face=verdana size=1> $que_month $year </font></center></td> <td> "; if($year < 2020){ $output.="<a href=\"$PHP_SELF?nextYear=$year&month=$month\"> <font face=verdana size=1>>></a> "; } $output.=" </td> <td> "; if(($year <= 2020 and $month < 12) or ($year < 2020)){ $output.=" <a href=\"$PHP_SELF?nextMonth=$month&year=$year\"> <font face=verdana size=1>> "; } $output.="</a> </td> </tr> <tr> <td width=\"20\"><center><font face=verdana size=1>S</center></td> <td width=\"20\"><center><font face=verdana size=1>M</center></td> <td width=\"20\"><center><font face=verdana size=1>T</center></td> <td width=\"20\"><center><font face=verdana size=1>W</center></td> <td width=\"20\"><center><font face=verdana size=1>T</center></td> <td width=\"20\"><center><font face=verdana size=1>F</center></td> <td width=\"20\"><center><font face=verdana size=1>S</center></td> </tr> "; $z = 0; while($z <= $lastday){ for($i=1;$i<=$rows_cal;$i++){ $output.="<tr id=\"[$i]\">"; for($j=0;$j<=6;$j++){ if($j==0){ $clr = "red"; }else{ $clr = "black"; } if($data_day[$z] == date("d") and ($month == date("m"))){ $blk = "<strong>"; $col = "#fea398"; }else{ $blk = ""; $col = ""; } $output.=" <td bgcolor=$col><center> <font color=$clr>"; ?> <? if($var_cnt[$z] !=""){ $output.="<a title=\"เข้าสู่หน้าจอแบบ Lite Version เข้าถึงเว็บไซต์ได้รวดเร็ว\" href=\"$PHP_SELF?dat=$year-$month-$data_day[$z]\"> <font color=blue>$data_day[$z]</a> "; }else{ if(in_array($data_day[$z],$dayadd)){ $output.="<a title=\"เข้าสู่หน้าจอแบบ Lite Version เข้าถึงเว็บไซต์ได้รวดเร็ว\" href=\"$PHP_SELF?dat=$year-$month-$data_day[$z]\">$data_day[$z]</a>"; }else{ $output.= "<div id=\"$data_day[$z]\">$data_day[$z]</div>"; } } $output.="</font> "; $z++; $output.="</center></td> "; } $output.="</tr> "; } } $output.=" </table> "; return $output; } //เอาไว้แปลงตัวเลง เช่น 1 == 001 function convert_number($number){ if($number<10){ $number="00$number"; }else if($number<100){ $number="0$number"; } return $number; } function check_validate_email($email) { $result = TRUE; if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", $email)) { $result = FALSE; } return $result; } function check_email_address($email) { // First, we check that there's one @ symbol, and that the lengths are right if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) { // Email invalid because wrong number of characters in one section, or wrong number of @ symbols. return false; } // Split it into sections to make life easier $email_array = explode("@", $email); $local_array = explode(".", $email_array[0]); for ($i = 0; $i < sizeof($local_array); $i++) { if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) { return false; } } if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name $domain_array = explode(".", $email_array[1]); if (sizeof($domain_array) < 2) { return false; // Not enough parts to domain } for ($i = 0; $i < sizeof($domain_array); $i++) { if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) { return false; } } } return true; } function validate_Username($username) { $result = TRUE; if(! eregi('^[a-zA-Z0-9_]$',$username)){ $result = FALSE; } return $result; } function conver_day($day){ $html.="<SELECT id=day name=dd> <OPTION value=1 selected>01</OPTION> "; return $html; } function album_check_table_row($number){ $explod=explode(".",$number); return count($explod); } //function Random จะ return ค่าตามจำนวน $leng_of_number // example $x=Random_int(4), $x=AGc9 function Random_Int($leng_of_number){ mt_srand ((double) microtime() * 1000000); $pass_len = mt_rand (20,40); $allchar = "abcdefghijklnmopqrstuvwxyzABCDEFGHIJKLNMOPQRSTUVWXYZ0123456789"; $str = "" ; for ( $i = 0; $i<$pass_len ; $i++ ){ $str .= substr( $allchar, mt_rand (0,62), 1 ) ; } $str=substr($str,1,$leng_of_number); return($str); } // เอาไว้สร้างรูปเล็กไว้ show หน้าเว็บ /* $img=ไฟล์ต้นฉบับ $new_name= ชื่อใหม่ เวลาแปลงแล้วจะเป็น $new_name_thumb.bmp */ function make_thumb($img_name,$filename,$new_w) { //get image extension. $ext=getExtension($img_name); //creates the new image using the appropriate function from gd library if(!strcmp("jpg",$ext) || !strcmp("jpeg",$ext)) $src_img=imagecreatefromjpeg($img_name); if(!strcmp("png",$ext)) $src_img=imagecreatefrompng($img_name); if(!strcmp("gif",$ext)) $src_img=imagecreatefromgif($img_name); //gets the dimmensions of the image list($old_x, $old_y, $type, $attr) = getimagesize($img_name); $thumb_w=$new_w; $thumb_h = $old_y/($old_x/$new_w); # calculate height, auto height // we create a new image with the new dimmensions $dst_img=ImageCreateTrueColor($thumb_w,$thumb_h); // resize the big image to the new created one imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y); // output the created image to the file. Now we will have the thumbnail into the file named by $filename if(!strcmp("png",$ext)){ imagepng($dst_img,$filename); }else if(!strcmp("gif",$ext)){ imagegif($dst_img,$filename); }else{ imagejpeg($dst_img,$filename); } //destroys source and destination images. imagedestroy($dst_img); imagedestroy($src_img); } // This function reads the extension of the file. // It is used to determine if the file is an image by checking the extension. function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return strtolower($ext); } function CutLongText($text,$num){ //(ข้อความ,จำนวนตัวอักษร) if ( strlen($text) > $num ) { //$text =substr($text,0,$num)."..."; $text = iconv_substr($text, 0,$num, "UTF-8")."..."; return $text; } else { return $text; }; } /** * parse_pseudo_functions( string ) -> string * * Will parse: * ==( function [, arg1 [, arg2 [, ... ] ] ] )== * ...as function calls within a string. * All args will be passed to the function as strings! */ function parse_pseudo_functions( $input, $callback = FALSE ) { if ( $callback ) { // split into two parts on the first comma $input = array_map( 'trim', explode( ',', $input, 2 ) ); // grab the function name $func = array_shift( $input ); // any arguments? grab them as well $args = 1 === count( $input ) ? explode( ',', array_shift( $input ) ) : array(); // if function exists, return it with the trimmed arguments // otherwise rejoin arguments on comma and return them return function_exists( $func ) ? call_user_func_array( $func, array_map( 'trim', $args ) ) : implode( ',', $args ); } return preg_replace( '/\[\[(.*?)\]\]/se', 'parse_pseudo_functions( \'\1\', TRUE )', $input ); } function youtube($youtub,$w=500,$h=281) { $html=" <iframe width=\"$w\" height=\"$h\" src=\"http://www.youtube.com/embed/$youtub?rel=0\" frameborder=\"0\" allowfullscreen></iframe> "; //<object width=\"$w\" height=\"$h\"><param name=\"movie\" value=\"http://www.youtube.com/v/$youtub?version=3&hl=th_TH\"></param><param name=\"allowFullScreen\" value=\"true\"></param><param name=\"allowscriptaccess\" value=\"always\"></param><embed src=\"http://www.youtube.com/v/$youtub?version=3&hl=th_TH\" type=\"application/x-shockwave-flash\" width=\"$w\" height=\"$h\" allowscriptaccess=\"always\" allowfullscreen=\"true\"></embed></object> return $html; } /* function youtube($var,$var2){ $str="FUNCTION_".$var.'--'.$var2; return $str; } $string = " [[youtube,2,3]] <br> [youtube,2,3] "; $string = parse_pseudo_functions( $string ); echo $string; */ // โหลดข้อมูลโดยใส่ ID function func_id($number){ global $db; $rs=$db->Query("SELECT * FROM tour LEFT JOIN time_schedule1 ON tour.id=time_schedule1.tour_id WHERE tour.id='$number' AND time_schedule1.sp_start_date>".time()." AND active = 'Yes' AND tour.wonderfulpackage='1' GROUP BY tour.id ORDER BY binary country ASC"); //print_r($db); if($db->NumRows()==0){ $html.="<br><Br>ยังไม่มีโปรแกรมทัวร์นี่ค่ะ<br><br>"; } while($data=mysql_fetch_array($rs)){ if($data['promotion']=='Yes'){ $promotion_icon="<img src=images/promotion.gif>"; }else{ $promotion_icon='';} if($data['hot']=='Yes'){ $hot_icon="<img src=images/hot.gif>"; }else{ $hot_icon='';} $html.="<div class=\"box_programtour\"> <table onmouseover=\"this.bgColor='#F5F5F5';\" onmouseout=\"this.bgColor='';\" style=\"width:100%; padding:5px;\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr> <td width=\"170\" rowspan=\"4\" valign=\"top\" style=\"width:160px; height:120px;\"><a style=\"color:#00AEEF;\" href=\"http://www.wonderfulpackage.com/ViewTour-{$data['tour_id']}-{$data['name']}.html\" target=\"_blank\"><img style=\"border:solid 1px #1EB8F5; background-color:#FFFFFF; padding:4px;\" src=\"tour/thumbs/{$data['photo']}\" width=\"160\" height=\"120\" border=0 title=\"{$data['name']}\"/></a></td> <td valign=\"top\" style=\"padding:0 10px 0 15px;font-size:0.9em; width:100%;\"><span style=\"color: #00AEEF; font-size:16px; font-weight:bold;\"> <a class=\"link\" href=\"http://www.wonderfulpackage.com/ViewTour-{$data['tour_id']}-{$data['name']}.html\" target=\"_blank\"> {$data['name']} </a> {$promotion_icon} {$hot_icon}</span></td> <td width=\"128\" rowspan=\"4\" valign=\"top\"><table width=\"128\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr> <td style=\"background:url(http://diamondshine.co.th/images/program_tour_icon_plane.png ) no-repeat;\"><img align=\"right\" src=\"http://www.wonderfulpackage.com/airlineicons/".strtoupper($data['airline']).".jpg\" width=\"101\" height=\"45\" /></td> </tr> <tr> <td height=\"45\"> </td> </tr> <tr> <td height=\"34\" style=\"background:url(http://diamondshine.co.th/images/program_tour_bt_price.png) no-repeat; padding:3px 0 0 58px; font-weight:bold; font-size:20px; color: #FF0000; height:24px;\">".number_format($data['cost'])."</td> </tr> </table> </td> </tr> <tr> <td valign=\"top\" style=\"padding:0 10px 0 15px;\"><span style=\"color: #d42053; font-size:12px; margin-right:20px;\"><strong>จำนวนที่รับ: {$data['numbooking']} สายการบิน {$data['airline']} จำนวนวัน: {$data['no_day']} วัน</strong></span></td> </tr> <tr> <td valign=\"top\" style=\"padding:0 10px 0 15px;\"><span style=\"color: #555555; font-size:12px; font-weight:normal;\">{$data[title]}</span></td> </tr> </table> </div>"; }//end while //$country=$data['country']; return $html; }// จบ โหลดข้อมูลโดย ID // โหลดข้อมูลโดยใส่ Tags function func_ByTags($country,$tags,$num){ global $db; $html.="<table width=\"100%\" border=\"0\"> <tr> <td colspan=\"3\" style=\"padding-bottom: 5px; padding-left: 5px; width: 650px; padding-right: 0px; background: #f39; padding-top: 5px; color:#FFFFFF; font-size:16px; font-weight:bold;\"> โปรแกรมทัวร์แนะนำ $tags : </td> </tr> </table>"; $rs=$db->Query("SELECT * FROM tour LEFT JOIN time_schedule1 ON tour.id=time_schedule1.tour_id WHERE tour.step_line LIKE '%$tags%' AND time_schedule1.sp_start_date>".time()." AND tour.country='".strtoupper($country)."' AND active = 'Yes' AND tour.wonderfulpackage='1' GROUP BY tour.id ORDER BY time_schedule1.timeupdate DESC LIMIT 0 , $num"); //print_r($db); if($db->NumRows()==0){ $html.="<br><Br>ยังไม่มีโปรแกรมทัวร์นี่ค่ะ<br><br>"; } while($data=mysql_fetch_array($rs)){ if($data['cost']=='' OR $data['tour_id'] ==''){ $cost='<i style="font-size:10px">ติดต่อสอบถาม</i>'; }else{ $cost=number_format($data['cost']); } if($data['promotion']=='Yes'){ $promotion_icon="<img src=images/promotion.gif>"; }else{ $promotion_icon='';} if($data['hot']=='Yes'){ $hot_icon="<img src=images/hot.gif>"; }else{ $hot_icon='';} $html.="<div class=\"box_programtour\"> <table onmouseover=\"this.bgColor='#F5F5F5';\" onmouseout=\"this.bgColor='';\" style=\"width:100%; padding:5px;\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr> <td width=\"170\" rowspan=\"4\" valign=\"top\" style=\"width:160px; height:120px;\"><a style=\"color:#00AEEF;\" href=\"http://www.wonderfulpackage.com/ViewTour-{$data['id']}-{$data['name']}.html\" target=\"_blank\"><img style=\"border:solid 1px #1EB8F5; background-color:#FFFFFF; padding:4px;\" src=\"tour/thumbs/{$data['photo']}\" width=\"160\" height=\"120\" border=0 title=\" {$data['name']}\"/></a></td> <td valign=\"top\" style=\"padding:0 10px 0 15px;font-size:0.9em; width:100%;\"><span style=\"color: #00AEEF; font-size:16px; font-weight:bold;\"> <a class=\"link\" href=\"http://www.wonderfulpackage.com/ViewTour-{$data['id']}-{$data['name']}.html\" target=\"_blank\"> {$data['name']} </a> {$promotion_icon} {$hot_icon}</span></td> <td width=\"128\" rowspan=\"4\" valign=\"top\"><table width=\"128\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr> <td style=\"background:url(http://diamondshine.co.th/images/program_tour_icon_plane.png ) no-repeat;\"><img align=\"right\" src=\"http://www.wonderfulpackage.com/airlineicons/".strtoupper($data['airline']).".jpg\" width=\"101\" height=\"45\" /></td> </tr> <tr> <td height=\"45\"> </td> </tr> <tr> <td height=\"34\" style=\"background:url(http://diamondshine.co.th/images/program_tour_bt_price.png) no-repeat; padding:3px 0 0 58px; font-weight:bold; font-size:20px; color: #FF0000; height:24px;\">{$cost}</td> </tr> </table> </td> </tr> <tr> <td valign=\"top\" style=\"padding:0 10px 0 15px;\"><span style=\"color: #d42053; font-size:12px; margin-right:20px;\"><strong>จำนวนที่รับ: {$data['numbooking']} สายการบิน {$data['airline']} จำนวนวัน: {$data['no_day']} วัน</strong></span></td> </tr> <tr> <td valign=\"top\" style=\"padding:0 10px 0 15px;\"><span style=\"color: #555555; font-size:12px; font-weight:normal;\">{$data[title]}</span></td> </tr> </table> <table width=\"100%\" border=\"0\"> <tr> <td colspan=\"3\" align=\"center\" style=\"border-bottom:1px dashed #CCCCCC; margin-bottom:10px; height:0px;\"></td> </tr> </table> </div>"; }//end while //$country=$data['country']; return $html; }// จบ โหลดข้อมูลโดย Tags // โหลดข้อมูลโดยใช้สายการบิน function func_loadByAirline($airline,$country,$num){ global $db; $html.="<table width=\"100%\" border=\"0\"> <tr> <td colspan=\"3\" style=\"padding-bottom: 5px; padding-left: 5px; width: 650px; padding-right: 0px; background: #f39; padding-top: 5px; color:#FFFFFF; font-size:16px; font-weight:bold;\"> โปรแกรมทัวร์แนะนำ โดยสายการบิน $airline : </td> </tr> </table>"; $rs=$db->Query("SELECT * FROM tour LEFT JOIN time_schedule1 ON tour.id=time_schedule1.tour_id WHERE tour.airline LIKE '%".strtoupper($airline)."%' AND time_schedule1.sp_start_date>".time()." AND tour.country='".strtoupper($country)."' AND active = 'Yes' AND tour.wonderfulpackage='1' GROUP BY tour.id ORDER BY time_schedule1.timeupdate DESC LIMIT 0 , $num"); //print_r($db); if($db->NumRows()==0){ $html.="<br><Br>ยังไม่มีโปรแกรมทัวร์นี่ค่ะ<br><br>"; } while($data=mysql_fetch_array($rs)){ if($data['cost']=='' OR $data['tour_id'] ==''){ $cost='<i style="font-size:10px">ติดต่อสอบถาม</i>'; }else{ $cost=number_format($data['cost']); } if($data['promotion']=='Yes'){ $promotion_icon="<img src=images/promotion.gif>"; }else{ $promotion_icon='';} if($data['hot']=='Yes'){ $hot_icon="<img src=images/hot.gif>"; }else{ $hot_icon='';} $html.="<div class=\"box_programtour\"> <table onmouseover=\"this.bgColor='#F5F5F5';\" onmouseout=\"this.bgColor='';\" style=\"width:100%; padding:5px;\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr> <td width=\"170\" rowspan=\"4\" valign=\"top\" style=\"width:160px; height:120px;\"><a style=\"color:#00AEEF;\" href=\"http://www.wonderfulpackage.com/ViewTour-{$data['id']}-{$data['name']}.html\" target=\"_blank\"><img style=\"border:solid 1px #1EB8F5; background-color:#FFFFFF; padding:4px;\" src=\"tour/thumbs/{$data['photo']}\" width=\"160\" height=\"120\" border=0 title=\" {$data['name']}\"/></a></td> <td valign=\"top\" style=\"padding:0 10px 0 15px;font-size:0.9em; width:100%;\"><span style=\"color: #00AEEF; font-size:16px; font-weight:bold;\"> <a class=\"link\" href=\"http://www.wonderfulpackage.com/ViewTour-{$data['id']}-{$data['name']}.html\" target=\"_blank\"> {$data['name']} </a> {$promotion_icon} {$hot_icon}</span></td> <td width=\"128\" rowspan=\"4\" valign=\"top\"><table width=\"128\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr> <td style=\"background:url(http://diamondshine.co.th/images/program_tour_icon_plane.png ) no-repeat;\"><img align=\"right\" src=\"http://www.wonderfulpackage.com/airlineicons/".strtoupper($data['airline']).".jpg\" width=\"101\" height=\"45\" /></td> </tr> <tr> <td height=\"45\"> </td> </tr> <tr> <td height=\"34\" style=\"background:url(http://diamondshine.co.th/images/program_tour_bt_price.png) no-repeat; padding:3px 0 0 58px; font-weight:bold; font-size:20px; color: #FF0000; height:24px;\">{$cost}</td> </tr> </table> </td> </tr> <tr> <td valign=\"top\" style=\"padding:0 10px 0 15px;\"><span style=\"color: #d42053; font-size:12px; margin-right:20px;\"><strong>จำนวนที่รับ: {$data['numbooking']} สายการบิน {$data['airline']} จำนวนวัน: {$data['no_day']} วัน</strong></span></td> </tr> <tr> <td valign=\"top\" style=\"padding:0 10px 0 15px;\"><span style=\"color: #555555; font-size:12px; font-weight:normal;\">{$data[title]}</span></td> </tr> </table> <table width=\"100%\" border=\"0\"> <tr> <td colspan=\"3\" align=\"center\" style=\"border-bottom:1px dashed #CCCCCC; margin-bottom:10px; height:0px;\"></td> </tr> </table> </div>"; }//end while //$country=$data['country']; return $html; }// จบ โหลดข้อมูล // โหลดข้อมูลโดยใช้วันที่ function func_loadDate($DateStart,$DateEnd,$country,$text){ global $db; $html.="<table width=\"100%\" border=\"0\"> <tr> <td colspan=\"3\" style=\"padding-bottom: 5px; padding-left: 5px; padding-right: 0px; background: #f39; padding-top: 5px; color:#FFFFFF; font-size:16px; font-weight:bold;\"> โปรแกรมทัวร์ $text : </td> </tr> </table>"; $rs=$db->Query("SELECT * FROM tour LEFT JOIN time_schedule1 ON tour.id=time_schedule1.tour_id WHERE wonderfulpackage = '1' AND time_schedule1.start_date>='$DateStart' AND time_schedule1.start_date<='$DateEnd' AND tour.country='".strtoupper($country)."' AND active = 'Yes' GROUP BY tour.id ORDER BY time_schedule1.timeupdate DESC "); //print_r($db); if($db->NumRows()==0){ $html.="<br><Br>ยังไม่มีโปรแกรมทัวร์นี่ค่ะ<br><br>"; } while($data=mysql_fetch_array($rs)){ if($data['cost']=='' OR $data['tour_id'] ==''){ $cost='<i style="font-size:10px">ติดต่อสอบถาม</i>'; }else{ $cost=number_format($data['cost']); } if($data['promotion']=='Yes'){ $promotion_icon="<img src=images/promotion.gif>"; }else{ $promotion_icon='';} if($data['hot']=='Yes'){ $hot_icon="<img src=images/hot.gif>"; }else{ $hot_icon='';} $html.="<div class=\"box_programtour\"> <table onmouseover=\"this.bgColor='#F5F5F5';\" onmouseout=\"this.bgColor='';\" style=\"width:100%; padding:5px;\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr> <td width=\"170\" rowspan=\"4\" valign=\"top\" style=\"width:160px; height:120px;\"><a style=\"color:#00AEEF;\" href=\"http://www.wonderfulpackage.com/ViewTour-{$data['id']}-{$data['name']}.html\" target=\"_blank\"><img style=\"border:solid 1px #1EB8F5; background-color:#FFFFFF; padding:4px;\" src=\"tour/thumbs/{$data['photo']}\" width=\"160\" height=\"120\" border=0 title=\" {$data['name']}\"/></a></td> <td valign=\"top\" style=\"padding:0 10px 0 15px;font-size:0.9em; width:100%;\"><span style=\"color: #00AEEF; font-size:16px; font-weight:bold;\"> <a class=\"link\" href=\"http://www.wonderfulpackage.com/ViewTour-{$data['id']}-{$data['name']}.html\" target=\"_blank\">$text : {$data['name']} </a> {$promotion_icon} {$hot_icon}</span></td> <td width=\"128\" rowspan=\"4\" valign=\"top\"><table width=\"128\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr> <td style=\"background:url(http://diamondshine.co.th/images/program_tour_icon_plane.png ) no-repeat;\"><img align=\"right\" src=\"http://www.wonderfulpackage.com/airlineicons/".strtoupper($data['airline']).".jpg\" width=\"101\" height=\"45\" /></td> </tr> <tr> <td height=\"45\"> </td> </tr> <tr> <td height=\"34\" style=\"background:url(http://diamondshine.co.th/images/program_tour_bt_price.png) no-repeat; padding:3px 0 0 58px; font-weight:bold; font-size:20px; color: #FF0000; height:24px;\">{$cost}</td> </tr> </table> </td> </tr> <tr> <td valign=\"top\" style=\"padding:0 10px 0 15px;\"><span style=\"color: #d42053; font-size:12px; margin-right:20px;\"><strong>จำนวนที่รับ: {$data['numbooking']} สายการบิน {$data['airline']} จำนวนวัน: {$data['no_day']} วัน</strong></span></td> </tr> <tr> <td valign=\"top\" style=\"padding:0 10px 0 15px;\"><span style=\"color: #555555; font-size:12px; font-weight:normal;\">{$data[title]}</span></td> </tr> </table> <table width=\"100%\" border=\"0\"> <tr> <td colspan=\"3\" align=\"center\" style=\"border-bottom:1px dashed #CCCCCC; margin-bottom:10px; height:0px;\"></td> </tr> </table> </div>"; }//end while //$country=$data['country']; return $html; }// จบ โหลดข้อมูล // โหลดข้อมูลโดยใช้วันที่ function func_loadDate2($DateStart,$DateEnd,$country,$province,$text){ global $db; $html.="<table width=\"100%\" border=\"0\"> <tr> <td colspan=\"3\" style=\"padding-bottom: 5px; padding-left: 5px; padding-right: 0px; background: #f39; padding-top: 5px; color:#FFFFFF; font-size:16px; font-weight:bold;\"> โปรแกรมทัวร์ $text : </td> </tr> </table>"; $rs=$db->Query("SELECT * FROM tour LEFT JOIN time_schedule1 ON tour.id=time_schedule1.tour_id WHERE time_schedule1.start_date>='$DateStart' AND time_schedule1.start_date<='$DateEnd' AND tour.country='".strtoupper($country)."' AND time_schedule1.sp_start_date>".time()." AND tour.province LIKE '%$province%' AND active = 'Yes' AND tour.wonderfulpackage='1' GROUP BY tour.id ORDER BY time_schedule1.timeupdate DESC "); //print_r($db); if($db->NumRows()==0){ $html.="<br><Br>ยังไม่มีโปรแกรมทัวร์นี่ค่ะ<br><br>"; } while($data=mysql_fetch_array($rs)){ if($data['cost']=='' OR $data['tour_id'] ==''){ $cost='<i style="font-size:10px">ติดต่อสอบถาม</i>'; }else{ $cost=number_format($data['cost']); } if($data['promotion']=='Yes'){ $promotion_icon="<img src=images/promotion.gif>"; }else{ $promotion_icon='';} if($data['hot']=='Yes'){ $hot_icon="<img src=images/hot.gif>"; }else{ $hot_icon='';} $html.="<div class=\"box_programtour\"> <table onmouseover=\"this.bgColor='#F5F5F5';\" onmouseout=\"this.bgColor='';\" style=\"width:100%; padding:5px;\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr> <td width=\"170\" rowspan=\"4\" valign=\"top\" style=\"width:160px; height:120px;\"><a style=\"color:#00AEEF;\" href=\"http://www.wonderfulpackage.com/ViewTour-{$data['id']}-{$data['name']}.html\" target=\"_blank\"><img style=\"border:solid 1px #1EB8F5; background-color:#FFFFFF; padding:4px;\" src=\"tour/thumbs/{$data['photo']}\" width=\"160\" height=\"120\" border=0 title=\" {$data['name']}\"/></a></td> <td valign=\"top\" style=\"padding:0 10px 0 15px;font-size:0.9em; width:100%;\"><span style=\"color: #00AEEF; font-size:16px; font-weight:bold;\"> <a class=\"link\" href=\"http://www.wonderfulpackage.com/ViewTour-{$data['id']}-{$data['name']}.html\" target=\"_blank\">$text : {$data['name']} </a> {$promotion_icon} {$hot_icon}</span></td> <td width=\"128\" rowspan=\"4\" valign=\"top\"><table width=\"128\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr> <td style=\"background:url(http://diamondshine.co.th/images/program_tour_icon_plane.png ) no-repeat;\"><img align=\"right\" src=\"http://www.wonderfulpackage.com/airlineicons/".strtoupper($data['airline']).".jpg\" width=\"101\" height=\"45\" /></td> </tr> <tr> <td height=\"45\"> </td> </tr> <tr> <td height=\"34\" style=\"background:url(http://diamondshine.co.th/images/program_tour_bt_price.png) no-repeat; padding:3px 0 0 58px; font-weight:bold; font-size:20px; color: #FF0000; height:24px;\">{$cost}</td> </tr> </table> </td> </tr> <tr> <td valign=\"top\" style=\"padding:0 10px 0 15px;\"><span style=\"color: #d42053; font-size:12px; margin-right:20px;\"><strong>จำนวนที่รับ: {$data['numbooking']} สายการบิน {$data['airline']} จำนวนวัน: {$data['no_day']} วัน</strong></span></td> </tr> <tr> <td valign=\"top\" style=\"padding:0 10px 0 15px;\"><span style=\"color: #555555; font-size:12px; font-weight:normal;\">{$data[title]}</span></td> </tr> </table> <table width=\"100%\" border=\"0\"> <tr> <td colspan=\"3\" align=\"center\" style=\"border-bottom:1px dashed #CCCCCC; margin-bottom:10px; height:0px;\"></td> </tr> </table> </div>"; }//end while //$country=$data['country']; return $html; }// จบ โหลดข้อมูล // โหลดข้อมูลโดยใส่ Tags function func_ByTags2($country,$province,$tags,$num){ global $db; $html.=" <table width=\"100%\" border=\"0\"><tr> <td colspan=\"3\" style=\"padding-bottom: 5px; padding-left: 5px; width: 650px; padding-right: 0px; background: #f39; padding-top: 5px; color:#FFFFFF; font-size:16px; font-weight:bold;\"> โปรแกรมทัวร์แนะนำ $tags : </td> </tr> </table>"; $rs=$db->Query("SELECT * FROM tour LEFT JOIN time_schedule1 ON tour.id=time_schedule1.tour_id WHERE time_schedule1.sp_start_date> ".time()." AND (tour.step_line LIKE '%$tags%' OR tour.province LIKE '%$province%') AND tour.country='".strtoupper($country)."' AND active = 'Yes' AND tour.wonderfulpackage='1' GROUP BY tour.id ORDER BY time_schedule1.timeupdate DESC LIMIT 0 , $num"); //print_r($db); if($db->NumRows()==0){ $html.="<br><Br>ยังไม่มีโปรแกรมทัวร์นี่ค่ะ<br><br>"; } while($data=mysql_fetch_array($rs)){ $id=$data['id']; if($data['cost']=='' OR $data['tour_id'] ==''){ $cost='<i style="font-size:10px">ติดต่อสอบถาม</i>'; }else{ $cost=number_format($data['cost']); } if($data['promotion']=='Yes'){ $promotion_icon="<img src=images/promotion.gif>"; }else{ $promotion_icon=''; } if($data['hot']=='Yes'){ $hot_icon="<img src=images/hot.gif>"; }else{ $hot_icon=''; } $html.="<div class=\"box_programtour\"> <table onmouseover=\"this.bgColor='#F5F5F5';\" onmouseout=\"this.bgColor='';\" style=\"width:100%; padding:5px;\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr> <td width=\"170\" rowspan=\"4\" valign=\"top\" style=\"width:160px; height:120px;\"><a style=\"color:#00AEEF;\" href=\"http://www.wonderfulpackage.com/ViewTour-{$data['id']}-{$data['name']}.html\" target=\"_blank\"><img style=\"border:solid 1px #1EB8F5; background-color:#FFFFFF; padding:4px;\" src=\"tour/thumbs/{$data['photo']}\" width=\"160\" height=\"120\" border=0 title=\" {$data['name']}\"/></a></td> <td valign=\"top\" style=\"padding:0 10px 0 15px;font-size:0.9em; width:100%;\"><span style=\"color: #00AEEF; font-size:16px; font-weight:bold;\"> <a class=\"link\" href=\"http://www.wonderfulpackage.com/ViewTour-{$data['id']}-{$data['name']}.html\" target=\"_blank\"> {$data['name']} </a> {$promotion_icon} {$hot_icon}</span></td> <td width=\"128\" rowspan=\"4\" valign=\"top\"><table width=\"128\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr> <td style=\"background:url(http://diamondshine.co.th/images/program_tour_icon_plane.png ) no-repeat;\"><img align=\"right\" src=\"http://www.wonderfulpackage.com/airlineicons/".strtoupper($data['airline']).".jpg\" width=\"101\" height=\"45\" /></td> </tr> <tr> <td height=\"45\"> </td> </tr> <tr> <td height=\"34\" style=\"background:url(http://diamondshine.co.th/images/program_tour_bt_price.png) no-repeat; padding:3px 0 0 58px; font-weight:bold; font-size:20px; color: #FF0000; height:24px;\">{$cost}</td> </tr> </table> </td> </tr> <tr> <td valign=\"top\" style=\"padding:0 10px 0 15px;\"><span style=\"color: #d42053; font-size:12px; margin-right:20px;\"><strong>จำนวนที่รับ: {$data['numbooking']} สายการบิน {$data['airline']} จำนวนวัน: {$data['no_day']} วัน</strong></span></td> </tr> <tr> <td valign=\"top\" style=\"padding:0 10px 0 15px;\"><span style=\"color: #555555; font-size:12px; font-weight:normal;\">{$data[title]}</span></td> </tr> </table> <table width=\"100%\" border=\"0\"> <tr> <td colspan=\"3\" align=\"center\" style=\"border-bottom:1px dashed #CCCCCC; margin-bottom:10px; height:0px;\"></td> </tr> </table> </div>"; }//end while //$country=$data['country']; return $html; }// จบ โหลดข้อมูลโดย Tags // โหลดข้อมูลโดยใส่ ประเทศ function func_ByCountry($country,$tags,$num){ global $db; $html.="<table width=\"100%\" border=\"0\"> <tr> <td colspan=\"3\" style=\"padding-bottom: 5px; padding-left: 5px; width: 650px; padding-right: 0px; background: #f39; padding-top: 5px; color:#FFFFFF; font-size:16px; font-weight:bold;\"> โปรแกรมทัวร์แนะนำ $tags : </td> </tr> </table>"; $rs=$db->Query("SELECT * FROM tour LEFT JOIN time_schedule1 ON tour.id=time_schedule1.tour_id WHERE tour.country='".strtoupper($country)."' AND active = 'Yes' AND time_schedule1.sp_start_date>".time()." AND tour.wonderfulpackage='1' GROUP BY tour.id ORDER BY time_schedule1.timeupdate DESC LIMIT 0 , $num"); //print_r($db); if($db->NumRows()==0){ $html.="<br><Br>ยังไม่มีโปรแกรมทัวร์นี่ค่ะ<br><br>"; } while($data=mysql_fetch_array($rs)){ if($data['cost']=='' OR $data['tour_id'] ==''){ $cost='<i style="font-size:10px">ติดต่อสอบถาม</i>'; }else{ $cost=number_format($data['cost']); } if($data['promotion']=='Yes'){ $promotion_icon="<img src=images/promotion.gif>"; }else{ $promotion_icon='';} if($data['hot']=='Yes'){ $hot_icon="<img src=images/hot.gif>"; }else{ $hot_icon='';} $html.="<div class=\"box_programtour\"> <table onmouseover=\"this.bgColor='#F5F5F5';\" onmouseout=\"this.bgColor='';\" style=\"width:100%; padding:5px;\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr> <td width=\"170\" rowspan=\"4\" valign=\"top\" style=\"width:160px; height:120px;\"><a style=\"color:#00AEEF;\" href=\"http://www.wonderfulpackage.com/ViewTour-{$data['id']}-{$data['name']}.html\" target=\"_blank\"><img style=\"border:solid 1px #1EB8F5; background-color:#FFFFFF; padding:4px;\" src=\"tour/thumbs/{$data['photo']}\" width=\"160\" height=\"120\" border=0 title=\" {$data['name']}\"/></a></td> <td valign=\"top\" style=\"padding:0 10px 0 15px;font-size:0.9em; width:100%;\"><span style=\"color: #00AEEF; font-size:16px; font-weight:bold;\"> <a class=\"link\" href=\"http://www.wonderfulpackage.com/ViewTour-{$data['id']}-{$data['name']}.html\" target=\"_blank\"> {$data['name']} </a> {$promotion_icon} {$hot_icon}</span></td> <td width=\"128\" rowspan=\"4\" valign=\"top\"><table width=\"128\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr> <td style=\"background:url(http://diamondshine.co.th/images/program_tour_icon_plane.png ) no-repeat;\"><img align=\"right\" src=\"http://www.wonderfulpackage.com/airlineicons/".strtoupper($data['airline']).".jpg\" width=\"101\" height=\"45\" /></td> </tr> <tr> <td height=\"45\"> </td> </tr> <tr> <td height=\"34\" style=\"background:url(http://diamondshine.co.th/images/program_tour_bt_price.png) no-repeat; padding:3px 0 0 58px; font-weight:bold; font-size:20px; color: #FF0000; height:24px;\">{$cost}</td> </tr> </table> </td> </tr> <tr> <td valign=\"top\" style=\"padding:0 10px 0 15px;\"><span style=\"color: #d42053; font-size:12px; margin-right:20px;\"><strong>จำนวนที่รับ: {$data['numbooking']} สายการบิน {$data['airline']} จำนวนวัน: {$data['no_day']} วัน</strong></span></td> </tr> <tr> <td valign=\"top\" style=\"padding:0 10px 0 15px;\"><span style=\"color: #555555; font-size:12px; font-weight:normal;\">{$data[title]}</span></td> </tr> </table> <table width=\"100%\" border=\"0\"> <tr> <td colspan=\"3\" align=\"center\" style=\"border-bottom:1px dashed #CCCCCC; margin-bottom:10px; height:0px;\"></td> </tr> </table> </div>"; }//end while //$country=$data['country']; return $html; }// จบ โหลดข้อมูลโดย Tags function time_tour($TourID){ global $db; $i=1; $tour=$db->Query("SELECT tour_id,sp_start_date,checkM AS M FROM time_schedule1 WHERE tour_id='{$TourID}' AND sp_start_date>".time()." GROUP BY M ORDER BY sp_start_date ASC "); while($x=mysql_fetch_array($tour)) { if($i%2==0){ $c='style="background-color:#f7f6f6; padding:2px;"'; }else{ $c=' style=\" padding:2px;\"'; } $mounth =$x['M']; $mouth= month2($mounth); $html .= '<table style="background-color:#ebebeb; font-size:12px; color:#333;" width="100%" border="0" cellspacing="0" cellpadding="0">'; $html .="<tr> <td width=\"20%\" $c> เดือน{$mouth}</td> <td width=\"80%\" $c>"; $day=$db->Query("SELECT * FROM time_schedule1 WHERE tour_id='$TourID' AND sp_start_date>".time()." AND checkM = $mounth ORDER BY sp_start_date ASC"); while($d=mysql_fetch_array($day)) { if($d[comment]!=""){ $html .="<span style=\"color:#F00;\"> {$d[comment]}</span>"; }else{ $html .=""; } $html .= "".Wonderful_Schedule($d[start_date],$d[end_date]).$comment.","; } //while $html .="</td> </tr>"; $html .= '</table>'; $i++; }//while if($i%2==0){ $c='style="background-color:#f7f6f6; padding:2px;"'; }else{ $c=''; } $ckhallcom=$db->getDataOneRow('time_schedule_comment',$TourID,'tour_id'); if($ckhallcom[tour_id]!=""){ $html .= '<table style="background-color:#ebebeb; font-size:12px; color:#333;" width="100%" border="0" cellspacing="0" cellpadding="0">'; $html .="<tr><td colspan=\"3\" align=\"center\" $c> <span style=\"color:#F00;\">{$ckhallcom[detail]} </span></td></tr>"; $html .= '</table>'; } return $html; } ?>