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
|
<?php $sub_menu = "100500"; $dir = "."; include_once($dir."/_common.php"); include("./auth_check.php"); // 관리자 권한 체크
function upload_banner($f,$code,$fname){ Global $j3;
$dest = "{$j3['j3_data_path']}/banner/"; if($fname=='bn_file_tab'){ $new_file_name = "banner_tab_{$code}"; } else { $new_file_name = "banner_{$code}"; } @mkdir($dest); @chmod($dest,G5_DIR_PERMISSION); if($f['name']!=''){ move_uploaded_file($f['tmp_name'],$dest.$new_file_name); } }
function delete_banner($code){ Global $j3;
$dest = "{$j3['j3_data_path']}/banner/"; $new_file_name = "banner_{$code}"; @unlink($dest.$new_file_name); }
$bn_map = addslashes($bn_map);
$mode_ok = "Y";
$all_sql = "";
if($sel_del=='Y' && $mode_ok=='Y'){ // 삭제 $mode = "delete"; $code_list = ""; foreach($code_idx as $key=>$val){ $code_list .= "{$codes[$val]},";
delete_banner($codes[$val]); } if($mode_ok=='Y'){ $code_list = substr($code_list,0,strlen($code_list)-1);
update_del_log("shop_banner", "idx", $code_list,"del"); // 삭제 로그 처리 $sql = "delete from shop_banner where idx in ({$code_list}) "; $res = mysql_query($sql,$connect_j3); $all_sql .= $sql; }
} else if($code!='' && $mode_ok=='Y'){ // 수정 $mode = "update";
$sql = "update shop_banner set bn_name = '{$bn_name}', bn_pos = '{$bn_pos}', bn_link = '{$bn_link}', bn_target = '{$bn_target}', bn_sdate = '{$bn_sdate}', bn_edate = '{$bn_edate}', bn_seq = '{$bn_seq}', bn_map = '{$bn_map}' where idx = '{$code}' "; //_pr($sql); exit; mysql_query($sql,$connect_j3); $all_sql .= $sql; update_del_log("shop_banner", "idx", $code,""); // 업데이트 로그 처리
upload_banner($_FILES['bn_file'],$code,"bn_file"); upload_banner($_FILES['bn_file_tab'],$code,"bn_file_tab");
} else if($mode_ok=='Y'){ // 신규 $mode = "new";
$sql = "insert into shop_banner set bn_name = '{$bn_name}', bn_pos = '{$bn_pos}', bn_link = '{$bn_link}', bn_target = '{$bn_target}', bn_sdate = '{$bn_sdate}', bn_edate = '{$bn_edate}', bn_seq = '{$bn_seq}', bn_map = '{$bn_map}', reg_date = now() "; //_pr($sql); exit; $res = mysql_query($sql,$connect_j3); $all_sql .= $sql; $code = mysql_insert_id($connect_j3);
upload_banner($_FILES['bn_file'],$code,"bn_file"); upload_banner($_FILES['bn_file_tab'],$code,"bn_file_tab");
}
//_pr($_POST); exit;
if($mode=='new' || $mode=='update'){ echo "<script>document.location.href='banner.php?{$qstr}';</script>"; } else { echo "<?php xml version='1.0' encoding='utf-8'?><output>"; echo "<mode>".$mode."</mode>"; echo "<mode_ok>".$mode_ok."</mode_ok>"; echo "<rtn_url>".$rtn_url."</rtn_url>"; echo "<msg>".$msg."</msg>"; echo "<after_add>".$after_add."</after_add>"; //echo "<sql>".$all_sql."</sql>"; echo "</output>"; }
?>
|