0)
{
if(isset($_SESSION['username']) and $_SESSION['username']==$admin)
{
if($action=='up')
{
if($dn1['position']>1)
{
if(mysql_query('update categories as c, categories as c2 set c.position=c.position-1, c2.position=c2.position+1 where c.id="'.$id.'" and c2.position=c.position-1'))
{
header('Location: '.$url_home);
}
else
{
echo 'An error occured while moving the category.';
}
}
else
{
echo 'The action you want to do is impossible.
';
}
}
else
{
if($dn1['position']<$dn1['nb2'])
{
if(mysql_query('update categories as c, categories as c2 set c.position=c.position+1, c2.position=c2.position-1 where c.id="'.$id.'" and c2.position=c.position+1'))
{
header('Location: '.$url_home);
}
else
{
echo 'An error occured while moving the category.';
}
}
else
{
echo 'The action you want to do is impossible.
';
}
}
}
else
{
echo 'You must be logged as an administrator to access this page: Login - Sign Up
';
}
}
else
{
echo 'The category you want to move doesn\'t exist.
';
}
}
else
{
echo 'The ID of the category you want to move is not defined.
';
}
?>