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
|
<?php include 'config.php';
// Check if the user is logged in
if ((!isSet($_SESSION['loginname'])) || ($loggin <> '1')) { header("Location: login.php"); exit; } require("configure.php"); $pdcatid = $_POST["pdcatid"]; $pdcattitleen = htmlspecialchars($_POST["pdcattitleen"],ENT_QUOTES); $pdcattitlesc = htmlspecialchars($_POST["pdcattitlesc"],ENT_QUOTES); $parentid = $_POST["pid"]; $pdcatdescen = preg_replace("/'/","\'",$_POST["pdcatdescen"]); $pdcatdescsc = preg_replace("/'/","\'",$_POST["pdcatdescsc"]); $pdcatbannerlinken = htmlspecialchars($_POST["pdcatbannerlinken"],ENT_QUOTES); $pdcatbannerlinksc = htmlspecialchars($_POST["pdcatbannerlinksc"],ENT_QUOTES); $metatitleen = htmlspecialchars($_POST["metatitleen"],ENT_QUOTES); $metakeyworden = htmlspecialchars($_POST["metakeyworden"],ENT_QUOTES); $metadescen = htmlspecialchars($_POST["metadescen"],ENT_QUOTES); $metatitlesc = htmlspecialchars($_POST["metatitlesc"],ENT_QUOTES); $metakeywordsc = htmlspecialchars($_POST["metakeywordsc"],ENT_QUOTES); $metadescsc = htmlspecialchars($_POST["metadescsc"],ENT_QUOTES); $nowdate = date("Y-m-d H:i:s"); //print_r($_POST);
if ($_FILES['pdcatbanneren']['name'] <> '') { if (($_FILES["pdcatbanneren"]["type"] == "image/bmp") || ($_FILES["pdcatbanneren"]["type"] == "image/BMP") || ($_FILES["pdcatbanneren"]["type"] == "image/gif") || ($_FILES["pdcatbanneren"]["type"] == "image/GIF") || ($_FILES["pdcatbanneren"]["type"] == "image/jpg") || ($_FILES["pdcatbanneren"]["type"] == "image/JPG") || ($_FILES["pdcatbanneren"]["type"] == "image/jpeg") || ($_FILES["pdcatbanneren"]["type"] == "image/JPEG") || ($_FILES["pdcatbanneren"]["type"] == "image/pjpeg") || ($_FILES["pdcatbanneren"]["type"] == "image/PJEG") || ($_FILES["pdcatbanneren"]["type"] == "image/png") || ($_FILES["pdcatbanneren"]["type"] == "image/x-png") || ($_FILES["pdcatbanneren"]["type"] == "image/PNG") || ($_FILES["pdcatbanneren"]["type"] == "image/X-PNG")) { $filename=$_FILES['pdcatbanneren']['name']; preg_match("/\.([^\.]+)$/", $filename, $file_ext); copy ($_FILES['pdcatbanneren']['tmp_name'], "../pagebanner/pdcatid_".$pdcatid."_en.".$file_ext[1]) or die ("Could not copy the file: 产品类别 Banner(EN)"); $pdcatbanneren = "pdcatid_".$pdcatid."_en.".$file_ext[1]; $pdcatbanneren = htmlspecialchars($pdcatbanneren,ENT_QUOTES); } else { // upload error ?> <script language="javascript"> alert("Files must be BMP, JPEG, GIF, or PNG"); history.back(); </script> <?php exit; }
} else { $pdcatbanneren = ""; }
if ($_FILES['pdcatbannersc']['name'] <> '') { if (($_FILES["pdcatbannersc"]["type"] == "image/bmp") || ($_FILES["pdcatbannersc"]["type"] == "image/BMP") || ($_FILES["pdcatbannersc"]["type"] == "image/gif") || ($_FILES["pdcatbannersc"]["type"] == "image/GIF") || ($_FILES["pdcatbannersc"]["type"] == "image/jpg") || ($_FILES["pdcatbannersc"]["type"] == "image/JPG") || ($_FILES["pdcatbannersc"]["type"] == "image/jpeg") || ($_FILES["pdcatbannersc"]["type"] == "image/JPEG") || ($_FILES["pdcatbannersc"]["type"] == "image/pjpeg") || ($_FILES["pdcatbannersc"]["type"] == "image/PJEG") || ($_FILES["pdcatbannersc"]["type"] == "image/png") || ($_FILES["pdcatbannersc"]["type"] == "image/x-png") || ($_FILES["pdcatbannersc"]["type"] == "image/PNG") || ($_FILES["pdcatbannersc"]["type"] == "image/X-PNG")) { $filename=$_FILES['pdcatbannersc']['name']; preg_match("/\.([^\.]+)$/", $filename, $file_ext); copy ($_FILES['pdcatbannersc']['tmp_name'], "../pagebanner/pdcatid_".$pdcatid."_sc.".$file_ext[1]) or die ("Could not copy the file: 产品类别 Banner(EN)"); $pdcatbannersc = "pdcatid_".$pdcatid."_sc.".$file_ext[1]; $pdcatbannersc = htmlspecialchars($pdcatbannersc,ENT_QUOTES); } else { // upload error ?> <script language="javascript"> alert("Files must be BMP, JPEG, GIF, or PNG"); history.back(); </script> <?php exit; }
} else { $pdcatbannersc = ""; }
// Modify $sql = "update product_cat set pdcattitleen='$pdcattitleen', pdcattitlesc='$pdcattitlesc', pdcatdescen='$pdcatdescen', pdcatdescsc='$pdcatdescsc', pdcatbannerlinken='$pdcatbannerlinken', pdcatbannerlinksc='$pdcatbannerlinksc', metatitleen='$metatitleen', metakeyworden='$metakeyworden', metadescen='$metadescen', metatitlesc='$metatitlesc', metakeywordsc='$metakeywordsc', metadescsc='$metadescsc', modifyday='$nowdate', cmsloginid='".$_SESSION['cmsloginid']."' "; if (($pdcatbanneren <> '')) { $sql .= ", pdcatbanneren='$pdcatbanneren' "; } else if ($_POST['delpdcatbanneren'] <> '') { $sql .= ", pdcatbanneren='' "; } if (($pdcatbannersc <> '')) { $sql .= ", pdcatbannersc='$pdcatbannersc' "; } else if ($_POST['delpdcatbannersc'] <> '') { $sql .= ", pdcatbannersc='' "; } $sql .= " where pdcatid=". $pdcatid ." "; mysql_query($sql);
if( mysql_errno() > 0 ){ echo 'Modify 产品类别 Error:<br />'. mysql_error() .'<br />SQL: '. $sql; exit; }
mysql_close($dbh);
header("Location: productcat_index.php?pid=$parentid&msg=修改成功"); ?>
|