| 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/private_html/parcel/lib/class/bg/ |
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 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");
}}
}
if($uploaded){
if(count($arrThumb) && is_array($arrThumb)){
$thumb = new Thumbnail("$path/".$filename."");
//$thumb->resize(250,250);
//$thumb->resizePercent(25);
$thumb->cropFromCenter($arrThumb[w],$arrThumb[h]);
//$thumb->show(100);
//$thumb->destruct();
if($arrThumb[tb]=="1"){
$thumb->save("$path/".$filename."",100);
}else if($arrThumb[tb]=="2"){
$thumb->save("$path/thumb_".$filename."",100);
}
}
return $filename;
}
}
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;
}
$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 uploadImage_arr( $type, $path, $fild,$fname,$arrFile=array(),$old_name="",$thumnelwid=array(),$key){
// echo $key; exit();
$chkfiles=$arrFile[$fild]['name'][$key]; // image file
if($chkfiles){
$filesize=$arrFile[$fild]['size'][$key]; //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'][$key],"$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;
}
$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 multi_uploadFiles( $type, $path, $fild, $fix, $arrThumb, $arrFile=array(),$old_name="",$keyr){
$chkfiles=$arrFile[$fild]['name'][$keyr];
if($chkfiles){
$filesize=$arrFile[$fild]['size'][$keyr];
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 = $fix.time().".".$surfile; }
$filename=$n_img;
if($filename && $chk_surfile){
$uploaded=move_uploaded_file($arrFile[$fild]['tmp_name'][$keyr],$path."/".$filename);
}
}
}
if($uploaded){
if(count($arrThumb) && is_array($arrThumb)){
$thumb = new Thumbnail($path."/".$filename."");
//$thumb->resize(250,250);
//$thumb->resizePercent(25);
$thumb->cropFromCenter($arrThumb[w],$arrThumb[h]);
//$thumb->show(100);
//$thumb->destruct();
if($arrThumb[tb]=="1"){
$thumb->save($path."/".$filename."",100);
}else if($arrThumb[tb]=="2"){
$thumb->save($path."/thumb_".$filename."",100);
}
}
return $filename;
}
}
function uploadFilesdownload( $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-3;
//$countfilesend=strlen($filesend)-1;
$countfilesend=strlen($filesend)-1;
$show=explode(".",$filesend); //test
$countplode=strlen($show[1])-1;
$start=$countfilesend-$countplode;
//echo "<pre>"; print_r($start); exit;
//$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 = $fix."".time().".".$surfile; }
$filename=$n_img ;
if($filename && $chk_surfile){
$uploaded=move_uploaded_file($arrFile[$fild]['tmp_name'],$path."/".$filename);
}
//echo $filename."/".$chk_surfile;
}
}
if($uploaded){
if(count($arrThumb) && is_array($arrThumb)){
$thumb = new Thumbnail($path."/".$filename."");
//$thumb->resize(250,250);
//$thumb->resizePercent(25);
$thumb->cropFromCenter($arrThumb[w],$arrThumb[h]);
//$thumb->show(100);
//$thumb->destruct();
if($arrThumb[tb]=="1"){
$thumb->save($path."/".$filename."",100);
}else if($arrThumb[tb]=="2"){
$thumb->save($path."/thumb_".$filename."",100);
}
}
//exit;
return $filename;
}
}
function getProvince() {
return $this->getAll( "pola_province", "*","" );
}
function getLocation() {
return $this->getAll( "pola_location", "*", "" );
}
function getProvince_Location() {
$arrRet = $this->getJoin( "prov.province_id, loca.location_id, prov.name_th AS pnameth, prov.name_en AS pnameen, loca.name_th AS lnameth, loca.name_en AS lnameen, prov.status AS pstatus, loca.status AS lstatus ", "pola_province prov INNER JOIN pola_location loca ON prov.location_id = loca.location_id", "" );
return $arrRet;
}
function viewMessage($txt, $link) {
print("<table border='0' align='' cellpadding=3 cellspacing=0 width=100%>");
print("<tr >");
print("<td valign=middle align='center' height=150><B style='color:red; font-size:15px;' >".$txt."</B></td>");
print("</tr>");
print("</table>");
if($link) print("<meta http-equiv='refresh' content='3;URL=".$link."'>");
}
function viewPages($page, $arrayData, $show="") {
$page=($page ? $page : 1);
if(!$show){
$perpage = 15;
}else{
$perpage = $show;
}
$cPage = count($arrayData);
$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;
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+543;
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",
"Mar" => "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 fn_crop_file($path,$filename,$width_in,$high_in){ //,
$arrname_file=explode(".",$filename);
$name=$arrname_file[0];
$surfile=$arrname_file[1];
$source = "$path/$filename";
//$width = $max_image_width;
$width=$width_in;
$height = $high_in ;
// $height = $max_image_height ;
// echo $size[0]; exit;
$target = "$path/crop/$filename";
$quality = 100;
$size = getimagesize($source);
// 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 ($source);
break;
case 'jpg':
$im_in = imagecreatefromjpeg ($source);
break;
case 'png':
$im_in = imagecreatefrompng ($source);
break;
}*/
$im_in = imagecreatefromjpeg ($source);
if (file_exists($path.'/'."crop".'/'.$filename)){
unlink ($path.'/'."crop".'/'.$filename);
}
//$im_in = imagecreatefromjpeg ($source);
$im_out = imagecreatetruecolor($width,$height);
imagecopyresampled($im_out, $im_in, 0, 0, 0, 0, $width, $height, $size[0], $size[1]);
// if(file_exists($target)){ imagejpeg($im_out, $target, $quality); }
// else {imagejpeg($im_out, $target, $quality);}
imagejpeg($im_out, $target, $quality);
//}
}
////////////////////////sestion/////////////////////////////////////////////////
function Session ()
{
session_start();
}
function set ( $name, $value )
{
$_SESSION[$name]=$value;
}
function fetch ( $name )
{
if ( isset ( $_SESSION[$name] ) )
return $_SESSION[$name];
else
return false;
}
function varunset ( $name )
{
if ( isset ( $_SESSION[$name] ) ) {
unset ( $_SESSION[$name] );
return true;
} else {
return false;
}
}
function destroy ()
{
$_SESSION = array();
session_destroy();
}
// This function checks if there is login in the database and
// checks if the password is correct if this login exists
function generate_options_listyotin ( $name, $selected = '',$cookie )
{
// global $db;
$sql = 'SELECT * FROM ' . $name . ' WHERE lang_code = "'.$cookie.'" ORDER BY id';
$r = mysql_query ($sql) or ('Critical Error');
$output = '';
while ($f = mysql_fetch_array ($r) )
{
if ($f['id'] == $selected)
$output.= '<option value="'. $f['id'] . '" SELECTED>' . $f['name'] . '</option>';
else
$output.= '<option value="'. $f['id'] . '">' . $f['name'] . '</option>';
}
return $output;
}
function uplodeimg_arr($type, $path, $fild, $fix, $arrFile=array(),$old_name="",$width_in,$high_in,$num,$old_pic){ //,
// global $db;
$chkfiles=$arrFile[$fild]['name'][$num];
if($chkfiles){
$filesize=$arrFile[$fild]['size'][$num];
// if($type=="image"){$file_size=512000;}else{$file_size=5242880;}
//if($filesize<=$file_size){
$filesend=$chkfiles;
$countfilesend=strlen($filesend)-1;
$start=$countfilesend-2;
$surfile=strtolower(substr($filesend,$start,$countfilesend));
if($type=="image"){
$arrType=explode(",", "gif,jpg,png");
}else if($type=="file"){
// $arrType=explode(",", "txt,pdf,doc,zip,rar"); original
$arrType=explode(",", "txt,pdf,doc,rar,html");
}
$chk_surfile=0;
foreach ($arrType as $key => $val) {
if(trim($val)==$surfile){$chk_surfile=1;}
}
//if( $old_name !="" ){ $n_img = time();}else{ $n_img = time(); }
// Remove old jpg files of this user if exist
$filename=$fix.".".$surfile;
if($filename && $chk_surfile){
if($old_pic !=""){
if (file_exists($path.'/'.$old_pic)){
@unlink ($path.'/'.$old_pic);
}
}
if($old_pic !=""){
if (file_exists($path.'/'."thumbs".'/'.$old_pic)) {
@unlink ($path.'/'."thumbs".'/'.$old_pic);
}
}
move_uploaded_file($arrFile[$fild]['tmp_name'][$num],"$path/$filename");
$source = "$path/$filename";
//$width = $max_image_width;
$width=$width_in;
$size= getimagesize($source);
//echo "<pr>"; print_r($size);
if($size[0] < $width){
$width = $size[0];
}
//echo $all_width; exit;
$height = round($width*$size[1]/$size[0]);
$height = $high_in ;
// $height = $max_image_height ;
// echo $size[0]; exit;
$target = "$path/thumbs/$filename";
$quality = 100;
$size = getimagesize($source);
// 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 ($source);
break;
case 'jpg':
$im_in = imagecreatefromjpeg ($source);
break;
case 'png':
$im_in = imagecreatefrompng ($source);
break;
}
//$im_in = imagecreatefromjpeg ($source);
$im_out = imagecreatetruecolor($width,$height);
imagecopyresampled($im_out, $im_in, 0, 0, 0, 0, $width, $height, $size[0], $size[1]);
// if(file_exists($target)){ imagejpeg($im_out, $target, $quality); }
// else {imagejpeg($im_out, $target, $quality);}
imagejpeg($im_out, $target, $quality);
}
}
//exit;
return $filename;
}
function fnupimg_yotin($type, $path, $fild, $fix, $arrFile=array(),$old_name="",$width_in,$high_in,$old_pic){ //,
// global $db;
$chkfiles=$arrFile[$fild]['name'];
if($chkfiles){
$filesize=$arrFile[$fild]['size'];
//if($type=="image"){$file_size=512000;}else{$file_size=5242880;}
//if($filesize<=$file_size){
$filesend=$chkfiles;
$countfilesend=strlen($filesend)-1;
$start=$countfilesend-2;
$surfile=strtolower(substr($filesend,$start,$countfilesend));
if($type=="image"){
$arrType=explode(",", "gif,jpg,png");
}else if($type=="file"){
// $arrType=explode(",", "txt,pdf,doc,zip,rar"); original
$arrType=explode(",", "txt,pdf,doc,rar,html");
}
$chk_surfile=0;
foreach ($arrType as $key => $val) {
if(trim($val)==$surfile){$chk_surfile=1;}
}
//if( $old_name !="" ){ $n_img = time();}else{ $n_img = time(); }
$filename=$fix.".".$surfile;
if($filename && $chk_surfile){
if($old_pic !=""){
if (file_exists($path.'/'.$old_pic)){
unlink ($path.'/'.$old_pic);
}
}
if($old_pic !=""){
if (file_exists($path.'/'."thumbs".'/'.$old_pic)){
unlink ($path.'/'."thumbs".'/'.$old_pic);
}
}
move_uploaded_file($arrFile[$fild]['tmp_name'],"$path/$filename");
$source = "$path/$filename";
//$width = $max_image_width;
$width=$width_in;
$size= getimagesize($source);
//echo "<pr>"; print_r($size);
if($size[0] < $width){
$width = $size[0];
}
//echo $all_width; exit;
$height = round($width*$size[1]/$size[0]);
$height = $high_in ;
// $height = $max_image_height ;
// echo $size[0]; exit;
$target = "$path/thumbs/$filename";
$quality = 100;
$size = getimagesize($source);
// 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 ($source);
break;
case 'jpg':
$im_in = imagecreatefromjpeg ($source);
break;
case 'png':
$im_in = imagecreatefrompng ($source);
break;
}
//$im_in = imagecreatefromjpeg ($source);
$im_out = imagecreatetruecolor($width,$height);
imagecopyresampled($im_out, $im_in, 0, 0, 0, 0, $width, $height, $size[0], $size[1]);
// if(file_exists($target)){ imagejpeg($im_out, $target, $quality); }
// else {imagejpeg($im_out, $target, $quality);}
imagejpeg($im_out, $target, $quality);
}
}
//exit;
return $filename;
}
function uplode_file($type, $path, $fild, $fix, $arrFile=array(),$old_name="",$old_pic=""){ //,
$chkfiles=$arrFile[$fild]['name'];
if($chkfiles){
$filesize=$arrFile[$fild]['size'];
// if($type=="image"){$file_size=512000;}else{$file_size=5242880;}
//if($filesize<=$file_size){
$filesend=$chkfiles;
$countfilesend=strlen($filesend)-1;
$start=$countfilesend-2;
$surfile=strtolower(substr($filesend,$start,$countfilesend));
if($type=="image"){
$arrType=explode(",", "gif,jpg,png");
}else if($type=="file"){
// $arrType=explode(",", "txt,pdf,doc,zip,rar"); original
$arrType=explode(",", "txt,pdf,doc,rar,html");
}else if($type=="video"){
$arrType=explode(",", "avi,wmv,flv,mov,mpg,mp4,mpeg,asf");
}
$chk_surfile=0;
foreach ($arrType as $key => $val) {
if(trim($val)==$surfile){$chk_surfile=1;}
}
//if( $old_name !="" ){ $n_img = time();}else{ $n_img = time(); }
$filename=$fix.".".$surfile;
if($filename && $chk_surfile){
if($old_pic !=""){ //echo $old_pic; exit;
if (file_exists($path.'/'.$old_pic)){
@unlink ($path.'/'.$old_pic);
}
}
if($old_pic !=""){
if (file_exists($path.'/'."thumbs".'/'.$old_pic)){
@unlink ($path.'/'."thumbs".'/'.$old_pic);
}
}
move_uploaded_file($arrFile[$fild]['tmp_name'],"$path/$filename");
}
}
//exit;
return $filename;
}
function upfie_arr($type, $path, $fild, $fix, $arrFile=array(),$old_name="",$width_in,$high_in,$num,$old_pic){ //,
$chkfiles=$arrFile[$fild]['name'][$num];
if($chkfiles){
$filesize=$arrFile[$fild]['size'][$num];
// if($type=="image"){$file_size=512000;}else{$file_size=5242880;}
//if($filesize<=$file_size){
$filesend=$chkfiles;
$countfilesend=strlen($filesend)-1;
$start=$countfilesend-2;
$surfile=strtolower(substr($filesend,$start,$countfilesend));
if($type=="image"){
$arrType=explode(",", "gif,jpg,png");
}else if($type=="file"){
// $arrType=explode(",", "txt,pdf,doc,zip,rar"); original
$arrType=explode(",", "txt,pdf,doc,rar,html");
}
$chk_surfile=0;
foreach ($arrType as $key => $val) {
if(trim($val)==$surfile){$chk_surfile=1;}
}
//if( $old_name !="" ){ $n_img = time();}else{ $n_img = time(); }
$filename=$fix.".".$surfile;
if($filename && $chk_surfile){
if($old_pic !=""){
if (file_exists($path.'/'.$old_pic)){
@unlink ($path.'/'.$old_pic);
}
}
if($old_pic !=""){
if (file_exists($path.'/'."thumbs".'/'.$old_pic)){
@unlink ($path.'/'."thumbs".'/'.$old_pic);
}
}
move_uploaded_file($arrFile[$fild]['tmp_name'][$num],"$path/$filename");
}
}
//exit;
return $filename;
}
}
?>