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
|
<?php require("configure.php");
if (!isset($_SESSION["cmslogin"])) { header("Location: login.php"); exit; }
$historyid = $_POST["historyid"]; $historycat = htmlspecialchars($_POST["historycat"], ENT_QUOTES); $historytopic = htmlspecialchars($_POST["historytopic"], ENT_QUOTES); $historydate = htmlspecialchars($_POST["historydate"], ENT_QUOTES);
if ($_FILES['historyfile']['name'] <> '') { copy($_FILES['historyfile']['tmp_name'], "historyfile/" . $historyid . $_FILES['historyfile']['name']) or die ("Could not copy");
$historyfile = $historyid . $_FILES['historyfile']['name'];
} else { $historyfile = ""; }
$sql = "update history set historycat='$historycat', historytopic='$historytopic', historydate='$historydate' "; if ($historyfile <> '') $sql .= ", historyfile='$historyfile' "; $sql .= "where historyid=" . $historyid . " ";
mysql_query($sql); mysql_close($dbh);
header("Location: historyindex.php?msg=Update Successful"); ?>
|