/var/www/hkosl.com/litedemo/webadmin/banner_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
37
<?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");

$bannerid         $_GET["bannerid"];
$result mysql_query("SELECT * FROM banner WHERE bannerid="$_GET["bannerid"] ." ");
$row mysql_fetch_array($result,MYSQL_ASSOC);
$menuid         $row{'menuid'};
$footpageid     $row{'footpageid'};
$bannersort     $_GET["bannersort"];

// Delete db
$sql "DELETE FROM banner WHERE bannerid="$bannerid ." ";
mysql_query($sql);
if( 
mysql_errno() > ){
    echo 
'Delete Banner Error:<br />'mysql_error() .'<br />SQL: '$sql;
    exit;
}

if( (!empty(
$menuid )) && (empty($footpageid)) ){
    
mysql_query("UPDATE banner SET bannersort = bannersort-1 WHERE bannersort >= $bannersort AND menuid = $menuid ");
} else if( (empty(
$menuid )) && (!empty($footpageid)) ){
    
mysql_query("UPDATE banner SET bannersort = bannersort-1 WHERE bannersort >= $bannersort AND footpageid = $footpageid ");
}
mysql_close($dbh);

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

?>