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
|
<?php include 'config.php'; // Check if the user is logged in if ((!isSet($_SESSION['loginname'])) || ($loggin <> '1')) { header("Location: login.php"); exit; }
$slideid = $_GET["slideid"];
//Delete Image file /*$sth1 = $dbh->prepare("SELECT * FROM slideshow WHERE slideid=?"); $parameter = array($slideid); if (!$sth1->execute($parameter)) throw new Exception('[' . $sth1->errorCode() . ']: '.print_r($sth1->errorInfo()));
$row = $sth1->fetch(PDO::FETCH_ASSOC); if ($row['hslideimgen'] <> '') { //unlink("../images/slideshow/" . $row['hslideimgen']);
$sth2 = $dbh->prepare("Update slideshow set deleted = 1 WHERE slideid=?"); $parameter2 = array($slideid); if (!$sth2->execute($parameter2)) throw new Exception('[' . $sth2->errorCode() . ']: '.print_r($sth2->errorInfo())); else header("Location: slideshow_index.php?msg=Delete Successful"); } */ $sth2 = $dbh->prepare("Update slideshow set deleted = 1 WHERE slideid=?"); $parameter2 = array($slideid); if (!$sth2->execute($parameter2)) throw new Exception('[' . $sth2->errorCode() . ']: '.print_r($sth2->errorInfo())); else header("Location: slideshow_index.php?msg=刪除成功");
$dbh = null;
?>
|