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
|
<?php require_once("configure.php"); $aboutid = $_POST["aboutid"]; $abouttitleen = htmlspecialchars($_POST["abouttitleen"],ENT_QUOTES); $aboutdescen = preg_replace("/'/","\'",$_POST["aboutdescen"]); $nowdate = date("Y-m-d H:i:s"); //print_r($_POST);
if ($_FILES['aboutimage']['name'] <> '') { if (($_FILES["aboutimage"]["type"] == "image/bmp") || ($_FILES["aboutimage"]["type"] == "image/BMP") || ($_FILES["aboutimage"]["type"] == "image/gif") || ($_FILES["aboutimage"]["type"] == "image/GIF") || ($_FILES["aboutimage"]["type"] == "image/jpg") || ($_FILES["aboutimage"]["type"] == "image/JPG") || ($_FILES["aboutimage"]["type"] == "image/jpeg") || ($_FILES["aboutimage"]["type"] == "image/JPEG") || ($_FILES["aboutimage"]["type"] == "image/pjpeg") || ($_FILES["aboutimage"]["type"] == "image/PJEG") || ($_FILES["aboutimage"]["type"] == "image/png") || ($_FILES["aboutimage"]["type"] == "image/x-png") || ($_FILES["aboutimage"]["type"] == "image/PNG") || ($_FILES["aboutimage"]["type"] == "image/X-PNG")) { $filename=$_FILES['aboutimage']['name']; preg_match("/\.([^\.]+)$/", $filename, $file_ext); copy ($_FILES['aboutimage']['tmp_name'], "../uploadfile/aboutcover.".$file_ext[1]) or die ("Could not copy the file: About Image"); $aboutimage = "aboutcover.".$file_ext[1]; $aboutimage = htmlspecialchars($aboutimage,ENT_QUOTES); } else { // upload error ?> <script language="javascript"> alert("Files must be BMP, JPEG, GIF, or PNG"); history.back(); </script> <?php exit; }
} else { $aboutimage = ""; }
// Modify $sql = "update about set abouttitleen='$abouttitleen', aboutdescen='$aboutdescen', modifyday='$nowdate', cmsloginid='".$_SESSION['cmsloginid']."' "; if ($aboutimage <> '') $sql .= ", aboutimage='$aboutimage' "; $sql .= " where aboutid=". $aboutid ." "; mysql_query($sql);
if( mysql_errno() > 0 ){ echo 'Modify About Us Error:<br />'. mysql_error() .'<br />SQL: '. $sql; exit; }
mysql_close($dbh);
header("Location: about_modifyform.php?id=$aboutid&msg=Modify Successful"); ?>
|