View file fotov4/foto/inc/user_show_foto_like.php

File size: 4.77Kb
<?
if (!isset($user) && !isset($_GET['id_user'])){header("Location: /foto/?".SID);exit;}
if (isset($user))$ank['id'] = $user['id'];
if (isset($_GET['id_user']))$ank['id'] = intval($_GET['id_user']);
$ank = get_user($ank['id']);
if (!$ank){header("Location: /foto/?".SID);exit;}

/* Бан пользователя */ 
if (isset($user) && mysql_result(query("SELECT COUNT(*) FROM `ban` WHERE `razdel` = 'foto' AND `id_user` = '$user[id]' AND (`time` > '$time' OR `view` = '0' OR `navsegda` = '1')"), 0) != 0)
{
	header('Location: /ban.php?'.SID);
	exit;
}

$gallery['id'] = intval($_GET['id_gallery']);

if (mysql_result(query("SELECT COUNT(*) FROM `gallery` WHERE `id` = '$gallery[id]' AND `id_user` = '$ank[id]' LIMIT 1"),0)==0)
{
	header("Location: /foto/$ank[id]/?".SID);
	exit;
}

$gallery = mysql_fetch_assoc(query("SELECT * FROM `gallery` WHERE `id` = '$gallery[id]' AND `id_user` = '$ank[id]' LIMIT 1")); 
$foto['id'] = intval($_GET['id_foto']);

if (mysql_result(query("SELECT COUNT(*) FROM `gallery_foto` WHERE `id` = '$foto[id]' LIMIT 1"),0)==0)
{
	header("Location: /foto/$ank[id]/$gallery[id]/?".SID);
	exit;
}

$foto = mysql_fetch_assoc(query("SELECT * FROM `gallery_foto` WHERE `id` = '$foto[id]'  LIMIT 1"));


$set['title'] = 'Лайки / '.text($foto['name']) . '.' . $foto['ras'] . ' / ' . text($gallery['name']); // заголовок страницы
include_once H.'sys/inc/thead.php';
title();
err();
aut();


?>
<link rel="stylesheet" href="/foto/style/style-foto.css" type="text/css" />
<div class="foto_head_bg"> 

<div class="lc_br wbg font0 relative oh" id="header_path">  
<a href="/" style="font-size:0;"> <img src="/foto/style/ico/home.png" alt=""> </a>     
<span class="lc_brw"> 
<img src="/foto/style/ico/sep.png" alt="" class="lc_br_sep"> <a href="/foto/<?= $ank['id']?>/<?= $gallery['id']?>/<?= $foto['id']?>/"><?= text($foto['name'])?>.<?= $foto['ras']?></a> 
</span>     
<span class="lc_brw"> 
<img src="/foto/style/ico/sep.png" alt="" class="lc_br_sep"> <span class="lc_br_text">Голоса</span> 
</span>       
</div>
<a href="/foto/<?= $ank['id']?>/<?= $gallery['id']?>/<?= $foto['id']?>/" class="link darkblue return full_link">  <img src="/foto/style/ico/arr_back.png" alt="" class="ico_arrow-back">   Назад  </a>
<?

	$set['p_str'] = '10';
	$k_post = mysql_result(query("SELECT COUNT(*) FROM `gallery_foto_like` WHERE `id_foto` = '$foto[id]'"),0);
	$k_page = k_page($k_post,$set['p_str']);
	$page = page($k_page);
	$start = $set['p_str']*$page-$set['p_str'];

	if ($k_post == 0)
	{
?>
<div class="wrapper block">Фото еще не оценивали!</div>
<?
	}
	else{

?>
<div class="wrapper" style="border-bottom: 0;">
<?

	$q = query("SELECT * FROM `gallery_foto_like` WHERE `id_foto` = '$foto[id]' ORDER BY `time` DESC LIMIT $start, $set[p_str]");

	while ($post = mysql_fetch_assoc($q))
	{
$ank_like = get_user($post['id_user']);

// Определяем сколько лет	
$ank_like['ank_age'] = null;
if ($ank_like['ank_d_r'] != NULL && $ank_like['ank_m_r'] != NULL && $ank_like['ank_g_r'] != NULL){
	$ank_like['ank_age'] = date("Y")-$ank_like['ank_g_r'];
	if (date("n") < $ank_like['ank_m_r'])
	$ank_like['ank_age'] = $ank_like['ank_age'] - 1;
	elseif (date("n") == $ank_like['ank_m_r']&& date("j") < $ank_like['ank_d_r'])
	$ank_like['ank_age'] = $ank_like['ank_age'] - 1;
}

?>
<div class="js-row block bord-botm oh grey relative">        
<div class="left font0">   
<a href="/info.php?id=<?= $ank_like['id']?>" class="tdn">       
<span class="pr">   <div class="inl_bl relative"> <?= avatar($ank_like['id'])?>   </div>     </span>         
</a>  
</div>   
<div class="pre_content_wrap break-word"> 
<?= group($ank_like['id'])?>   <a href="/info.php?id=<?= $ank_like['id']?>" class="black full_link">   <b><?= $ank_like['nick']?></b>  </a>   
<?= medal($ank_like['id'])?> <?= online($ank_like['id'])?>        <span class="grey">(<?= vremja($post['time'])?>)</span>       
<div class="grey">  
<?
if($ank_like['ank_name'] != null){
?>
<div class="break-word"> <?= text($ank_like['ank_name'])?>  </div>
<?
}
// Вывод возвраста
if ($ank_like['ank_d_r'] != NULL && $ank_like['ank_m_r'] != NULL && $ank_like['ank_g_r'] != NULL){

$my_age_day = array('год', 'года', 'лет');
?>    
<?= des2num($ank_like['ank_age'], $my_age_day)?>
<? 
if ($ank_like['ank_city'] != NULL){
?>, <?
} 
}
if ($ank_like['ank_city'] != NULL){
?>
<?= text($ank_like['ank_city'])?>
<?
}
?>
</div>             
</div>     
</div>
<?


	}
?>
</div>
<?
if ($k_page > 1)str('?',$k_page,$page); // Вывод страниц
	}
?>
<a href="/foto/<?= $ank['id']?>/<?= $gallery['id']?>/<?= $foto['id']?>/" class="link darkblue return full_link">  <img src="/foto/style/ico/arr_back.png" alt="" class="ico_arrow-back">   Назад  </a>
<div style="height: 1px;"></div>   
</div>
<?

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