commit | author | age
|
3e083b
|
1 |
<?php |
B |
2 |
|
|
3 |
/** |
|
4 |
* 专题前台 |
|
5 |
*/ |
|
6 |
|
|
7 |
define('IN_ECS', true); |
|
8 |
|
|
9 |
require(dirname(__FILE__) . '/includes/init.php'); |
|
10 |
|
|
11 |
if ((DEBUG_MODE & 2) != 2) |
|
12 |
{ |
|
13 |
$smarty->caching = true; |
|
14 |
} |
|
15 |
|
|
16 |
if (empty($_SESSION['user_id'])){ |
|
17 |
$back_act = "apply_index.php"; |
|
18 |
if (!empty($_SERVER['QUERY_STRING'])) |
|
19 |
{ |
|
20 |
$back_act = 'apply.php?' . strip_tags($_SERVER['QUERY_STRING']); |
|
21 |
} |
|
22 |
show_message('请先登陆!', array('返回上一页','点击去登陆'), array($back_act, 'user.php'), 'info'); |
|
23 |
} |
|
24 |
|
|
25 |
$userid = $_SESSION['user_id']; |
|
26 |
|
|
27 |
$shownum = (isset($_REQUEST['shownum'])) ? intval($_REQUEST['shownum']) : 0; |
|
28 |
|
|
29 |
$upload_size_limit = $_CFG['upload_size_limit'] == '-1' ? ini_get('upload_max_filesize') : $_CFG['upload_size_limit']; |
|
30 |
|
|
31 |
if(isset($_POST['do']) && $_POST['do']){ |
|
32 |
unset($apply,$save); |
|
33 |
if($shownum == 1){ |
|
34 |
if($_POST['company']) |
|
35 |
{ |
|
36 |
$save['company_name'] = isset($_POST['company_name']) ? trim(addslashes(htmlspecialchars($_POST['company_name']))) : ''; |
|
37 |
$save['country'] = isset($_POST['country']) ? intval($_POST['country']) : 1; |
|
38 |
$save['province'] = isset($_POST['province']) ? intval($_POST['province']) : 1; |
|
39 |
$save['city'] = isset($_POST['city']) ? intval($_POST['city']) : 1; |
|
40 |
$save['district'] = isset($_POST['district']) ? intval($_POST['district']) : 1; |
|
41 |
$save['address'] = isset($_POST['address']) ? trim(addslashes(htmlspecialchars($_POST['address']))) : ''; |
|
42 |
$save['tel'] = isset($_POST['tel']) ? trim(addslashes(htmlspecialchars($_POST['tel']))) : ''; |
|
43 |
$save['guimo'] = isset($_POST['guimo']) ? trim(addslashes(htmlspecialchars($_POST['guimo']))) : ''; |
|
44 |
$save['email'] = isset($_POST['email']) ? trim($_POST['email']) : ''; |
|
45 |
$save['company_type'] = isset($_POST['company_type']) ? trim($_POST['company_type']) : ''; |
|
46 |
$save['contacts_name'] = isset($_POST['contacts_name']) ? trim(addslashes(htmlspecialchars($_POST['contacts_name']))) : ''; |
|
47 |
$save['contacts_phone'] = isset($_POST['contacts_phone']) ? trim(addslashes(htmlspecialchars($_POST['contacts_phone']))) : ''; |
|
48 |
$save['business_licence_number'] = isset($_POST['business_licence_number']) ? trim(addslashes(htmlspecialchars($_POST['business_licence_number']))) : ''; |
|
49 |
$save['business_sphere'] = isset($_POST['business_sphere']) ? trim(addslashes(htmlspecialchars($_POST['business_sphere']))) : ''; |
|
50 |
$save['organization_code'] = isset($_POST['organization_code']) ? trim(addslashes(htmlspecialchars($_POST['organization_code']))) : ''; |
|
51 |
|
|
52 |
if (isset($_FILES['zhizhao']) && $_FILES['zhizhao']['tmp_name'] != '' && isset($_FILES['zhizhao']['tmp_name']) && $_FILES['zhizhao']['tmp_name'] != 'none') |
|
53 |
{ |
|
54 |
if($_FILES['zhizhao']['size'] / 1024 > $upload_size_limit) |
|
55 |
{ |
|
56 |
$err->add(sprintf($_LANG['upload_file_limit'], $upload_size_limit)); |
|
57 |
$err->show($_LANG['back_up_page']); |
|
58 |
} |
|
59 |
$zhizhao_img = upload_file($_FILES['zhizhao'], 'supplier'); |
|
60 |
if ($zhizhao_img === false) |
|
61 |
{ |
|
62 |
$err->add('营业执照号电子版图片上传失败!'); |
|
63 |
$err->show($_LANG['back_up_page']); |
|
64 |
} |
|
65 |
else |
|
66 |
{ |
|
67 |
$save['zhizhao'] = $zhizhao_img; |
|
68 |
} |
|
69 |
} |
|
70 |
if (isset($_FILES['organization_code_electronic']) && $_FILES['organization_code_electronic']['tmp_name'] != '' && isset($_FILES['organization_code_electronic']['tmp_name']) && $_FILES['organization_code_electronic']['tmp_name'] != 'none') |
|
71 |
{ |
|
72 |
if($_FILES['organization_code_electronic']['size'] / 1024 > $upload_size_limit) |
|
73 |
{ |
|
74 |
$err->add(sprintf($_LANG['upload_file_limit'], $upload_size_limit)); |
|
75 |
$err->show($_LANG['back_up_page']); |
|
76 |
} |
|
77 |
$organization_code_electronic_img = upload_file($_FILES['organization_code_electronic'], 'supplier'); |
|
78 |
if ($organization_code_electronic_img === false) |
|
79 |
{ |
|
80 |
$err->add('组织机构代码证电子版图片上传失败!'); |
|
81 |
$err->show($_LANG['back_up_page']); |
|
82 |
} |
|
83 |
else |
|
84 |
{ |
|
85 |
$save['organization_code_electronic'] = $organization_code_electronic_img; |
|
86 |
} |
|
87 |
} |
|
88 |
if (isset($_FILES['general_taxpayer']) && $_FILES['general_taxpayer']['tmp_name'] != '' && isset($_FILES['general_taxpayer']['tmp_name']) && $_FILES['general_taxpayer']['tmp_name'] != 'none') |
|
89 |
{ |
|
90 |
if($_FILES['general_taxpayer']['size'] / 1024 > $upload_size_limit) |
|
91 |
{ |
|
92 |
$err->add(sprintf($_LANG['upload_file_limit'], $upload_size_limit)); |
|
93 |
$err->show($_LANG['back_up_page']); |
|
94 |
} |
|
95 |
$general_taxpayer_img = upload_file($_FILES['general_taxpayer'], 'supplier'); |
|
96 |
if ($general_taxpayer_img === false) |
|
97 |
{ |
|
98 |
$err->add('组织机构代码证电子版图片上传失败!'); |
|
99 |
$err->show($_LANG['back_up_page']); |
|
100 |
} |
|
101 |
else |
|
102 |
{ |
|
103 |
$save['general_taxpayer'] = $general_taxpayer_img; |
|
104 |
} |
|
105 |
} |
|
106 |
$save['applynum'] = 1;//公司信息认证一 |
|
107 |
|
|
108 |
//必填项验证 |
|
109 |
$save1 = array_filter($save); |
|
110 |
if(count($save1)!=count($save)){ |
|
111 |
show_message('请认真填写必填申请资料!', '返回', 'apply.php', 'wrong'); |
|
112 |
} |
|
113 |
if ($db->autoExecute($ecs->table('supplier'), $save, 'UPDATE', 'user_id='.$userid) !== false){ |
|
114 |
header("location:apply.php"); |
|
115 |
exit; |
|
116 |
}else{ |
|
117 |
show_message('操作失败!', '返回', 'apply.php', 'wrong'); |
|
118 |
} |
|
119 |
} |
|
120 |
if($_POST['person']) |
|
121 |
{ |
|
122 |
$save['company_name'] = isset($_POST['company_name']) ? trim(addslashes(htmlspecialchars($_POST['company_name']))) : ''; |
|
123 |
$save['country'] = isset($_POST['country']) ? intval($_POST['country']) : 1; |
|
124 |
$save['province'] = isset($_POST['province']) ? intval($_POST['province']) : 1; |
|
125 |
$save['city'] = isset($_POST['city']) ? intval($_POST['city']) : 1; |
|
126 |
$save['district'] = isset($_POST['district']) ? intval($_POST['district']) : 1; |
|
127 |
$save['address'] = isset($_POST['address']) ? trim(addslashes(htmlspecialchars($_POST['address']))) : ''; |
|
128 |
|
|
129 |
$save['contacts_name'] = isset($_POST['contacts_name']) ? trim(addslashes(htmlspecialchars($_POST['contacts_name']))) : ''; |
|
130 |
$save['contacts_phone'] = isset($_POST['contacts_phone']) ? trim(addslashes(htmlspecialchars($_POST['contacts_phone']))) : ''; |
|
131 |
$save['email'] = isset($_POST['email']) ? trim($_POST['email']) : ''; |
|
132 |
|
|
133 |
$save['id_card_no'] = isset($_POST['id_card_no']) ? trim(addslashes(htmlspecialchars($_POST['id_card_no']))) : ''; |
|
134 |
|
|
135 |
$save['bank_account_name'] = isset($_POST['bank_account_name']) ? trim(addslashes(htmlspecialchars($_POST['bank_account_name']))) : ''; |
|
136 |
$save['bank_account_number'] = isset($_POST['bank_account_number']) ? trim(addslashes(htmlspecialchars($_POST['bank_account_number']))) : ''; |
|
137 |
$save['bank_name'] = isset($_POST['bank_name']) ? trim(addslashes(htmlspecialchars($_POST['bank_name']))) : ''; |
|
138 |
$save['bank_code'] = isset($_POST['bank_code']) ? trim(addslashes(htmlspecialchars($_POST['bank_code']))) : ''; |
|
139 |
|
|
140 |
if (isset($_FILES['handheld_idcard']) && $_FILES['handheld_idcard']['tmp_name'] != '' && isset($_FILES['handheld_idcard']['tmp_name']) && $_FILES['handheld_idcard']['tmp_name'] != 'none') |
|
141 |
{ |
|
142 |
if($_FILES['handheld_idcard']['size'] / 1024 > $upload_size_limit) |
|
143 |
{ |
|
144 |
$err->add(sprintf($_LANG['upload_file_limit'], $upload_size_limit)); |
|
145 |
$err->show($_LANG['back_up_page']); |
|
146 |
} |
|
147 |
$handheld_idcard_img = upload_file($_FILES['handheld_idcard'], 'supplier'); |
|
148 |
if ($handheld_idcard_img === false) |
|
149 |
{ |
|
150 |
$err->add('手持身份证照片上传失败!'); |
|
151 |
$err->show($_LANG['back_up_page']); |
|
152 |
} |
|
153 |
else |
|
154 |
{ |
|
155 |
$save['handheld_idcard'] = $handheld_idcard_img; |
|
156 |
} |
|
157 |
} |
|
158 |
if (isset($_FILES['idcard_front']) && $_FILES['idcard_front']['tmp_name'] != '' && isset($_FILES['idcard_front']['tmp_name']) && $_FILES['idcard_front']['tmp_name'] != 'none') |
|
159 |
{ |
|
160 |
if($_FILES['idcard_front']['size'] / 1024 > $upload_size_limit) |
|
161 |
{ |
|
162 |
$err->add(sprintf($_LANG['upload_file_limit'], $upload_size_limit)); |
|
163 |
$err->show($_LANG['back_up_page']); |
|
164 |
} |
|
165 |
$idcard_front_img = upload_file($_FILES['idcard_front'], 'supplier'); |
|
166 |
if ($idcard_front_img === false) |
|
167 |
{ |
|
168 |
$err->add('身份证正面照片上传失败!'); |
|
169 |
$err->show($_LANG['back_up_page']); |
|
170 |
} |
|
171 |
else |
|
172 |
{ |
|
173 |
$save['idcard_front'] = $idcard_front_img; |
|
174 |
} |
|
175 |
} |
|
176 |
if (isset($_FILES['idcard_reverse']) && $_FILES['idcard_reverse']['tmp_name'] != '' && isset($_FILES['idcard_reverse']['tmp_name']) && $_FILES['idcard_reverse']['tmp_name'] != 'none') |
|
177 |
{ |
|
178 |
if($_FILES['idcard_reverse']['size'] / 1024 > $upload_size_limit) |
|
179 |
{ |
|
180 |
$err->add(sprintf($_LANG['upload_file_limit'], $upload_size_limit)); |
|
181 |
$err->show($_LANG['back_up_page']); |
|
182 |
} |
|
183 |
$idcard_reverse_img = upload_file($_FILES['idcard_reverse'], 'supplier'); |
|
184 |
if ($idcard_reverse_img === false) |
|
185 |
{ |
|
186 |
$err->add('身份证反面照片上传失败!'); |
|
187 |
$err->show($_LANG['back_up_page']); |
|
188 |
} |
|
189 |
else |
|
190 |
{ |
|
191 |
$save['idcard_reverse'] = $idcard_reverse_img; |
|
192 |
} |
|
193 |
} |
|
194 |
|
|
195 |
$save['applynum'] = 2;//公司信息认证一 |
|
196 |
|
|
197 |
//必填项验证 |
|
198 |
$save1 = array_filter($save); |
|
199 |
if(count($save1)!=count($save)){ |
|
200 |
show_message('请认真填写必填申请资料!', '返回', 'apply.php', 'wrong'); |
|
201 |
} |
|
202 |
|
|
203 |
if ($db->autoExecute($ecs->table('supplier'), $save, 'UPDATE', 'user_id='.$userid) !== false){ |
|
204 |
header("location:apply.php"); |
|
205 |
exit; |
|
206 |
}else{ |
|
207 |
show_message('操作失败!', '返回', 'apply.php', 'wrong'); |
|
208 |
} |
|
209 |
} |
|
210 |
|
|
211 |
}elseif($shownum == 2){ |
|
212 |
|
|
213 |
$save['bank_account_name'] = isset($_POST['bank_account_name']) ? trim(addslashes(htmlspecialchars($_POST['bank_account_name']))) : ''; |
|
214 |
$save['bank_account_number'] = isset($_POST['bank_account_number']) ? trim(addslashes(htmlspecialchars($_POST['bank_account_number']))) : ''; |
|
215 |
$save['bank_name'] = isset($_POST['bank_name']) ? trim(addslashes(htmlspecialchars($_POST['bank_name']))) : ''; |
|
216 |
$save['bank_code'] = isset($_POST['bank_code']) ? trim(addslashes(htmlspecialchars($_POST['bank_code']))) : ''; |
|
217 |
$save['settlement_bank_account_name'] = isset($_POST['settlement_bank_account_name']) ? trim(addslashes(htmlspecialchars($_POST['settlement_bank_account_name']))) : ''; |
|
218 |
$save['settlement_bank_account_number'] = isset($_POST['settlement_bank_account_number']) ? trim(addslashes(htmlspecialchars($_POST['settlement_bank_account_number']))) : ''; |
|
219 |
$save['settlement_bank_name'] = isset($_POST['settlement_bank_name']) ? trim(addslashes(htmlspecialchars($_POST['settlement_bank_name']))) : ''; |
|
220 |
$save['settlement_bank_code'] = isset($_POST['settlement_bank_code']) ? trim(addslashes(htmlspecialchars($_POST['settlement_bank_code']))) : ''; |
|
221 |
$save['tax_registration_certificate'] = isset($_POST['tax_registration_certificate']) ? trim(addslashes(htmlspecialchars($_POST['tax_registration_certificate']))) : ''; |
|
222 |
$save['taxpayer_id'] = isset($_POST['taxpayer_id']) ? trim(addslashes(htmlspecialchars($_POST['taxpayer_id']))) : ''; |
|
223 |
|
|
224 |
if (isset($_FILES['bank_licence_electronic']) && $_FILES['bank_licence_electronic']['tmp_name'] != '' && isset($_FILES['bank_licence_electronic']['tmp_name']) && $_FILES['bank_licence_electronic']['tmp_name'] != 'none') |
|
225 |
{ |
|
226 |
if($_FILES['bank_licence_electronic']['size'] / 1024 > $upload_size_limit) |
|
227 |
{ |
|
228 |
$err->add(sprintf($_LANG['upload_file_limit'], $upload_size_limit)); |
|
229 |
$err->show($_LANG['back_up_page']); |
|
230 |
} |
|
231 |
$bank_licence_electronic_img = upload_file($_FILES['bank_licence_electronic'], 'supplier'); |
|
232 |
if ($bank_licence_electronic_img === false) |
|
233 |
{ |
|
234 |
$err->add('开户银行许可证电子版图片上传失败!'); |
|
235 |
$err->show($_LANG['back_up_page']); |
|
236 |
} |
|
237 |
else |
|
238 |
{ |
|
239 |
$save['bank_licence_electronic'] = $bank_licence_electronic_img; |
|
240 |
} |
|
241 |
} |
|
242 |
if (isset($_FILES['tax_registration_certificate_electronic']) && $_FILES['tax_registration_certificate_electronic']['tmp_name'] != '' && isset($_FILES['tax_registration_certificate_electronic']['tmp_name']) && $_FILES['tax_registration_certificate_electronic']['tmp_name'] != 'none') |
|
243 |
{ |
|
244 |
if($_FILES['tax_registration_certificate_electronic']['size'] / 1024 > $upload_size_limit) |
|
245 |
{ |
|
246 |
$err->add(sprintf($_LANG['upload_file_limit'], $upload_size_limit)); |
|
247 |
$err->show($_LANG['back_up_page']); |
|
248 |
} |
|
249 |
$tax_registration_certificate_electronic_img = upload_file($_FILES['tax_registration_certificate_electronic'], 'supplier'); |
|
250 |
if ($tax_registration_certificate_electronic_img === false) |
|
251 |
{ |
|
252 |
$err->add('税务登记证号电子版图片上传失败!'); |
|
253 |
$err->show($_LANG['back_up_page']); |
|
254 |
} |
|
255 |
else |
|
256 |
{ |
|
257 |
$save['tax_registration_certificate_electronic'] = $tax_registration_certificate_electronic_img; |
|
258 |
} |
|
259 |
} |
|
260 |
|
|
261 |
$save['applynum'] = 2;//公司信息认证二 |
|
262 |
|
|
263 |
//必填项验证 |
|
264 |
$save1 = array_filter($save); |
|
265 |
if(count($save1)!=count($save)){ |
|
266 |
show_message('请认真填写必填申请资料!', '返回', 'apply.php', 'wrong'); |
|
267 |
} |
|
268 |
|
|
269 |
if ($db->autoExecute($ecs->table('supplier'), $save, 'UPDATE', 'user_id='.$userid) !== false){ |
|
270 |
header("location:apply.php"); |
|
271 |
exit; |
|
272 |
}else{ |
|
273 |
show_message('操作失败!', '返回', 'apply.php', 'wrong'); |
|
274 |
} |
|
275 |
|
|
276 |
}elseif($shownum == 3){ |
|
277 |
$save['supplier_name'] = isset($_POST['supplier_name']) ? trim(addslashes(htmlspecialchars($_POST['supplier_name']))) : ''; |
|
278 |
$save['rank_id'] = isset($_POST['rank_id']) ? intval($_POST['rank_id']) : 0; |
|
279 |
$save['type_id'] = isset($_POST['type_id']) ? intval($_POST['type_id']) : 0; |
|
280 |
|
|
281 |
$save['applynum'] = 3;//店铺信息设置 |
|
282 |
|
|
283 |
//必填项验证 |
|
284 |
$save1 = array_filter($save); |
|
285 |
if(count($save1)!=count($save)){ |
|
286 |
show_message('请认真填写必填申请资料!', '返回', 'apply.php', 'wrong'); |
|
287 |
} |
|
288 |
|
|
289 |
if ($db->autoExecute($ecs->table('supplier'), $save, 'UPDATE', 'user_id='.$userid) !== false){ |
|
290 |
header("location:apply.php"); |
|
291 |
exit; |
|
292 |
}else{ |
|
293 |
show_message('操作失败!', '返回', 'apply.php', 'wrong'); |
|
294 |
} |
|
295 |
|
|
296 |
}else{//同意入驻协议 |
|
297 |
|
|
298 |
|
|
299 |
if(isset($_POST['input_apply_agreement']) && intval($_POST['input_apply_agreement']) > 0){ |
|
300 |
|
|
301 |
$sql = "select * from ".$ecs->table('supplier')." where user_id=".$userid." limit 1"; |
|
302 |
$info = $db->getRow($sql); |
|
303 |
|
|
304 |
$apply['user_id'] = $userid; |
|
305 |
$apply['status'] = 0; |
|
306 |
$apply['applynum'] = 0;//同意入驻协议 |
|
307 |
if($info){ |
|
308 |
if ($db->autoExecute($ecs->table('supplier'), $apply, 'UPDATE', 'user_id='.$userid) !== false){ |
|
309 |
header("location:apply.php"); |
|
310 |
exit; |
|
311 |
}else{ |
|
312 |
show_message('请点击同意入驻协议!', '返回', 'apply.php', 'wrong'); |
|
313 |
} |
|
314 |
}else{ |
|
315 |
if ($db->autoExecute($ecs->table('supplier'), $apply) !== false){ |
|
316 |
header("location:apply.php"); |
|
317 |
exit; |
|
318 |
}else{ |
|
319 |
show_message('请点击同意入驻协议!', '返回', 'apply.php', 'wrong'); |
|
320 |
} |
|
321 |
} |
|
322 |
}else{ |
|
323 |
$err->add('请点击同意入驻协议!'); |
|
324 |
$err->show($_LANG['back_up_page']); |
|
325 |
} |
|
326 |
} |
|
327 |
} |
|
328 |
|
|
329 |
|
|
330 |
if (!$smarty->is_cached($templates, $cache_id)) |
|
331 |
{ |
|
332 |
|
|
333 |
/* 模板赋值 */ |
|
334 |
assign_template(); |
|
335 |
$position = assign_ur_here(); |
|
336 |
$smarty->assign('page_title', $position['title']); // 页面标题 |
|
337 |
$smarty->assign('ur_here', $position['ur_here'] . '> ' . $topic['title']); // 当前位置 |
|
338 |
|
|
339 |
} |
|
340 |
$smarty->assign('piclimit',$upload_size_limit); |
|
341 |
$smarty->assign('userid',intval($_SESSION['user_id'])); |
|
342 |
$smarty->display('apply.dwt'); |
|
343 |
|
|
344 |
?> |