/var/www/(Del)tsolpv.com/2013/webadmin/productcat_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"); 

$parentid       $_GET['parentid'];
$pdcatid         $_GET['pdcatid'];
$sort              $_GET['sort'];
$status           $_GET['status'];
$nowdate         date("Y-m-d H:i:s");

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

$sql "update product_cat set pdcatsort='$pdcatsort', modifyday='$nowdate', cmsloginid = '".$_SESSION['cmsloginid']."' ";
$sql .= "where pdcatid='"$pdcatid ."' ";
//echo $sql;
//exit;
if( mysql_num_rows(mysql_query("SELECT pdcatid FROM product_cat WHERE parentid=$parentid AND pdcatsort=$pdcatsort AND pdcatid!='$pdcatid' ")) > 0){
    
mysql_query("UPDATE product_cat SET pdcatsort= pdcatsort".$s_sign ." WHERE parentid=$parentid AND pdcatsort = $pdcatsort ");
}
mysql_query($sql);
mysql_close($dbh);

header("Location: productcat_index.php?pid=$parentid&msg=更新成功");
?>