View file friends/user/friends/fr_edit_spisok.php

File size: 11.53Kb
<?
if (isset($_GET['id']))
{
$id_spiska = intval($_GET['id']);
$spisok = mysql_fetch_assoc(mysql_query("SELECT * FROM `friends_spisok` WHERE `id` = '".$id_spiska."' LIMIT 1"));
}

if (!isset($_GET['id']) || !$spisok || $spisok['id']==0)
{
$set['title'] = "Ошибка"; 
include_once H.'sys/inc/thead.php';
title();
aut();

?>
<link rel="stylesheet" href="/user/friends/Tw1nGo.css" type="text/css" />

<div class="Tw1nGo-lc_br Tw1nGo-wbg Tw1nGo-relative Tw1nGo-oh" id="Tw1nGo-header_path">  
<a class="Tw1nGo" href="/"> <img src="/user/info/ico/home.png" alt=""> </a>         
<span class="Tw1nGo-lc_brw"> 
<img src="/user/info/ico/sep.png" alt="" class="Tw1nGo-lc_br_sep"> 
<a href="/info.php?id=<?= $user['id']?>"><span class="Tw1nGo-lc_br_text"><?= $user['nick']?></span> </a>  
</span>   
<span class="Tw1nGo-lc_brw"> 
<img src="/user/info/ico/sep.png" alt="" class="Tw1nGo-lc_br_sep"> 
<a href="/user/friends/?S=4"><span class="Tw1nGo-lc_br_text">Списки</span> </a>  
</span>     
</div>

<div class="Tw1nGo-oh Tw1nGo-t_center Tw1nGo-nl Tw1nGo-system-message Tw1nGo-system-message_alert Tw1nGo-text">  Группа не существует, возможно она удалена ранее. </div>
<?
include_once H.'sys/inc/tfoot.php';
exit;
}

$set['title'] = "Друзья : Редактор списка " . $spisok['name']; 
include_once H.'sys/inc/thead.php';
title();
aut();
err();
if (isset($_POST['save']) && isset($_POST['name'])){

		$name = my_esc($_POST['name']);
		if (strlen2($name) < 1)$err = 'Короткое название';
		if (strlen2($name) > 32)$err = 'Название не должно быть длиннее 32-х символов';
		
		$icon = intval($_POST['icon']);
		
		if (mysql_result(mysql_query("SELECT COUNT(*) FROM `friends_spisok` WHERE `id_user` = '$user[id]' AND `name` = '$name'"),0) != 0){
		$_SESSION['message'] = 'Список с таким названием уже существует..';
		header("Location: /user/friends/?S=4");
		exit;
		}
		if (!isset($err))
		{
		mysql_query("UPDATE `friends_spisok` SET `name` = '$name', `id_user` = '$user[id]', `icon` = '$icon', `time` = '$time' WHERE `id` = '$spisok[id]' LIMIT 1");
		$_SESSION['message'] = 'Список успешно изменен..';
		header("Location: /user/friends/?S=spisok&id=$spisok[id]");
		exit;
		}

}
// Удаление списка
if (isset($_GET['del'])){  
  	$no = intval($_GET['del']);
	mysql_query("DELETE FROM `friends_spisok` WHERE `id_user` = '$user[id]' AND `id` = '$spisok[id]' LIMIT 1");
	mysql_query("DELETE FROM `friends_spisok_users` WHERE `id_user` = '$user[id]' AND `id_spiska` = '$spisok[id]' LIMIT 1");
	mysql_query("OPTIMIZE TABLE `friends_spisok`");
	mysql_query("OPTIMIZE TABLE `friends_spisok_users`");
	$_SESSION['message'] = 'Список успешно удален..';
	header("Location: /user/friends/?S=4");
	exit;
}

?>
<link rel="stylesheet" href="/user/friends/Tw1nGo.css" type="text/css" />

<div class="Tw1nGo-lc_br Tw1nGo-wbg Tw1nGo-relative Tw1nGo-oh" id="Tw1nGo-header_path">  
<a class="Tw1nGo" href="/"> <img src="/user/info/ico/home.png" alt=""> </a>         
<span class="Tw1nGo-lc_brw"> 
<img src="/user/info/ico/sep.png" alt="" class="Tw1nGo-lc_br_sep"> 
<a href="/info.php?id=<?= $user['id']?>"><span class="Tw1nGo-lc_br_text"><?= $user['nick']?></span> </a>  
</span>   
<span class="Tw1nGo-lc_brw"> 
<img src="/user/info/ico/sep.png" alt="" class="Tw1nGo-lc_br_sep"> 
<a href="/user/friends/?S=4"><span class="Tw1nGo-lc_br_text">Списки</span> </a>  
</span> 
<span class="Tw1nGo-lc_brw"> 
<img src="/user/info/ico/sep.png" alt="" class="Tw1nGo-lc_br_sep"> 
<a href="/user/friends/?S=spisok&id=<?= $spisok['id']?>"><span class="Tw1nGo-lc_br_text"><?= $spisok['name']?></span> </a>  
</span>
<span class="Tw1nGo-lc_brw"> 
<img src="/user/info/ico/sep.png" alt="" class="Tw1nGo-lc_br_sep"> <span class="Tw1nGo-lc_br_text">Редактор списка</span> 
</span>     
</div>

<div class="Tw1nGo-BG"> 

<?
$akt_ico = mysql_fetch_assoc(mysql_query("SELECT * FROM `friends_spisok` WHERE `id_user` = '".$spisok['id_user']."' LIMIT 1"));
?>
<form method="post" action="/user/friends/?S=edit_spisok&id=<?= $spisok['id']?>">
<div class="Tw1nGo-widgets-group Tw1nGo-widgets-group_top-mrg Tw1nGo-wbg2" style="display: block;overflow: hidden;">   
<div class="Tw1nGo-form__item Tw1nGo-wbg2"> 
<div class="Tw1nGo-content-item3 Tw1nGo-pdb Tw1nGo-suggest_parent"> 
<span class="Tw1nGo-label text">Название списка:</span> 
<div class="Tw1nGo-text-input__wrap"> 
<input class="Tw1nGo-js-usearch Tw1nGo-text-input" value="<?= text($akt_ico['name'])?>" name="name" maxlength="255" type="text"> 
</div> 
<div class="Tw1nGo-suggest__list"></div>  
</div> </div> 
<div class="Tw1nGo-static-bl Tw1nGo-pdt"> 
<span class="Tw1nGo-label text">Иконка:</span> 
<div class="Tw1nGo-toolbar__wrap"> 
<table class="Tw1nGo-table__wrap Tw1nGo-bb0 Tw1nGo-flattened">   <tbody>

<tr>  
<td class="Tw1nGo-table__cell">  
<label class="Tw1nGo-list-link js-radio js-radio-I" data-checked_class="clicked"> <span class="Tw1nGo-ico_lists Tw1nGo-ico_lists_0"></span> 
<input class="Tw1nGo-js-hidden" name="icon" <?= ($akt_ico['icon']==0?' checked="checked"':null)?> value="0" type="radio"> </label>  
</td>    
<td class="Tw1nGo-table__cell">  
<label class="Tw1nGo-list-link js-radio js-radio-I" data-checked_class="clicked"> <span class="Tw1nGo-ico_lists Tw1nGo-ico_lists_1"></span> 
<input class="Tw1nGo-js-hidden" name="icon" <?= ($akt_ico['icon']==1?' checked="checked"':null)?> value="1" type="radio"> </label>  
</td>    
<td class="Tw1nGo-table__cell">  
<label class="Tw1nGo-list-link js-radio js-radio-I" data-checked_class="clicked"> <span class="Tw1nGo-ico_lists Tw1nGo-ico_lists_2"></span> 
<input class="Tw1nGo-js-hidden" name="icon" <?= ($akt_ico['icon']==2?' checked="checked"':null)?> value="2" type="radio"> </label>  
</td>   
<td class="Tw1nGo-table__cell">  
<label class="Tw1nGo-list-link js-radio js-radio-I" data-checked_class="clicked"> <span class="Tw1nGo-ico_lists Tw1nGo-ico_lists_3"></span> 
<input class="Tw1nGo-js-hidden" name="icon" <?= ($akt_ico['icon']==3?' checked="checked"':null)?> value="3" type="radio"> </label>  
</td>  
<td class="Tw1nGo-table__cell">  
<label class="Tw1nGo-list-link js-radio js-radio-I" data-checked_class="clicked"> <span class="Tw1nGo-ico_lists Tw1nGo-ico_lists_4"></span> 
<input class="Tw1nGo-js-hidden" name="icon" <?= ($akt_ico['icon']==4?' checked="checked"':null)?> value="4" type="radio"> </label>  
</td> 
<td class="Tw1nGo-table__cell">  
<label class="Tw1nGo-list-link js-radio js-radio-I" data-checked_class="clicked"> <span class="Tw1nGo-ico_lists Tw1nGo-ico_lists_5"></span> 
<input class="Tw1nGo-js-hidden" name="icon" <?= ($akt_ico['icon']==5?' checked="checked"':null)?> value="5" type="radio"> </label>  
</td>  
</tr>    
<tr>       
<td class="Tw1nGo-table__cell">  
<label class="Tw1nGo-list-link js-radio js-radio-I" data-checked_class="clicked"> <span class="Tw1nGo-ico_lists Tw1nGo-ico_lists_6"></span> 
<input class="Tw1nGo-js-hidden" name="icon" <?= ($akt_ico['icon']==6?' checked="checked"':null)?> value="6" type="radio"> </label>  
</td>    
<td class="Tw1nGo-table__cell">  
<label class="Tw1nGo-list-link js-radio js-radio-I" data-checked_class="clicked"> <span class="Tw1nGo-ico_lists Tw1nGo-ico_lists_7"></span> 
<input class="Tw1nGo-js-hidden" name="icon" <?= ($akt_ico['icon']==7?' checked="checked"':null)?> value="7" type="radio"> </label>  
</td> 
<td class="Tw1nGo-table__cell">  
<label class="Tw1nGo-list-link js-radio js-radio-I" data-checked_class="clicked"> <span class="Tw1nGo-ico_lists Tw1nGo-ico_lists_8"></span> 
<input class="Tw1nGo-js-hidden" name="icon" <?= ($akt_ico['icon']==8?' checked="checked"':null)?> value="8" type="radio"> </label>  
</td>    
<td class="Tw1nGo-table__cell">  
<label class="Tw1nGo-list-link js-radio js-radio-I" data-checked_class="clicked"> <span class="Tw1nGo-ico_lists Tw1nGo-ico_lists_9"></span> 
<input class="Tw1nGo-js-hidden" name="icon" <?= ($akt_ico['icon']==9?' checked="checked"':null)?> value="9" type="radio"> </label>  
</td> 
<td class="Tw1nGo-table__cell">  
<label class="Tw1nGo-list-link js-radio js-radio-I" data-checked_class="clicked"> <span class="Tw1nGo-ico_lists Tw1nGo-ico_lists_10"></span> 
<input class="Tw1nGo-js-hidden" name="icon" <?= ($akt_ico['icon']==10?' checked="checked"':null)?> value="10" type="radio"> </label>  
</td>    
<td class="Tw1nGo-table__cell">  
<label class="Tw1nGo-list-link js-radio js-radio-I" data-checked_class="clicked"> <span class="Tw1nGo-ico_lists Tw1nGo-ico_lists_11"></span> 
<input class="Tw1nGo-js-hidden" name="icon" <?= ($akt_ico['icon']==11?' checked="checked"':null)?> value="11" type="radio"> </label>  
</td> 
</tr>    
<tr>      
<td class="Tw1nGo-table__cell">  
<label class="Tw1nGo-list-link js-radio js-radio-I" data-checked_class="clicked"> <span class="Tw1nGo-ico_lists Tw1nGo-ico_lists_12"></span> 
<input class="Tw1nGo-js-hidden" name="icon" <?= ($akt_ico['icon']==12?' checked="checked"':null)?> value="12" type="radio"> </label>  
</td>    
<td class="Tw1nGo-table__cell">  
<label class="Tw1nGo-list-link js-radio js-radio-I" data-checked_class="clicked"> <span class="Tw1nGo-ico_lists Tw1nGo-ico_lists_13"></span> 
<input class="Tw1nGo-js-hidden" name="icon" <?= ($akt_ico['icon']==13?' checked="checked"':null)?> value="13" type="radio"> </label>  
</td>    
<td class="Tw1nGo-table__cell">  
<label class="Tw1nGo-list-link js-radio js-radio-I" data-checked_class="clicked"> <span class="Tw1nGo-ico_lists Tw1nGo-ico_lists_14"></span> 
<input class="Tw1nGo-js-hidden" name="icon" <?= ($akt_ico['icon']==14?' checked="checked"':null)?> value="14" type="radio"> </label>  
</td>    
<td class="Tw1nGo-table__cell">  
<label class="Tw1nGo-list-link js-radio js-radio-I" data-checked_class="clicked"> <span class="Tw1nGo-ico_lists Tw1nGo-ico_lists_15"></span> 
<input class="Tw1nGo-js-hidden" name="icon" <?= ($akt_ico['icon']==15?' checked="checked"':null)?> value="15" type="radio"> </label>  
</td>    
<td class="Tw1nGo-table__cell">  
<label class="Tw1nGo-list-link js-radio js-radio-I" data-checked_class="clicked"> <span class="Tw1nGo-ico_lists Tw1nGo-ico_lists_16"></span> 
<input class="Tw1nGo-js-hidden" name="icon" <?= ($akt_ico['icon']==16?' checked="checked"':null)?> value="16" type="radio"> </label>  
</td>    
<td class="Tw1nGo-table__cell">  
<label class="Tw1nGo-list-link js-radio js-radio-I" data-checked_class="clicked"> <span class="Tw1nGo-ico_lists Tw1nGo-ico_lists_17"></span> 
<input class="Tw1nGo-js-hidden" name="icon" <?= ($akt_ico['icon']==17?' checked="checked"':null)?> value="17" type="radio"> </label>  
</td>  
</tr>   
</tbody></table> 
</div> </div>  
   
<table class="Tw1nGo-table__wrap Tw1nGo-user__tools_last" style="font-size:13px;"> <tbody><tr> 
<td class="Tw1nGo-table__cell" width="50%"> 
<button type="submit" name="save" class="Tw1nGo-user__tools-link Tw1nGo-list-link-blue" value="1">  
<img class="Tw1nGo-ico" src="/user/info/ico/ok_blue.png" alt="Tw1nGo"> Сохранить </button> 
</td> 
<td class="Tw1nGo-table__cell Tw1nGo-table__cell_last" width="50%">      
<a href="/user/friends/?S=spisok&id=<?= $spisok['id']?>" class="Tw1nGo-stnd-link  "> Отменить  </a>      
</td> 
</tr> </tbody></table> 
</div>
</form>
	
<div class="Tw1nGo-widgets-group Tw1nGo-dropdown-menu Tw1nGo-t_center" style="margin: 0 0 10px 10px;">      
<a href="/user/friends/?S=edit_spisok&id=<?= $spisok['id']?>&del=<?= $spisok['id']?>" class="Tw1nGo-stnd-link Tw1nGo-lal">          
<img class="Tw1nGo-ico Tw1nGo-icosa" src="/user/info/ico/close.png" alt="Tw1nGo">      <span class="t">  Удалить список   </span>  </a>      
</div>
	
	
</div>