/var/www/globavet.com/webadmin/aboutus_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
<?php 
require 'check_login.php';
if (
$logged_in <> 1) {
    
header('Location: login.php');
    return;
}
else
{
require(
"configure.php");

$parentid   $_GET['parentid'];
$aboutusid  $_GET['aboutusid'];
$sort          $_GET['sort'];
$status       $_GET['status'];

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



$sql "update aboutus set sort=".$newSort." ";
$sql .= "where aboutusid="$aboutusid ." ";

if( 
mysql_num_rows(mysql_query("SELECT aboutusid FROM aboutus WHERE parentid=".$parentid." AND sort=".$newSort." AND aboutusid!=".$aboutusid." ")) > 0){
    
mysql_query("UPDATE aboutus SET sort= sort".$s_sign ." WHERE parentid=".$parentid." AND sort =".$newSort." ");
}

mysql_query($sql);
mysql_close($dbh);

header("Location: aboutus_index.php?pid=$parentid&msg=Update Successful");
}
?>