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
|
<?php require("configure.php");
$catid = $_POST["catid"]; $pid = $_POST["pid"]; $catname = htmlspecialchars($_POST["catname"],ENT_QUOTES); //print_r($_POST);
// Upload File if ($_FILES['catimage']['name'] <> '') { if (($_FILES["catimage"]["type"] == "image/bmp") || ($_FILES["catimage"]["type"] == "image/BMP") || ($_FILES["catimage"]["type"] == "image/gif") || ($_FILES["catimage"]["type"] == "image/GIF") || ($_FILES["catimage"]["type"] == "image/jpg") || ($_FILES["catimage"]["type"] == "image/JPG") || ($_FILES["catimage"]["type"] == "image/jpeg") || ($_FILES["catimage"]["type"] == "image/JPEG") || ($_FILES["catimage"]["type"] == "image/pjpeg") || ($_FILES["catimage"]["type"] == "image/PJEG") || ($_FILES["catimage"]["type"] == "image/png") || ($_FILES["catimage"]["type"] == "image/x-png") || ($_FILES["catimage"]["type"] == "image/PNG") || ($_FILES["catimage"]["type"] == "image/X-PNG")) { copy ($_FILES['catimage']['tmp_name'], "product/id_".$catid."_".$_FILES['catimage']['name']) or die ("Could not copy the file"); $catimage = "id_".$catid."_".$_FILES['catimage']['name']; } else { // upload error ?> <script language="javascript"> alert("Files must be BMP, JPEG, GIF, or PNG"); history.back(); </script> <?php exit; }
} else { $catimage = ""; }
$sql = "update prodcategory set catname='$catname' "; if ($catimage <> '') $sql .= ", catimage='$catimage' "; $sql .= " where catid=". $catid ." "; mysql_query($sql); if( mysql_errno() > 0 ){ echo 'Modify Product Category Error:<br />'. mysql_error() .'<br />SQL: '. $sql2; exit; }
mysql_close($dbh);
header("Location: prodcat_index.php?pid=$pid&msg=Update Successful"); ?>
|