/home/mjc1/public_html/manage/m_upgrade_process.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?php
include("./_common.php");

if(
$_GET['mode']=='copy'){
    
$code $_GET['code'];
    
$sql "select * from upgrade where uid = '{$code}'";
    
$res mysql_query($sql,$connect_web);
    
$row mysql_fetch_object($res);
    
$set_list "";
    
$copyYN true;

    foreach(
$row as $key=>$val){
        
//2021-12-16 김남수, 공지사항 프로그램 코드 없을 시 복사 안되게 수정
        
if($key=='programCode'){
            if(
$val == null || $val == ''){
                
$copyYN false;
            }
        }
        if(
$key=='up_info_memo'){ $val addslashes($val); }
        if(
$key=='subject'){ $val addslashes($val); }
        if(
$key=='uid'){

        } else {
            
$set_list .= "{$key} = '{$val}',";
        }
    }
    
$set_list substr($set_list,0,strlen($set_list)-1);

    
//2021-12-16 김남수, 공지사항 프로그램 코드 없을 시 복사 안되게 수정
    
if($copyYN == false){
        exit;
    }

    
$sql "insert into upgrade set {$set_list} ";
    
mysql_query($sql,$connect_web);

    echo 
"OK";
    exit;
}

$dir        =   "../save_dir/upgrade/";
function 
file_upload($file,$last_idx){
    Global 
$ADMINID$dir;
    if(
$file['name']!='' && $file['size']>0){
        
$v explode(".",$file['name']);
        
$ext $v[count($v)-1];
        
$body_file_name  ".".$ext;
        if(
$body_file_name == ".php" || $body_file_name == ".html" || $body_file_name == ".cgi" || $body_file_name == ".pl"  || $body_file_name == ".htm" || $body_file_name == ".php3" || $body_file_name == ".php4") {
            return 
"ext_error";
        }
        
$filename  $last_idx."-".$ADMINID."-.".$ext;
     
        
copy($file['tmp_name'] ,$dir.$filename);
        
unlink($file['tmp_name']);  
        return 
$filename;
    }
}

$sql "set names euckr";
mysql_query($sql,$connect_web);

$table "upgrade";

@
extract($_POST);
@
extract($_FILES);

$reg_date strtotime($regdate);

if(
$sel_del=='Y'){ // 선택삭제
    
$uids "";
    foreach(
$code_idx as $key=>$val){
        
$uid $codes[$val];
        
$sql "select * from {$table} where uid = '{$uid}' ";
        
$res mysql_query($sql,$connect_web);
        
$info mysql_fetch_array($res);
        if(
$info['add_file']){
            
unlink($dir.$info['add_file']);
        }
        
$sql "delete from {$table} where uid = '{$uid}' ";
        
mysql_query($sql,$connect_web);
    }

} else if(
$code!=''){ // 업데이트
    
$up_method     addslashes($up_method);  
    
$up_info_memo     addslashes($up_info_memo);  
    
$sql "update {$table} set
                programCode = '
{$programCode}', subject = '{$subject}', version = '{$version}', 
                up_info_memo = '
{$up_info_memo}', up_method = '{$up_method}', hit = '{$hit}', temp = '{$temp}', reg_date = '{$reg_date}'
            where uid = '
$code'
    "
;
    
//_pr($sql); exit;
    
mysql_query($sql,$connect_web);

} else if(
$code==''){ // 신규
    
$up_method     addslashes($up_method);  
    
$up_info_memo     addslashes($up_info_memo);  
    
//$reg_date     =  Time();

    
$sql "insert into {$table} set
                programCode = '
{$programCode}', subject = '{$subject}', version = '{$version}', name = '관리자',
                up_info_memo = '
{$up_info_memo}', up_method = '{$up_method}', hit = '{$hit}', reg_date = '{$reg_date}', temp = '{$temp}'
    "
;
    
mysql_query($sql,$connect_web);
    
$last_idx mysql_insert_id($connect_web);

}
?>
<script>
    document.location.href='m_upgrade.php?<?php echo $qstr;?>';
</script>