Файл: files/checkeraksMultiSelectFdi.php
Строк: 23
<?
if(isset($_GET['mok']) && isset($mrf) && isset($_SESSION['rpfs']))
{
$array=explode(";", $_SESSION['rpfs']);
$count=0;
$count2=0;
foreach ($array as $key => $value)
{
if($value!=NULL)
{
$count2=$count2+1;
$file=mysql_fetch_assoc(mysql_query("SELECT * FROM `files` WHERE `id` = '$value' LIMIT 1"));
mysql_query("UPDATE `files` SET `id_dir` = '$dir[id]', `counter` = '".($dir['id']==0?"/0/":"$dir[counter]$dir[id]/")."' WHERE `id` = '$file[id]'");
}
}
}
/////
///////////
//////
if(isset($mrf) && isset($_GET['drop']) && isset($_SESSION['rpfs']))unset($_SESSION['rpfs']);
////
if (isset($mrf) && isset($_GET['add']) && isset($_POST['ok']))
{
//Очищаем список
$qq=mysql_query("SELECT * FROM `files` WHERE `cat` = 'files' AND `id_user` = '$ank[id]' AND `id_dir` = '$dir[id]'$skp ORDER BY `type2` DESC, `time` ASC LIMIT $start, $set[p_str]");
while($postt=mysql_fetch_array($qq))
{
if(isset($_SESSION['rpfs']))
{
$arrayy=explode(";", $_SESSION['rpfs']);
foreach ($arrayy as $keyy => $valuee)
{
if($postt['id']==$valuee && $valuee!=NULL)$_SESSION['rpfs']=str_replace(";$postt[id];", ';', $_SESSION['rpfs']);
}
}
}
//вводим в список новые данные
foreach ($_POST as $key => $value)
{
if (preg_match('#^mrf_([0-9]*)$#',$key,$postnum) && $value='1')
{
if(isset($_SESSION['rpfs']))
{
$array1=explode(";", $_SESSION['rpfs']);
foreach ($array1 as $key1 => $value1)
{
if($postnum['1']==$value1 && $value1!=NULL)$bad=1;
}
}
if(!isset($bad))
{
$post[]=$postnum[1];
}
if(isset($bad))unset($bad);
}
}
if(isset($post))
{
if(isset($_SESSION['rpfs']))
{
$_SESSION['rpfs']="$_SESSION[rpfs]".($_SESSION['rpfs']!=NULL?";":null)."".implode(";", $post).";";
$_SESSION['rpfs']=str_replace(";;", ';', $_SESSION['rpfs']);
}
else $_SESSION['rpfs']="".implode(";", $post)."".($post==NULL?";":null)."";
}
$arraya=explode(";", $_SESSION['rpfs']);
$_SESSION['rpfs']=NULL;
foreach ($arraya as $keya => $valuea)
{
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `files` WHERE `id` = '$valuea' AND `type2` = 'file' AND `cat` = 'files'"),0)!=0 && $valuea!=NULL)$_SESSION['rpfs']="$_SESSION[rpfs];".$valuea."";
}
$_SESSION['rpfs']="$_SESSION[rpfs];";
}
////
if(isset($mrf) && isset($_SESSION['rpfs']))
{
$act=explode(";", $_SESSION['rpfs']);
$count=0;
foreach ($act as $keyc => $ca)
{
if($ca!=NULL)
{
$count=$count+1;
if($count<5)$cn=$ca;
}
}
}
else $count=0;
if(isset($mrf))echo "<form method='post' action='?dir=$dir[id]&user=$ank[id]&page=$page&add'>";
?>