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
|
<?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"); $hadvid = $_POST["hadvid"]; $hadvlinken = htmlspecialchars($_POST["hadvlinken"],ENT_QUOTES); $hadvlinksc = htmlspecialchars($_POST["hadvlinksc"],ENT_QUOTES); $hadvtitleen = htmlspecialchars($_POST["hadvtitleen"],ENT_QUOTES); $hadvtitlesc = htmlspecialchars($_POST["hadvtitlesc"],ENT_QUOTES); $nowdate = date("Y-m-d H:i:s"); //print_r($_POST);
if ($_FILES['hadvimgen']['name'] <> '') { if (($_FILES["hadvimgen"]["type"] == "image/bmp") || ($_FILES["hadvimgen"]["type"] == "image/BMP") || ($_FILES["hadvimgen"]["type"] == "image/gif") || ($_FILES["hadvimgen"]["type"] == "image/GIF") || ($_FILES["hadvimgen"]["type"] == "image/jpg") || ($_FILES["hadvimgen"]["type"] == "image/JPG") || ($_FILES["hadvimgen"]["type"] == "image/jpeg") || ($_FILES["hadvimgen"]["type"] == "image/JPEG") || ($_FILES["hadvimgen"]["type"] == "image/pjpeg") || ($_FILES["hadvimgen"]["type"] == "image/PJEG") || ($_FILES["hadvimgen"]["type"] == "image/png") || ($_FILES["hadvimgen"]["type"] == "image/x-png") || ($_FILES["hadvimgen"]["type"] == "image/PNG") || ($_FILES["hadvimgen"]["type"] == "image/X-PNG")) { $filename=$_FILES['hadvimgen']['name']; preg_match("/\.([^\.]+)$/", $filename, $file_ext); move_uploaded_file ($_FILES['hadvimgen']['tmp_name'], "../adv/id_".$hadvid."_en.".$file_ext[1]) or die ("Could not copy the file: 主页 广告(EN)"); $hadvimgen = "id_".$hadvid."_en.".$file_ext[1]; $hadvimgen = htmlspecialchars($hadvimgen,ENT_QUOTES); } else { // upload error ?> <script language="javascript"> alert("Files must be BMP, JPEG, GIF, or PNG"); history.back(); </script> <?php exit; }
} else { $hadvimgen = ""; }
if ($_FILES['hadvimgsc']['name'] <> '') { if (($_FILES["hadvimgsc"]["type"] == "image/bmp") || ($_FILES["hadvimgsc"]["type"] == "image/BMP") || ($_FILES["hadvimgsc"]["type"] == "image/gif") || ($_FILES["hadvimgsc"]["type"] == "image/GIF") || ($_FILES["hadvimgsc"]["type"] == "image/jpg") || ($_FILES["hadvimgsc"]["type"] == "image/JPG") || ($_FILES["hadvimgsc"]["type"] == "image/jpeg") || ($_FILES["hadvimgsc"]["type"] == "image/JPEG") || ($_FILES["hadvimgsc"]["type"] == "image/pjpeg") || ($_FILES["hadvimgsc"]["type"] == "image/PJEG") || ($_FILES["hadvimgsc"]["type"] == "image/png") || ($_FILES["hadvimgsc"]["type"] == "image/x-png") || ($_FILES["hadvimgsc"]["type"] == "image/PNG") || ($_FILES["hadvimgsc"]["type"] == "image/X-PNG")) { $filename=$_FILES['hadvimgsc']['name']; preg_match("/\.([^\.]+)$/", $filename, $file_ext); move_uploaded_file ($_FILES['hadvimgsc']['tmp_name'], "../adv/id_".$hadvid."_sc.".$file_ext[1]) or die ("Could not copy the file: 主页 广告(SC)"); $hadvimgsc = "id_".$hadvid."_sc.".$file_ext[1]; $hadvimgsc = htmlspecialchars($hadvimgsc,ENT_QUOTES); } else { // upload error ?> <script language="javascript"> alert("Files must be BMP, JPEG, GIF, or PNG"); history.back(); </script> <?php exit; }
} else { $hadvimgsc = ""; }
// Modify $sql = "update h_adv set hadvlinken='$hadvlinken', hadvlinksc='$hadvlinksc', hadvtitleen='$hadvtitleen', hadvtitlesc='$hadvtitlesc', modifyday='$nowdate', cmsloginid='".$_SESSION['cmsloginid']."' "; if ($hadvimgen <> '') $sql .= ", hadvimgen='$hadvimgen' "; if ($hadvimgsc <> '') $sql .= ", hadvimgsc='$hadvimgsc' "; $sql .= " where hadvid=". $hadvid ." "; mysql_query($sql);
if( mysql_errno() > 0 ){ echo 'Modify 主页 广告 Error:<br />'. mysql_error() .'<br />SQL: '. $sql; exit; }
mysql_close($dbh);
header("Location: h_adv_index.php?msg=修改成功"); ?>
|