View file fotov4/foto/collections/collections_new.php

File size: 3.56Kb
<?

if (isset($user) && $user['id'] == $ank['id'])
{

if (isset($_GET['act']) && $_GET['act']=='create'){
	
if (isset($_POST['cfms']) && isset($_POST['name']))
{
	$name = my_esc($_POST['name']);
	if (strlen2($name) < 3)$err = 'Название коллекции слишком короткое.';
	if (strlen2($name) > 32)$err = 'Название коллекции слишком длинное [max 32 симв.]';
		

		
	if (mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_collect` WHERE `id_user` = '$ank[id]' AND `name` = '$name'"),0) != 0)
	$err = 'Коллекция с таким названием уже существует!';	
		
if (!isset($err))
{
        if (!isset($_POST['who']) || $_POST['who'] == NULL || !is_numeric($_POST['who']) || $_POST['who'] < 0 || $_POST['who'] > 2)
        {
            $who = 0;
        } else {
            $who = abs(intval($_POST['who']));
        }		
	mysql_query("INSERT INTO `gallery_collect` (`id_user`, `name`, `who`, `time`) values('$ank[id]', '$name', '$who', '$time')");
	$gallery_id = mysql_insert_id();
	$_SESSION['message'] = 'Коллекция '.my_esc($_POST['name']).' успешно создана. ';
	header("Location: /foto/collections/$ank[id]/");
	exit;
}
}
	
err();

?>

<a href="/foto/collections/<?= $ank['id']?>/" class="link darkblue return full_link">  
<img src="/foto/style/ico/arr_back.png" alt="" class="ico_arrow-back">   Назад  
</a>

<form action="?act=create" method="post">
<div class="wrapper"> 
		
<div class="block pdb"  style="border-bottom:0;">   
		
<div>  
<label class="lbl">  Название коллекции:   (max 32)</label>    
<div class="input-txt_wrapper">  
<input class="input-txt" name="name" value="" maxlength="32" type="text">  
</div>    
</div> 

		
</div> 
		
<div>
<div class="vlight_border_bottom stnd_padd pdb vlight_border_bottom"> <label class="lbl">Могут смотреть:</label> </div>

<div> 
<label for="am_na_0_3" class="t-block_item stnd_padd vlight_border_bottom"> 
<input name="who" id="am_na_0_3" value="0" class="m" checked="checked" type="radio"> 
<img class="m p16" src="/foto/style/ico/ac_all.png" alt="Все"> <span class="m">&nbsp;Все</span> 
</label> 
</div>

<div> 
<label for="am_fo_0_3" class="t-block_item stnd_padd vlight_border_bottom"> 
<input name="who" id="am_fo_0_3" value="1" class="m" type="radio"> 
<img class="m p16" src="/foto/style/ico/ac_user.png" alt="Мои друзья"> <span class="m">&nbsp;Только я</span> 
</label> 
</div>

<div> 
<label for="am_oo_0_3" class="t-block_item stnd_padd vlight_border_bottom"> 
<input name="who" id="am_oo_0_3" value="2" class="m" type="radio"> 
<img class="m p16" src="/foto/style/ico/ac_friends.png" alt="Только я"> <span class="m">&nbsp;Мои друзья</span> 
</label> 
</div>

</div> 
		
	
<table class="table__wrap table__links"> <tbody><tr> 
<td class="table__cell" width="50%"> <!-- --><!-- --><!-- --><!-- -->
<button name="cfms" value="Сохранить" class="  link  blue full is_final    " id="cfms">
<img src="/foto/style/ico/ok_blue.png" alt="" class="m"> <span class="m">Сохранить</span><!-- --></button><!-- --><!-- --> 
</td> 
<td class="table__cell table__cell_last" width="50%">     
<a href="/foto/collections/<?= $ank['id']?>/" class="link -full          "> <span>Отменить</span>  </a>  
</td> 
</tr> </tbody></table>
		
</div>
</form>
		
<a href="/foto/collections/<?= $ank['id']?>/" class="link darkblue return full_link">  
<img src="/foto/style/ico/arr_back.png" alt="" class="ico_arrow-back">   Назад  
</a>
<?

include_once H.'sys/inc/tfoot.php';
exit;
	}
}
?>