Файл: modules/foto/inc/checkeraksMultiSelectFdi.php
Строк: 20
<?
if(isset($_GET['mod_rf_finish']) && isset($_SESSION['mod_rf']))
{
$array=explode(";", $_SESSION['mod_rf']);
foreach ($array as $key => $value)
{
if($value!=NULL)
{
$foto=mysql_fetch_assoc(mysql_query("SELECT * FROM `gallery_foto` WHERE `id` = '$value' AND `id_user` = '$user[id]' LIMIT 1"));
mysql_query("UPDATE `gallery_foto` SET `id_gallery` = '$gallery[id]' WHERE `id` = '$foto[id]'");
}
}
unset($_SESSION['mod_rf']);
}
if(!isset($_SESSION['mod_rf']) && isset($_GET['mod_rf_start']))$_SESSION['mod_rf']='';
if(isset($_SESSION['mod_rf']) && isset($_GET['mod_rf_drop']))$_SESSION['mod_rf']='';
if(isset($_SESSION['mod_rf']) && isset($_GET['mod_rf_cancel']))unset($_SESSION['mod_rf']);
////
if (isset($_SESSION['mod_rf']) && isset($_GET['add']) && isset($_POST['ok']))
{
//Очищаем список
$q=mysql_query("SELECT * FROM `gallery_foto` WHERE `id_gallery` = '$gallery[id]' AND `sk` = '0' ORDER BY `id` DESC LIMIT $start, $set[p_str]");
while($post=mysql_fetch_array($q))
{
$array=explode(";", $_SESSION['mod_rf']);
foreach ($array as $key => $value)
{
if($post['id']==$value && $value!=NULL)$_SESSION['mod_rf']=str_replace(";$post[id];", ';', $_SESSION['mod_rf']);
}
//вводим в список новые данные
foreach ($_POST as $keyy => $valuee)
{
if (preg_match('#^rf_([0-9]*)$#',$keyy,$postnum) && $valuee='1')
{
$array=explode(";", $_SESSION['mod_rf']);
foreach ($array as $key => $value)
{
if($postnum[1]==$value && $value!=NULL)$bad=1;
}
}
if(!isset($bad))
{
@$postt[]=$postnum[1];
}
if(isset($bad))unset($bad);
}
// фильтруем список
if(isset($postt))
{
$_SESSION['mod_rf']="$_SESSION[mod_rf];".implode(";", $postt).";";
}
}
$_SESSION['mod_rf']="$_SESSION[mod_rf];";
}
//// Считаем к-тво выбраных фоток
if(isset($_SESSION['mod_rf']))
{
$array=explode(";", $_SESSION['mod_rf']);
$_SESSION['mod_rf']=NULL;
foreach ($array as $key => $value)
{
$_SESSION['mod_rf']=str_replace(";$value;", ';', $_SESSION['mod_rf']);
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_foto` WHERE `id` = '$value' AND `sk` = '0'"),0)!=0 && $value!=NULL)$_SESSION['mod_rf']="$_SESSION[mod_rf]".($_SESSION['mod_rf']==NULL?";":NULL)."".$value.";";
}
$array=explode(";", $_SESSION['mod_rf']);
$count_rf=0;
foreach ($array as $key => $value)
{
if($value!=NULL)
{
$count_rf++;
if($count_rf<5)$cn=$value;
}
}
}
if(isset($_SESSION['mod_rf']))echo "<form method='post' action='?page=$page&add'>";
if(isset($_SESSION['mod_rf']) && $ank['id']==$user['id'])
{
echo "<div class='p_m'>Выберите фотки и нажмите ".($count_rf!=0?"<a href='?page=$page&mod_rf_finish'>":null)."Переместить сюда".($count_rf!=0?"</a>":null)."</div>";
}
?>