This repository has been archived by the owner on Jun 24, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
/
categoryformupdate.php
156 lines (139 loc) · 5.65 KB
/
categoryformupdate.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<?php
$sub_menu = '400200';
include_once('./_common.php');
if ($file = $_POST['ca_include_head']) {
if (!preg_match("/\.(php|htm[l]?)$/i", $file)) {
alert("상단 파일 경로가 php, html 파일이 아닙니다.");
}
}
if ($file = $_POST['ca_include_tail']) {
if (!preg_match("/\.(php|htm[l]?)$/i", $file)) {
alert("하단 파일 경로가 php, html 파일이 아닙니다.");
}
}
if ($w == "u" || $w == "d")
check_demo();
auth_check($auth[$sub_menu], "d");
if ($w == 'd' && $is_admin != 'super')
alert("최고관리자만 분류를 삭제할 수 있습니다.");
if ($w == "" || $w == "u")
{
if ($ca_mb_id)
{
$sql = " select mb_id from {$g5['member_table']} where mb_id = '$ca_mb_id' ";
$row = sql_fetch($sql);
if (!$row['mb_id'])
alert("\'$ca_mb_id\' 은(는) 존재하는 회원아이디가 아닙니다.");
}
}
$sql_common = " ca_order = '$ca_order',
ca_skin_dir = '$ca_skin_dir',
ca_mobile_skin_dir = '$ca_mobile_skin_dir',
ca_skin = '$ca_skin',
ca_mobile_skin = '$ca_mobile_skin',
ca_img_width = '$ca_img_width',
ca_img_height = '$ca_img_height',
ca_list_mod = '$ca_list_mod',
ca_list_row = '$ca_list_row',
ca_mobile_img_width = '$ca_mobile_img_width',
ca_mobile_img_height = '$ca_mobile_img_height',
ca_mobile_list_mod = '$ca_mobile_list_mod',
ca_mobile_list_row = '$ca_mobile_list_row',
ca_sell_email = '$ca_sell_email',
ca_use = '$ca_use',
ca_stock_qty = '$ca_stock_qty',
ca_explan_html = '$ca_explan_html',
ca_head_html = '$ca_head_html',
ca_tail_html = '$ca_tail_html',
ca_mobile_head_html = '$ca_mobile_head_html',
ca_mobile_tail_html = '$ca_mobile_tail_html',
ca_include_head = '$ca_include_head',
ca_include_tail = '$ca_include_tail',
ca_mb_id = '$ca_mb_id',
ca_cert_use = '$ca_cert_use',
ca_adult_use = '$ca_adult_use',
ca_nocoupon = '$ca_nocoupon',
ca_1_subj = '$ca_1_subj',
ca_2_subj = '$ca_2_subj',
ca_3_subj = '$ca_3_subj',
ca_4_subj = '$ca_4_subj',
ca_5_subj = '$ca_5_subj',
ca_6_subj = '$ca_6_subj',
ca_7_subj = '$ca_7_subj',
ca_8_subj = '$ca_8_subj',
ca_9_subj = '$ca_9_subj',
ca_10_subj = '$ca_10_subj',
ca_1 = '$ca_1',
ca_2 = '$ca_2',
ca_3 = '$ca_3',
ca_4 = '$ca_4',
ca_5 = '$ca_5',
ca_6 = '$ca_6',
ca_7 = '$ca_7',
ca_8 = '$ca_8',
ca_9 = '$ca_9',
ca_10 = '$ca_10' ";
if ($w == "")
{
if (!trim($ca_id))
alert("분류 코드가 없으므로 분류를 추가하실 수 없습니다.");
// 소문자로 변환
$ca_id = strtolower($ca_id);
$sql = " insert {$g5['g5_shop_category_table']}
set ca_id = '$ca_id',
ca_name = '$ca_name',
$sql_common ";
sql_query($sql);
}
else if ($w == "u")
{
$sql = " update {$g5['g5_shop_category_table']}
set ca_name = '$ca_name',
$sql_common
where ca_id = '$ca_id' ";
sql_query($sql);
// 하위분류를 똑같은 설정으로 반영
if ($sub_category) {
$len = strlen($ca_id);
$sql = " update {$g5['g5_shop_category_table']}
set $sql_common
where SUBSTRING(ca_id,1,$len) = '$ca_id' ";
if ($is_admin != 'super')
$sql .= " and ca_mb_id = '{$member['mb_id']}' ";
sql_query($sql);
}
}
else if ($w == "d")
{
// 분류의 길이
$len = strlen($ca_id);
$sql = " select COUNT(*) as cnt from {$g5['g5_shop_category_table']}
where SUBSTRING(ca_id,1,$len) = '$ca_id'
and ca_id <> '$ca_id' ";
$row = sql_fetch($sql);
if ($row['cnt'] > 0)
alert("이 분류에 속한 하위 분류가 있으므로 삭제 할 수 없습니다.\\n\\n하위분류를 우선 삭제하여 주십시오.");
$str = $comma = "";
$sql = " select it_id from {$g5['g5_shop_item_table']} where ca_id = '$ca_id' ";
$result = sql_query($sql);
$i=0;
while ($row = sql_fetch_array($result))
{
$i++;
if ($i % 10 == 0) $str .= "\\n";
$str .= "$comma{$row['it_id']}";
$comma = " , ";
}
if ($str)
alert("이 분류와 관련된 상품이 총 {$i} 건 존재하므로 상품을 삭제한 후 분류를 삭제하여 주십시오.\\n\\n$str");
// 분류 삭제
$sql = " delete from {$g5['g5_shop_category_table']} where ca_id = '$ca_id' ";
sql_query($sql);
}
if ($w == "" || $w == "u")
{
goto_url("./categoryform.php?w=u&ca_id=$ca_id&$qstr");
} else {
goto_url("./categorylist.php?$qstr");
}
?>