/var/www/hkosl.com/litedemo/webadmin/proddet_sort.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
38
39
40
41
<?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"); 

$prodcatid   $_GET['prodcatid'];
$prodid       $_GET['prodid'];
$sort          $_GET['sort'];
$status       $_GET['status'];

if (
$status == 'up') {
    
$s_sign="+1";
    
$prodsort $sort-1;
    if (
$prodsort <=0) {
        
$prodsort 1;
        }
} else {
$s_sign="-1";
    
$prodsort $sort+1;
}

$sql "update proddetail set prodsort='$prodsort' ";
$sql .= "where prodid="$prodid ." AND prodcatid="$prodcatid ." ";
//echo $sql;
if( mysql_num_rows(mysql_query("SELECT prodid FROM proddetail WHERE prodsort=$prodsort AND prodid!='$prodid' AND prodcatid='$prodcatid' ")) > 0){
    
mysql_query("UPDATE proddetail SET prodsort= prodsort".$s_sign ." WHERE prodsort = $prodsort AND prodcatid='$prodcatid' ");
}
mysql_query($sql);


mysql_close($dbh);

header("Location: prodcat_index.php?pid=$prodcatid&msg=Update Successful");
?>