/var/www/hkosl.com/kelvin/webadmin/gallery_detail_delete.php


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
<?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");

$gdetid     check_input($_GET["gdetid"]);
    
$menuid check_input($_REQUEST["menuid"]);
$sql "SELECT * FROM gallery_detail WHERE gdetid="$gdetid ." ";
$result=mysql_query($sql);
$row mysql_fetch_array($result,MYSQL_ASSOC);
$galleryid        $row{'galleryid'};
unlink("../images/gallery/large/".$row{'gdetimage'});
unlink("../images/gallery/mid/".$row{'gdetimage'});
unlink("../images/gallery/thumb/".$row{'gdetimage'});

// Delete db
$sql "DELETE FROM gallery_detail WHERE gdetid="$gdetid ." ";
mysql_query($sql);
if( 
mysql_errno() > ){
    echo 
'Delete Gallery Detail(Images) Error:<br />'mysql_error() .'<br />SQL: '$sql;
    exit;
}

//mysql_query("UPDATE gallery_detail SET gdetsort = gdetsort-1 WHERE gdetsort >= $gdetsort AND galleryid= $galleryid");
mysql_close($dbh);

header("Location: gallery_detail_index.php?menuid=$menuid&galleryid=$galleryid&msg=Delete Successful");

?>