66 lines
1.7 KiB
PHP
66 lines
1.7 KiB
PHP
<?
|
|
|
|
include getenv("DOCUMENT_ROOT")."/include/session_include.php";
|
|
|
|
|
|
// Level 1 이하만 사용 가능
|
|
$func->checkLevelModal(1);
|
|
|
|
|
|
|
|
|
|
// ################# 차후 uptype 에 따른 if 구분이 필요함
|
|
// echo "[action=$action]";
|
|
// log file upload
|
|
if ($mode == "insert") {
|
|
|
|
$uploaddir = getenv("DOCUMENT_ROOT").'/upload/';
|
|
$upfilename = "20230501_cancel.csv";
|
|
|
|
$existFlag = file_exists($uploaddir.$upfilename);
|
|
|
|
if (!file_exists($uploaddir.$upfilename)) {
|
|
echo "The file ".$uploaddir.$upfilename." does not exist";
|
|
}
|
|
|
|
//$rt = chmod ($uploaddir.$upfilename, 0755);
|
|
|
|
$lineCnt = 1;
|
|
$successRowCnt = 0;
|
|
|
|
if (($handle = fopen($uploaddir.$upfilename, "r")) !== FALSE) {
|
|
while (($getCSV = fgetcsv($handle, 2000, ",")) !== FALSE) {
|
|
|
|
if ($lineCnt >= 2) {
|
|
// Get customer Info
|
|
$d_name = str_replace(" ", "", trim($getCSV[1])); // d_name
|
|
$d_accountno = str_replace(" ", "", trim($getCSV[2])); // d_accountno
|
|
|
|
$qry_customer = "SELECT * FROM tbl_customer WHERE c_accountno = '".$d_accountno."' ";
|
|
$rt_customer = $jdb->fQuery($qry_customer, "query error");
|
|
//echo "[$qry_customer]<br>";
|
|
|
|
if ($rt_customer[0]) $fontColor = "black";
|
|
else $fontColor = "red";
|
|
echo "<font color=$fontColor>[cnt=$lineCnt][ACCOUNTNO=$d_accountno][RNAMEFILE=".$d_name."][RNAMEDB=".$rt_customer['c_name']."]</font><br>";
|
|
|
|
if ($rt_customer[0]) {
|
|
$jdb->nQuery("UPDATE tbl_customer SET c_status='I' WHERE c_accountno = '".$d_accountno."'", "Update error");
|
|
}
|
|
|
|
}
|
|
|
|
//if ($lineCnt == 100) break;
|
|
|
|
$lineCnt++;
|
|
|
|
}
|
|
fclose($handle);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|