$up_thumbFile = $g['path_tmp'] . 'backup/' . $up_thumbname; ResizeWidth($_FILES['upfile']['tmp_name'][$i], $up_thumbFile, 150); $IM = getimagesize($_FILES['upfile']['tmp_name'][$i]); $width = $IM[0]; $height = $IM[1]; ftp_put($FTP_CONNECT, $d['upload']['ftp_folder'] . $up_folder . '/' . $up_thumbname, $up_thumbFile, FTP_BINARY); unlink($up_thumbFile); } ftp_put($FTP_CONNECT, $d['upload']['ftp_folder'] . $up_folder . '/' . $up_tmpname, $_FILES['upfile']['tmp_name'][$i], FTP_BINARY); } else { if (!is_file($up_saveFile)) { move_uploaded_file($_FILES['upfile']['tmp_name'][$i], $up_saveFile); if ($up_type == 2) { $up_thumbname = md5($up_tmpname); $up_thumbFile = $savePath3 . '/' . $up_thumbname; ResizeWidth($up_saveFile, $up_thumbFile, 150); @chmod($up_thumbFile, 0707); $IM = getimagesize($up_saveFile); $width = $IM[0]; $height = $IM[1]; } @chmod($up_saveFile, 0707); } } $QKEY = "gid,hidden,tmpcode,site,mbruid,type,ext,fserver,url,folder,name,tmpname,thumbname,size,width,height,caption,down,d_regis,d_update,cync"; $QVAL = "'{$up_gid}','{$up_hidden}','','{$s}','{$mbruid}','{$up_type}','{$up_fileExt}','{$fserver}','{$fserverurl}','{$up_folder}','{$up_name}','{$up_tmpname}','{$up_thumbname}','{$up_size}','{$width}','{$height}','{$up_caption}','0','{$d_regis}','','{$up_cync}'"; getDbInsert($table['s_upload'], $QKEY, $QVAL); $up_lastuid = getDbCnt($table['s_upload'], 'max(uid)', ''); $upload .= '[' . $up_lastuid . ']'; if ($up_type == 2) { if ($fserver) {
$fileExt = $fileExt == 'jpeg' ? 'jpg' : $fileExt; if (strstr('[jpg]', $fileExt)) { $wh = getimagesize($tmpname); if ($wh[0] > 180 && $wh[1] > 180) { $photo = $id . '.' . $fileExt; $saveFile1 = $g['path_var'] . 'avatar/' . $photo; $saveFile2 = $g['path_var'] . 'avatar/180.' . $photo; if (is_file($saveFile1)) { unlink($saveFile1); } if (is_file($saveFile2)) { unlink($saveFile2); } include $g['path_core'] . 'function/thumb.func.php'; move_uploaded_file($tmpname, $saveFile2); ResizeWidth($saveFile2, $saveFile2, 180); ResizeWidthHeight($saveFile2, $saveFile1, 50, 50); @chmod($saveFile1, 0707); @chmod($saveFile2, 0707); } } } } if ($uid) { $_M = getDbData($table['s_mbrdata'], 'memberuid=' . $uid, 'd_regis'); $newPw = getCrypt($pw, $_M['d_regis']); getDbUpdate($table['s_mbrid'], "pw='" . $newPw . "'", 'uid=' . $uid); getDbUpdate($table['s_mbrdata'], "email='{$email}',name='{$name}',nic='{$nic}',photo='{$photo}',tel2='{$tel2}'", 'memberuid=' . $uid); if ($my['uid'] == $uid) { if ($pw != '') { $_SESSION['mbr_pw'] = $newPw;
ftp_put($FTP_CONNECT, $d['upload']['ftp_folder'] . $folder . '/' . $tmpname, $_FILES['Filedata']['tmp_name'], FTP_BINARY); ftp_close($FTP_CONNECT); } else { for ($i = 1; $i < 4; $i++) { if (!is_dir(${'savePath' . $i})) { mkdir(${'savePath' . $i}, 0707); @chmod(${'savePath' . $i}, 0707); } } $saveFile = $savePath3 . '/' . $tmpname; if ($Overwrite == 'true' || !is_file($saveFile)) { move_uploaded_file($_FILES['Filedata']['tmp_name'], $saveFile); if ($type == 2) { $thumbname = md5($tmpname) . '.' . $fileExt; $thumbFile = $savePath3 . '/' . $thumbname; ResizeWidth($saveFile, $thumbFile, 210); @chmod($thumbFile, 0707); $IM = getimagesize($saveFile); $width = $IM[0]; $height = $IM[1]; } @chmod($saveFile, 0707); } } $mingid = getDbCnt($table['s_upload'], 'min(gid)', ''); $gid = $mingid ? $mingid - 1 : 100000000; $QKEY = "gid,hidden,tmpcode,site,mbruid,type,ext,fserver,url,folder,name,tmpname,thumbname,size,width,height,caption,down,d_regis,d_update,cync"; $QVAL = "'{$gid}','{$hidden}','{$tmpcode}','{$s}','{$mbruid}','{$type}','{$fileExt}','{$fserver}','{$url}','{$folder}','{$name}','{$tmpname}','{$thumbname}','{$size}','{$width}','{$height}','{$caption}','{$down}','{$d_regis}','{$d_update}','{$cync}'"; getDbInsert($table['s_upload'], $QKEY, $QVAL); getDbUpdate($table['s_numinfo'], 'upload=upload+1', "date='" . $date['today'] . "' and site=" . $s); if ($gid == 100000000) {
$folder = substr($date['today'], 0, 4) . '/' . substr($date['today'], 4, 2) . '/' . substr($date['today'], 6, 2); // 위 폴더가 없으면 새로 만들기 for ($i = 1; $i < 4; $i++) { if (!is_dir(${'savePath' . $i})) { mkdir(${'savePath' . $i}, 0707); @chmod(${'savePath' . $i}, 0707); } } $saveFile = $savePath3 . '/' . $tmpname; // 생성된 폴더/파일 --> 파일의 실제 위치 if ($Overwrite == 'true' || !is_file($saveFile)) { move_uploaded_file($_FILES["file"]["tmp_name"], $saveFile); if ($type == 2) { $thumbname = md5($tmpname) . '.' . $fileExt; $thumbFile = $savePath3 . '/' . $thumbname; ResizeWidth($saveFile, $thumbFile, 150); @chmod($thumbFile, 0707); $IM = getimagesize($saveFile); $width = $IM[0]; $height = $IM[1]; } @chmod($saveFile, 0707); } $mingid = getDbCnt($table['bbsupload'], 'min(gid)', ''); $gid = $mingid ? $mingid - 1 : 100000000; $QKEY = "gid,hidden,tmpcode,site,mbruid,type,ext,fserver,url,folder,name,tmpname,thumbname,size,width,height,caption,down,d_regis,d_update,cync"; $QVAL = "'{$gid}','{$hidden}','{$tmpcode}','{$s}','{$mbruid}','{$type}','{$fileExt}','{$fserver}','{$url}','{$folder}','{$name}','{$tmpname}','{$thumbname}','{$size}','{$width}','{$height}','{$caption}','{$down}','{$d_regis}','{$d_update}','{$cync}'"; getDbInsert($table['bbsupload'], $QKEY, $QVAL); getDbUpdate($table['s_numinfo'], 'upload=upload+1', "date='" . $date['today'] . "' and site=" . $s); $lastuid = getDbCnt($table['bbsupload'], 'max(uid)', ''); $sourcePath = './modules/bbs' . str_replace('..', '', $savePath3);
} ftp_put($FTP_CONNECT, $d['mediaset']['ftp_folder'] . $folder . '/' . $tmpname, $_FILES['upfiles']['tmp_name'][$i], FTP_BINARY); } else { for ($j = 1; $j < 4; $j++) { if (!is_dir(${'savePath' . $j})) { mkdir(${'savePath' . $j}, 0707); @chmod(${'savePath' . $j}, 0707); } } $saveFile = $savePath3 . '/' . $tmpname; if ($Overwrite == 'true' || !is_file($saveFile)) { move_uploaded_file($_FILES['upfiles']['tmp_name'][$i], $saveFile); if ($type == 2) { $thumbname = md5($tmpname) . '.' . $fileExt; $thumbFile = $savePath3 . '/' . $thumbname; ResizeWidth($saveFile, $thumbFile, $d['mediaset']['thumbsize']); @chmod($thumbFile, 0707); $IM = getimagesize($saveFile); $width = $IM[0]; $height = $IM[1]; } @chmod($saveFile, 0707); } } $mingid = getDbCnt($table['s_upload'], 'min(gid)', ''); $gid = $mingid ? $mingid - 1 : 100000000; $QKEY = "gid,pid,category,hidden,tmpcode,site,mbruid,fileonly,type,ext,fserver,url,folder,name,tmpname,thumbname,size,width,height,alt,caption,description,src,linkto,license,down,d_regis,d_update,sync,linkurl"; $QVAL = "'{$gid}','{$gid}','{$category}','{$hidden}','{$tmpcode}','{$s}','{$mbruid}','{$_fileonly}','{$type}','{$fileExt}','{$fserver}','{$url}','{$folder}','{$name}','{$tmpname}','{$thumbname}','{$size}','{$width}','{$height}','{$alt}','{$caption}','{$description}','{$src}','{$linkto}','{$license}','{$down}','{$d_regis}','{$d_update}','{$sync}','{$linkurl}'"; getDbInsert($table['s_upload'], $QKEY, $QVAL); getDbUpdate($table['s_numinfo'], 'upload=upload+1', "date='" . $date['today'] . "' and site=" . $s); if ($gid == 100000000) {