- [ETC] 수동 Update 패치 파일 수정 (외부 접근 차단)
This commit is contained in:
Hyojin Ahn 2026-04-21 14:25:15 -04:00
parent cb73f3e8b4
commit 185a9caf3f
6 changed files with 103 additions and 120 deletions

View File

@ -1,5 +1,5 @@
<? <?
/*
include getenv("DOCUMENT_ROOT")."/include/session_include.php"; include getenv("DOCUMENT_ROOT")."/include/session_include.php";
@ -59,7 +59,7 @@ if ($mode == "insert") {
} }
} }
*/
?> ?>

View File

@ -1,5 +1,5 @@
<? <?
/*
////////////// //////////////
// http://goi.ifreshy.com/lib/update_column.php?mode=insert&upfilename=20240405_customer_code.csv&upfield=c_driveruid // http://goi.ifreshy.com/lib/update_column.php?mode=insert&upfilename=20240405_customer_code.csv&upfield=c_driveruid
////////////// //////////////
@ -165,4 +165,5 @@ $time_end = microtime(true);
$timeStr = "Running Time: ".($time_end - $time_start); $timeStr = "Running Time: ".($time_end - $time_start);
echo "####[END][$timeStr]####"; echo "####[END][$timeStr]####";
*/
?> ?>

View File

@ -1,5 +1,5 @@
<? <?
/*
include getenv("DOCUMENT_ROOT")."/include/session_include.php"; include getenv("DOCUMENT_ROOT")."/include/session_include.php";
@ -7,49 +7,6 @@ include getenv("DOCUMENT_ROOT")."/include/session_include.php";
$func->checkLevelModal(1); $func->checkLevelModal(1);
/*
$fpath = getenv("DOCUMENT_ROOT").'/upload';
$ffilemode = "0755";
chmod_R($fpath, 0755);
function chmod_R($path, $filemode) {
if (!is_dir($path))
return chmod($path, $filemode);
$dh = opendir($path);
while (($file = readdir($dh)) !== false) {
if($file != '.' && $file != '..' && $file != 'index.html') {
$fullpath = $path.'/'.$file;
echo "[$fullpath]<br>";
if(is_link($fullpath))
return FALSE;
elseif(!is_dir($fullpath))
if (!chmod($fullpath, $filemode))
return FALSE;
elseif(!chmod_R($fullpath, $filemode))
return FALSE;
}
}
closedir($dh);
if(chmod($path, $filemode))
return TRUE;
else
return FALSE;
}
exit;
*/
/*
$uploaddir = getenv("DOCUMENT_ROOT").'/upload/20120402132706.multi_upload _Status_20120402.csv';
$rt = chmod ($uploaddir, 0755);
$uploaddir = getenv("DOCUMENT_ROOT").'/upload/20120402171526.multi_upload _Status_OOI_20120402_2.csv';
$rt = chmod ($uploaddir, 0755);
exit;
*/
@ -89,23 +46,6 @@ if ($mode == "insert") {
$lineCnt++; $lineCnt++;
/*
// DB에 존재하는 제품인지 확인
$query = "SELECT COUNT(c_uid) FROM tbl_customer WHERE c_accountno = '".trim($getCSV[14])."' ";
$rowCnt = $jdb->rQuery($query, "record query error");
if ($rowCnt == 1) {
echo "<font color=red>Line $lineCnt [".trim($getCSV[14])."] : Same Account No [row:$rowCnt]</font><br>";
$runFlag = 0;
}
if (!is_numeric(trim($getCSV[8])) && strtoupper(trim($getCSV[8])) != "FREE") {
//echo "<font color=red>Line $lineCnt Account No [".trim($getCSV[14])."] Rate = [".trim($getCSV[8])."] : Rate is not digit [row:$rowCnt]</font><br>";
echo "Account No [".trim($getCSV[14])."] Rate = [".trim($getCSV[8])."]<br>";
$runFlag = 0;
}
*/
//$runFlag = 0; //$runFlag = 0;
// $runFlag != 0 인 경우에만 DB에 저장 // $runFlag != 0 인 경우에만 DB에 저장
@ -211,14 +151,6 @@ if ($mode == "insert") {
if (trim($getCSV[26]) == "") $c_schedule = "None"; if (trim($getCSV[26]) == "") $c_schedule = "None";
$values[] = $c_schedule; //$c_schedule $values[] = $c_schedule; //$c_schedule
/*
if(isset($_POST["c_scheduleday"])){
$c_scheduleday_vals ="";
foreach($_POST["c_scheduleday"] as $key => $text_field){
$c_scheduleday_vals .= $text_field ."|";
}
}
*/
$values[] = trim($getCSV[27]); // $c_scheduleday_vals; $values[] = trim($getCSV[27]); // $c_scheduleday_vals;
//$values[] = $c_schedulebasic; //$values[] = $c_schedulebasic;
@ -341,5 +273,5 @@ echo " --------------------------------------------------------------<br><br>";
} // End of Modify Inventory status } // End of Modify Inventory status
*/
?> ?>

View File

@ -1,5 +1,5 @@
<? <?
/*
include getenv("DOCUMENT_ROOT")."/include/session_include.php"; include getenv("DOCUMENT_ROOT")."/include/session_include.php";
@ -61,7 +61,7 @@ if ($mode == "insert") {
} }
} }
*/
?> ?>

View File

@ -1,5 +1,5 @@
<? <?
/*
include getenv("DOCUMENT_ROOT")."/include/session_include.php"; include getenv("DOCUMENT_ROOT")."/include/session_include.php";
@ -7,49 +7,6 @@ include getenv("DOCUMENT_ROOT")."/include/session_include.php";
$func->checkLevelModal(1); $func->checkLevelModal(1);
/*
$fpath = getenv("DOCUMENT_ROOT").'/upload';
$ffilemode = "0755";
chmod_R($fpath, 0755);
function chmod_R($path, $filemode) {
if (!is_dir($path))
return chmod($path, $filemode);
$dh = opendir($path);
while (($file = readdir($dh)) !== false) {
if($file != '.' && $file != '..' && $file != 'index.html') {
$fullpath = $path.'/'.$file;
echo "[$fullpath]<br>";
if(is_link($fullpath))
return FALSE;
elseif(!is_dir($fullpath))
if (!chmod($fullpath, $filemode))
return FALSE;
elseif(!chmod_R($fullpath, $filemode))
return FALSE;
}
}
closedir($dh);
if(chmod($path, $filemode))
return TRUE;
else
return FALSE;
}
exit;
*/
/*
$uploaddir = getenv("DOCUMENT_ROOT").'/upload/20120402132706.multi_upload _Status_20120402.csv';
$rt = chmod ($uploaddir, 0755);
$uploaddir = getenv("DOCUMENT_ROOT").'/upload/20120402171526.multi_upload _Status_OOI_20120402_2.csv';
$rt = chmod ($uploaddir, 0755);
exit;
*/
@ -264,5 +221,5 @@ if ($lineCnt >= 2) {
} // End of Modify Inventory status } // End of Modify Inventory status
*/
?> ?>

View File

@ -0,0 +1,93 @@
<?php
$baseDir = $_SERVER['DOCUMENT_ROOT'] . "/upload/customer_image/";
// 이미지 압축 + 리사이즈 + JPG 변환
function compress($src, $dest, $quality = 75) {
$info = getimagesize($src);
if (!$info) return false;
list($w, $h, $type) = $info;
switch ($type) {
case IMAGETYPE_JPEG:
$img = imagecreatefromjpeg($src);
break;
case IMAGETYPE_PNG:
$img = imagecreatefrompng($src);
break;
case IMAGETYPE_WEBP:
if (!function_exists('imagecreatefromwebp')) return false;
$img = imagecreatefromwebp($src);
break;
default:
return false;
}
if (!$img) return false;
$maxWidth = 1200;
if ($w > $maxWidth) {
$newW = $maxWidth;
$newH = intval(($h / $w) * $newW);
} else {
$newW = $w;
$newH = $h;
}
$tmp = imagecreatetruecolor($newW, $newH);
// PNG / WEBP 투명 처리
if ($type == IMAGETYPE_PNG || $type == IMAGETYPE_WEBP) {
imagealphablending($tmp, false);
imagesavealpha($tmp, true);
$transparent = imagecolorallocatealpha($tmp, 0, 0, 0, 127);
imagefilledrectangle($tmp, 0, 0, $newW, $newH, $transparent);
}
imagecopyresampled($tmp, $img, 0, 0, 0, 0, $newW, $newH, $w, $h);
$result = imagejpeg($tmp, $dest, $quality);
imagedestroy($img);
imagedestroy($tmp);
return $result;
}
// 전체 파일 순회
$rii = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($baseDir));
foreach ($rii as $file) {
if ($file->isDir()) continue;
$path = $file->getPathname();
// 너무 작은 파일 skip
if (filesize($path) < 500000) continue;
$info = pathinfo($path);
// 이미 jpg면 덮어쓰기 방식
if (strtolower($info['extension']) === 'jpg' || strtolower($info['extension']) === 'jpeg') {
echo "Compressing JPG: $path\n";
compress($path, $path);
continue;
}
// 확장자 변경
$newPath = $info['dirname'] . '/' . $info['filename'] . '.jpg';
echo "Converting: $path -> $newPath\n";
if (compress($path, $newPath)) {
// 원본 삭제
unlink($path);
} else {
echo "FAILED: $path\n";
}
}
echo "DONE\n";