| Server IP : 27.254.152.13 / Your IP : 216.73.217.38 Web Server : Apache/2 System : Linux ns1-252017.dragonhispeed.com 5.2.0 #1 SMP Fri Mar 29 22:50:14 MSK 2024 x86_64 User : coloflew ( 1072) PHP Version : 5.6.40 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/coloflew/domains/fulltion.com/public_html/lib/class/ |
Upload File : |
<?php
class SC_Master extends SC_Query {
function flash_script($part_file="",$width="",$height=""){
if($part_file and $width and $height){
echo '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="',$width,'" height="',$height,'">
<param name="movie" value="',$part_file,'" />
<param name="quality" value="high" />
<param name="allowScriptAccess" value="always" />
<param name="wmode" value="transparent">
<embed src="',$part_file,'"
quality="high"
type="application/x-shockwave-flash"
WMODE="transparent"
width="',$width,'"
height="',$height,'"
pluginspage="http://www.macromedia.com/go/getflashplayer"
allowScriptAccess="always" />
</object>';
}else{
echo "<script>alert('กรุณาใส่ paramiter ของ function flash_script ให้ครบ');</script>";
}
}
//var $conn;
function deleteFiles($path, $del_img, $del_thumb){
if($path && $del_img){
//if($del_thumb) unlink("$path/thumb_$del_img");
return unlink("$path/$del_img");
}
}
function uploadImage( $type, $path, $fild,$fname,$arrFile=array(),$old_name="",$thumnelwid=array()){
$chkfiles=$arrFile[$fild]['name']; // image file
if($chkfiles){
$filesize=$arrFile[$fild]['size']; //size image
if($type=="image"){$file_size=IMAGE_SIZE;}else{$file_size=FILE_SIZE;}
//if($filesize<=$file_size){
$filesend=$chkfiles;
$countfilesend=strlen($filesend)-1;
$start=$countfilesend-2;
$surfile=strtolower(substr($filesend,$start,$countfilesend)); // �Ѵ��ҹ��ʡ������Ҿ jpg , gif , png
if($type=="image"){
$arrType=explode(",", IMAGE_TYPE);
}else if($type=="file"){
$arrType=explode(",", FILE_TYPE);
}
$chk_surfile=0;
foreach ($arrType as $key => $val) { // �礹��ʡ������Ҿ��ҵç�Ѻ����˹�������ͻ���
if(trim($val)==$surfile){
$surf = $surfile;
$chk_surfile=1;
}
}
if( $old_name !="" ){ $filename = $old_name; }else{ $filename = $fname.".$surf"; } //
//echo $fname;
if($filename && $chk_surfile){
copy($arrFile[$fild]['tmp_name'],"$path/$filename"); // ��Ҵ����ٻ��ԧ
$target = "$path/$filename";
$source = "$path/thumbs/$filename";
$width = $thumnelwid['width'];
$height = $thumnelwid['hight'];
$quality = 75;
$size = getimagesize($target);
// scale evenly
$ratio = $size[0] / $size[1];
if ($ratio >= 1){
$scale = $width / $size[0];
} else {
$scale = $height / $size[1];
}
// make sure its not smaller to begin with!
if ($width >= $size[0] && $height >= $size[1]){
$scale = 1;
}
switch($surfile) {
case 'gif':
$im_in = imagecreatefromgif ($target);
break;
case 'jpg':
$im_in = imagecreatefromjpeg ($target);
break;
case 'png':
$im_in = imagecreatefrompng ($target);
break;
}
if($surfile=="gif" || $surfile=="jpg" || $surfile=="png"){
$im_out = imagecreatetruecolor($width, $height);
imagecopyresampled($im_out, $im_in, 0, 0, 0, 0, $width, $height, $size[0], $size[1]);
imagejpeg($im_out, $source, $quality); // image size 48*48
}
}
return $filename;
}
}
function uploadFiles( $type, $path, $fild, $fix, $arrThumb, $arrFile=array(),$old_name="" ){
$chkfiles=$arrFile[$fild]['name'];
if($chkfiles){
$filesize=$arrFile[$fild]['size'];
if($type=="image"){$file_size=IMAGE_SIZE;}else{$file_size=FILE_SIZE;}
if($filesize<=$file_size){
$filesend=$chkfiles;
$countfilesend=strlen($filesend)-1;
$start=$countfilesend-2;
$surfile=strtolower(substr($filesend,$start,$countfilesend));
if($type=="image"){
$arrType=explode(",", IMAGE_TYPE);
}else if($type=="file"){
$arrType=explode(",", FILE_TYPE);
}
$chk_surfile=0;
foreach ($arrType as $key => $val) {
if(trim($val)==$surfile){$chk_surfile=1;}
}
if( $old_name !="" ){ $n_img = $old_name; }else{ $n_img = time(); }
$filename="$fix".$n_img."." . $surfile;
if($filename && $chk_surfile){
$uploaded=copy($arrFile[$fild]['tmp_name'],"$path/$filename");
}}
return $filename;
}
}
function viewPages($page, $arrayData, $show="") {
$page=($page ? $page : 1);
if(!$show){
$perpage = 15;
}else{
$perpage = $show;
}
$cPage = count($arrayData);
//echo "<pre>"; print_r($cPage);
$p1 = ($cPage/ $perpage);
$p2 =floor($p1);
$p3 = $p1-$p2;
if($p3 > 0){
$pages = floor($cPage/ $perpage)+1;
}else{
$pages = $p1;
}
$countPage = $pages;
if($countPage > 10){
if($page>=6 && $page<=($countPage-4)) {
$startPage = $page-5;
$endPage = $page+4;
}else if($page>($countPage-4)) {
$startPage = $countPage-9;
$endPage = $countPage;
}else if($page<6) {
$startPage = 1;
$endPage = 10;
}
}else{
$startPage = 1;
$endPage = $countPage;
}
if ($pages * $perpage < $cPage){
++$pages;
}
if($page < 1) {
$page = 1;
}else{
if ($page > $pages) {
$page = $pages;
}
}
if(!($page * $perpage)){
$offset = 0;
}else{
$offset = ($page * $perpage) - $perpage;
}
$arrRet["offset"]=" LIMIT $offset,$perpage";
$arrRet["startPage"]=$startPage;
$arrRet["endPage"]=$endPage;
$arrRet["allpage"]=$pages;
//echo "<pre>"; print_r($arrRet);
return $arrRet;
}
function dateFormat($lang="th", $date="", $type="0") {
if($date){
$day=date("j",$date);
$month=date("n",$date);
$year=date("Y",$date);
// Th
if($lang=="th"){
$month=(int)$month-1;
$year=$year;
if($type=="1"){
$thaimonth=array("มกราคม", "กุมภาพันธ์", "มีนาคม", "เมษายน", "พฤษภาคม", "มิถุนายน", "กรกฎาคม", "สิงหาคม", "กันยายน", "ตุลาคม", "พฤศจิกายน", "ธันวาคม");
}else{
$thaimonth=array("ม.ค","ก.พ.","มี.ค.","เม.ย.","พ.ค.","มิ.ย.","ก.ค.","ส.ค.","ก.ย.","ต.ค.","พ.ย.","ธ.ค.");
}
$month=$thaimonth[$month];
// En
}else{
if($type=="1"){
$month=date("F",$date);
}else{
$month=date("M",$date);
}
}
return(int)$day." ".$month." ".$year;
}else{
return "-";
}
}
// add new function 8/09/2010
function getTimeSamp($time){
$SHORT_MONTH = array(
"Jan" => "01",
"Feb" => "02",
"Mar" => "03",
"Apr" => "04",
"May" => "05",
"Jun" => "06",
"Jul" => "07",
"Aug" => "08",
"Sep" => "09",
"Oct" => "10",
"Nov" => "11",
"Dec" => "12"
);
$arrDT = @explode(" ",$time);
$dd = $arrDT[0];
$mm = $SHORT_MONTH[$arrDT[1]];
$yy = $arrDT[2];
$dt = "$yy-$mm-$dd";
$str_tm = @strtotime($dt);
return $str_tm;
}
function getdateformat($time){
$SHORT_MONTH = array(
"มกราคม" => "01",
"กุมภาพันธ์" => "02",
"มีนาคม" => "03",
"เมษายน" => "04",
"พฤษภาคม" => "05",
"มิถุนายน" => "06",
"กรกฎาคม" => "07",
"สิงหาคม" => "08",
"กันยายน" => "09",
"ตุลาคม" => "10",
"พฤศจิกายน" => "11",
"ธันวาคม" => "12"
);
if($time!=""){
$arrDT = @explode(" ",$time);
if(strlen($arrDT[0]) < 2)
{
$arrDT[0] = "0".$arrDT[0];
}
$dd = $arrDT[0];
$mm = $SHORT_MONTH[$arrDT[1]];
$yy = $arrDT[2];
$dt = "$yy-$mm-$dd";
$str_tm = $dt;
return $str_tm;
}else{return "0000-00-00";}
}
function getdbdateformat($time,$lang='1'){
//echo "<pre>";print_r($time);
$SHORT_MONTH = array(
"01" => "Jan",
"02" => "Feb",
"03"=> "Mar",
"04" => "Apr",
"05" => "May",
"06" => "Jun",
"07" => "Jul",
"08" => "Aug",
"09" => "Sep",
"10" => "Oct",
"11" => "Nov",
"12" => "Dec"
);
$SHORT_MONTH_TH = array(
"01" => "มกราคม",
"02" => "กุมภาพันธ์",
"03"=> "มีนาคม",
"04" => "เมษายน",
"05" => "พฤษภาคม",
"06" => "มิถุนายน",
"07" => "กรกฎาคม",
"08" => "สิงหาคม",
"09" => "กันยายน",
"10" => "ตุลาคม",
"11" => "พฤศจิกายน",
"12" => "ธันวาคม"
);
if($time!="0000-00-00"){
$arrDT = @explode("-",$time);
$yy = $arrDT[0];
$mm = ($lang==1 ? $SHORT_MONTH_TH[$arrDT[1]] : $SHORT_MONTH[$arrDT[1]]);
$dd = (int)$arrDT[2];
$dt = "$dd $mm $yy";
$str_tm = $dt;
return $str_tm;
}else{return ;}
}
function getdbdateformat_barcode($time,$lang='1'){
//echo "<pre>";print_r($time);
$SHORT_MONTH = array(
"01" => "01",
"02" => "02",
"03"=> "03",
"04" => "04",
"05" => "05",
"06" => "06",
"07" => "07",
"08" => "08",
"09" => "09",
"10" => "10",
"11" => "11",
"12" => "12"
);
$SHORT_MONTH_TH = array(
"01" => "01",
"02" => "02",
"03"=> "03",
"04" => "04",
"05" => "05",
"06" => "06",
"07" => "07",
"08" => "08",
"09" => "09",
"10" => "10",
"11" => "11",
"12" => "12"
);
if($time!="0000-00-00"){
$arrDT = @explode("-",$time);
$yy = $arrDT[0];
$mm = ($lang==1 ? $SHORT_MONTH_TH[$arrDT[1]] : $SHORT_MONTH[$arrDT[1]]);
$dd = (int)$arrDT[2];
$dt = "$dd/$mm/$yy";
$str_tm = $dt;
return $str_tm;
}else{return ;}
}
function getreportformat($time){
$SHORT_MONTH = array(
"Jan" => "มกราคม",
"Feb" => "กุมภาพันธ์",
"Mar"=> "มีนาคม",
"Apr" => "เมษายน",
"May" => "พฤษภาคม",
"Jun" => "มิถุนายน",
"Jul" => "กรกฎาคม",
"Aug" => "สิงหาคม",
"Sep" => "กันยายน",
"Oct" => "ตุลาคม",
"Nov" => "พฤศจิกายน",
"Dec" => "ธันวาคม"
);
$arrDT = @explode(" ",$time);
$dd = (int)$arrDT[0];
$mm = $SHORT_MONTH[$arrDT[1]];
$yy = $arrDT[2];
$dt = "$dd $mm $yy";
$str_tm = $dt;
return $str_tm;
}
}
function date_in_period($format, $start, $end, $skip = NULL){
$output = array();
$days = floor((strtotime($end) - strtotime($start))/86400);
for($i=0;$i<=$days;$i++){
$in_period = strtotime("+" . $i . " day", strtotime($start));
if(is_array($skip) and in_array(date("D",$in_period), $skip)){
continue;
}
array_push($output, date($format, $in_period));
}
return $output;
}
function dateDiv($t1,$t2){ // ส่งวันที่ที่ต้องการเปรียบเทียบ ในรูปแบบ มาตรฐาน 2006-03-27 21:39:12
$t1Arr=splitTime($t1);
$t2Arr=splitTime($t2);
$Time1=mktime($t1Arr["h"], $t1Arr["m"], $t1Arr["s"], $t1Arr["M"], $t1Arr["D"], $t1Arr["Y"]);
$Time2=mktime($t2Arr["h"], $t2Arr["m"], $t2Arr["s"], $t2Arr["M"], $t2Arr["D"], $t2Arr["Y"]);
$TimeDiv=abs($Time2-$Time1);
$Time["D"]=intval($TimeDiv/86400); // จำนวนวัน
$Time["H"]=intval(($TimeDiv%86400)/3600); // จำนวน ชั่วโมง
$Time["M"]=intval((($TimeDiv%86400)%3600)/60); // จำนวน นาที
$Time["S"]=intval(((($TimeDiv%86400)%3600)%60)); // จำนวน วินาที
return $Time;
}
function splitTime($time){ // เวลาในรูปแบบ มาตรฐาน 2006-03-27 21:39:12
$timeArr["Y"]= substr($time,2,2);
$timeArr["M"]= substr($time,5,2);
$timeArr["D"]= substr($time,8,2);
$timeArr["h"]= substr($time,11,2);
$timeArr["m"]= substr($time,14,2);
$timeArr["s"]= substr($time,17,2);
return $timeArr;
}
function js_thai_encode($data)
{ // fix all thai elements
if (is_array($data))
{
foreach($data as $a => $b)
{
if (is_array($data[$a]))
{
$data[$a] = js_thai_encode($data[$a]);
}
else
{
$data[$a] = iconv("tis-620","utf-8",$b);
}
}
}
else
{
$data =iconv("tis-620","utf-8",$data);
}
return $data;
}
?>