File size: 2.95Kb
<?php
require_once"../template/start.php";
require_once"../template/regglobals.php";
require_once"../template/config.php";
require_once"../template/functions.php";
require_once"../template/antidos.php";
require_once"../template/cookies.php";
require_once"../template/gzip.php";
require_once"../template/header.php";
require_once"../template/referer.php";
include_once"../themes/$config_themes/index.php";
include_once"../template/isset.php";
include_once"../template/db.php";
if($provpar==md5($_SESSION['par']) && $provlog==$_SESSION['log']) {
if ($dostup==101 || $dostup==102){
$act = isset($_GET['act']) ? $_GET['act'] : '';
switch($act){
default:
break;
case('undown'):
$id = (int)$id;
if($id){
$check = mysql_fetch_array(mysql_query("SELECT * FROM `under` WHERE `id` = '$id'"));
if($check!=0){
$frms = mysql_query("SELECT * FROM `under` WHERE `id` = '$id'");
$frm = mysql_fetch_array($frms);
$req = mysql_query("SELECT `position` FROM `under` WHERE `id` = '$id' AND `forum` = '".$frm['forum']."'");
if (mysql_num_rows($req) > 0){
$res = mysql_fetch_array($req);
$position = $res['position'];
$req = mysql_query("SELECT * FROM `under` WHERE `position` < '$position' AND `forum` = '".$frm['forum']."' ORDER BY `position` DESC");
if (mysql_num_rows($req) > 0){
$res = mysql_fetch_array($req);
$id2 = $res['id'];
$position2 = $res['position'];
mysql_query("UPDATE `under` SET `position` = '".$position2."' WHERE `id` = '".$id."' AND `forum` = '".$frm['forum']."'");
mysql_query("UPDATE `under` SET `position` = '".$position."' WHERE `id` = '".$id2."' AND `forum` = '".$frm['forum']."'");}}
header ("Location: ".$_SERVER['HTTP_REFERER'].""); exit;
}}
break;
case('unup'):
$id = (int)$id;
if($id){
$unds = mysql_query("SELECT * FROM `under` WHERE `id` = '$id'");
$und = mysql_fetch_array($unds);
$check = mysql_fetch_array(mysql_query("SELECT * FROM `under` WHERE `id` = '$id'"));
if($check!=0){
$frms = mysql_query("SELECT * FROM `under` WHERE `id` = '$id'");
$frm = mysql_fetch_array($frms);
$req = mysql_query("SELECT `position` FROM `under` WHERE `id` = '$id' AND `forum` = '".$frm['forum']."'");
if (mysql_num_rows($req) > 0){
$res = mysql_fetch_array($req);
$position = $res['position'];
$req = mysql_query("SELECT * FROM `under` WHERE `position` > '$position' AND `forum` = '".$frm['forum']."' ORDER BY `position` ASC");
if (mysql_num_rows($req) > 0){
$res = mysql_fetch_array($req);
$id2 = $res['id'];
$position2 = $res['position'];
mysql_query("UPDATE `under` SET `position` = '".$position2."' WHERE `id` = '".$id."' AND `forum` = '".$frm['forum']."'");
mysql_query("UPDATE `under` SET `position` = '".$position."' WHERE `id` = '".$id2."' AND `forum` = '".$frm['forum']."'");}}
header ("Location: ".$_SERVER['HTTP_REFERER'].""); exit;
}}
break;
}
} else {header ("Location: ../index.php?isset=404&".SID);}
} else {header ("Location: ../index.php?isset=404&".SID);}
include_once"../themes/$config_themes/foot.php";
?>