Файл: foto/inc/user_show_foto.php
Строк: 122
<?
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']=$_GET['id_user'];
$ank=get_user($ank['id']);
if (!$ank){header("Location: /foto/?".SID);exit;}
$gallery['id']=intval($_GET['id_gallery']);
if (mysql_result(mysql_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(mysql_query("SELECT * FROM `gallery` WHERE `id` = '$gallery[id]' AND `id_user` = '$ank[id]' LIMIT 1"));
$foto['id']=intval($_GET['id_foto']);
if (mysql_result(mysql_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(mysql_query("SELECT * FROM `gallery_foto` WHERE `id` = '$foto[id]' LIMIT 1"));
$set['title']=$ank['nick'].' - '.$gallery['name'].' - '.$foto['name']; // заголовок страницы
include_once '../sys/inc/thead.php';
title();
if (user_access('foto_foto_edit') && $ank['level']>$user['level'] || isset($user) && $ank['id']==$user['id'])
include 'inc/gallery_show_foto_act.php';
if (isset($user) && $user['id']!=$ank['id'] && $user['balls']>=0 && $user['rating']>=0 && mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_rating` WHERE `id_user` = '$user[id]' AND `id_foto` = '$foto[id]'"), 0)==0)
{
if (isset($_GET['rating']) && $_GET['rating']=='down'){
mysql_query("UPDATE `gallery_foto` SET `rating` = '".($foto['rating']-1)."' WHERE `id` = '$foto[id]' LIMIT 1",$db);
mysql_query("INSERT INTO `gallery_rating` (`id_user`, `id_foto`) values('$user[id]', '$foto[id]')",$db);
mysql_query("INSERT INTO `foto_ball` (`id_user`, `id_kont`, `msg`, `time`) values('0', '$ank[id]', '[url=/user/profile.php?id=$user[id]/][b]$user[nick][/b][/url] не понравилась ваша [url=/foto/$ank[id]/$gallery[id]/$foto[id]/][red]фотография[/red][/url] в фотоальбоме [b]$gallery[name][/b]', '$time')");
msg ('Ваш отрицательный отзыв принят');$foto=mysql_fetch_assoc(mysql_query("SELECT * FROM `gallery_foto` WHERE `id` = $foto[id] LIMIT 1"));}
elseif(isset($_GET['rating']) && $_GET['rating']=='up'){
mysql_query("UPDATE `gallery_foto` SET `rating` = '".($foto['rating']+1)."' WHERE `id` = '$foto[id]' LIMIT 1",$db);
mysql_query("INSERT INTO `gallery_rating` (`id_user`, `id_foto`) values('$user[id]', '$foto[id]')",$db);
mysql_query("INSERT INTO `foto_ball` (`id_user`, `id_kont`, `msg`, `time`) values('0', '$ank[id]', '[url=/user/profile.php?id=$user[id]/][b]$user[nick][/b][/url] понравилась ваша [url=/foto/$ank[id]/$gallery[id]/$foto[id]/][red]фотография[/red][/url] в фотоальбоме [b]$gallery[name][/b]', '$time')");
msg ('Ваш положительный отзыв принят');$foto=mysql_fetch_assoc(mysql_query("SELECT * FROM `gallery_foto` WHERE `id` = $foto[id] LIMIT 1"));}
}
err();
aut();
echo "<div class='foot1'><center>n";
icon_golos_votes();echo "$foto[rating] | ";
icon_foto_komm();echo "".mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_komm` WHERE `id_foto` = '$foto[id]'"),0)." <a href='/foto/$ank[id]/$gallery[id]/komm/$foto[id]/'>[";
icon_mini_pensil();echo "]</a><br />n";
echo "</center></div>n";
echo "<div class='foot'>n";
echo "<div style='text-align: center;'>n";
if ($set['web'])
{
echo "<img class='show_foto' src='/foto/foto640/$foto[id].$foto[ras]' alt='$foto[name]' /><br />n";
}
else
{
echo "<img class='show_foto' src='/foto/foto128/$foto[id].$foto[ras]' alt='$foto[name]' /><br />n";
}
echo "<span style='float : right;'>n";
echo "<div id='hide'>n";
echo "<a href='/foto/foto0/$foto[id].$foto[ras]' title='Скачать оригинал'>";
icon_foto_save();echo "</a>n";
echo "</div>n";
echo " </span>";
if ($foto['opis']!=null)
echo esc(trim(br(bbcode(smiles(links(stripcslashes(htmlspecialchars($foto['opis']))))))))."<br />n";
echo "</div>n";
echo "</div>";
if (isset($user) && $user['id']!=$ank['id'] && $user['balls']>=0 && $user['rating']>=0 && mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_rating` WHERE `id_user` = '$user[id]' AND `id_foto` = '$foto[id]'"), 0)==0){
echo "<div class='foot1'>n";
icon_foto_like();echo "<font color='blue'><b>Понравилось фото? </b></font> ";
echo "<a href="?id=$foto[id]&rating=up" title="Отдать положительный голос"><font color='green'>Да</font></a> | ";
echo "<a href="?id=$foto[id]&rating=down" title="Отдать отрицательный голос"><font color='red'>Нет</font></a> ";
echo "<br />n";
echo "</div>";
}
include 'inc/gallery_show_foto_form.php';
echo "<div class='foot1'><center>";
echo "Другие фото альбомаn";
echo "</center></div>n";
include_once 'inc/show_gallary.php';
if (user_access('foto_foto_edit') && $ank['level']>$user['level'] || isset($user) && $ank['id']==$user['id'])
include 'inc/gallery_show_foto_form.php';
echo "<div class="foot1">n";
icon_levo();echo "<a href='/foto/$ank[id]/$gallery[id]/'>К фотографиям</a><br />n";
icon_levo();echo "<a href='/foto/$ank[id]/'>К фотоальбомам</a><br />n";
echo "</div>n";
include_once '../sys/inc/tfoot.php';
exit;
?>