View file moduls/photo_id.php

File size: 4.89Kb
<?php
/**********************************************/
/* Автор скрипта: Александр Есин              */
/* E-Mail: [email protected] ([email protected]) */
/* ICQ: 6464729                               */
/* Site: http://ticlove.ru                    */
/**********************************************/
?>
<?php define ('SECURED', true); ?>
<?php require (dirname(__FILE__).'/../_inc/sql.php'); ?>
<?php require (dirname(__FILE__).'/../_inc/config.php'); ?>
<?php require (dirname(__FILE__).'/../_inc/function.php'); ?>
<?php
	 if (!empty($_SESSION['auth_id']) && (intval($_POST['user_id']) == $_SESSION['auth_id']))
	 {
		   $user_uid = intval($_POST['user_uid']);
		   $n = intval($_POST['n']);
		   
		   $sql = mysql_query("SELECT * FROM `q_photo` WHERE `id_user` = '".$user_uid."' ORDER BY `preor` DESC;");
		   while ($arr = mysql_fetch_array($sql))
		   {
		        $fid[] = $arr['id_photo'];
		   }
		   ?>
		   
		   <table cellspacing="0" cellpadding="0" width="100%" style="border: #ccc solid 1px;">
	           <tr>
		   <?php
	           if ($n > 0) {
		   ?>
		   <td style="padding: 0 10px; cursor: pointer;" bgcolor="#eeeeee" onclick="javascript:photo_id('<?php echo $n - 1; ?>')">
	           <a href="javascript:void(0)" title="Предыдущее фото" onclick="javascript:photo_id('<?php echo $n - 1; ?>')"><div class="photo_nav pred"></div></a>
	           </td>
	           <?php } else {?>
	           <td style="padding: 0 10px;" bgcolor="#eeeeee"><div class="photo_nav pred_no"></div></td>
	           <?php } ?>
		   <td bgcolor="#eeeeee">
		   <div style="padding: 10px 0; font-size: 16px; text-align: center;">Фотография <strong><?php echo ($n + 1); ?></strong> из <strong><?php echo $_SESSION['allFoto']; ?></strong></div>
		   <div id="load_content_foto"></div>
		   
		   <?php
		   $sql = mysql_query("SELECT * FROM `q_photo` WHERE `id_photo` = '".$fid[$n]."' LIMIT 1;");
		   $array = mysql_fetch_array($sql);
	           
	           $size_foto = getimagesize('../'.DIR_PHOTOS.'/'.$array['id_user'].'/'.$array['name']);
	           
	           echo '<div id="content_fade" style="text-align: center; background: #eee;">';
		   echo '<img src="'.DIR_PHOTOS.'/'.$array['id_user'].'/'.$array['name'].'" alt="Загрузка..." style="width: '.$size_foto[0].'px; height: '.$size_foto[1].'px; margin-top: 0px;" />';
		   echo '</div>';
		   ?>
		   <div style="padding: 5px 0;">Добавлена <?php echo function_vizit($array['time']); ?></div>
		   <?php if (!empty($array['about'])) { ?>
		   <div style="float: left; width: 300px;"><?php echo htmlspecialchars(function_bigword($array['about'], 45), ENT_QUOTES); ?></div>
		   <div class="clear"></div>
		   <?php } ?>
		   </td>
		   <?php
		   if ($n < ($_SESSION['allFoto'] - 1)) {
		   ?>
		   <td style="padding: 0 10px; cursor: pointer;" bgcolor="#eeeeee" onclick="javascript:photo_id('<?php echo $n + 1; ?>')">
	           <a href="javascript:void(0)" title="Следующее фото" onclick="javascript:photo_id('<?php echo $n + 1; ?>')"><div class="photo_nav sled"></div></a>
	           </td>
	           <?php } else {?>
	           <td style="padding: 0 10px;" bgcolor="#eeeeee"><div class="photo_nav sled_no"></div></td>
	           <?php } ?>
	           </tr>
	           </table>
	           
		   <table width="100%" bgcolor="#ffffff" border="0" cellspacing="0" cellpadding="0" style="padding-top: 10px;">
<tr>
<td align="center" valign="top">


<?php if ($_POST['user_uid'] != $_SESSION['auth_id']) { ?>
<?php $q = mysql_query("SELECT * FROM `q_photo_vote` WHERE `id_foto` = '".$fid[$n]."' AND `id_user` = '".$_SESSION['auth_id']."' AND `uid_user` = '".$user_uid."' LIMIT 1;"); ?>
<?php if (mysql_num_rows($q) == 0) { ?>
<div id="photo_vote_status">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<?php for ($i = 5; $i > 0; $i--) { ?>
<td style="cursor: pointer;" onclick="photo_vote('<? echo $_SESSION['auth_id']; ?>','<? echo $user_uid; ?>','<? echo $i; ?>','<? echo $fid[$n]; ?>')"><div class="vote v<?php echo $i; ?>"></div></td>
<?php } ?>
</tr>
</table>
</div>
<?php } else { ?>
<?php $v_array = mysql_fetch_array($q); ?>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>Ваша оценка</td>
<td><div class="vote v<?php echo $v_array['asses']; ?>"></div></td>
</tr>
</table>
<?php } ?>
<?php } ?>
		   <?php
		   $comm_all = mysql_result(mysql_query("SELECT COUNT(*) FROM `q_photo_comm` WHERE `id_foto` = '".$fid[$n]."';"), 0);
		   ?>
		   <div style="background: #fff; padding: 10px 0;">
		   <span class="comm_img"></span> <?php echo $comm_all; ?> <a <?php echo ($_POST['user_uid'] != $_SESSION['auth_id'] ? 'href="/photos.php?mode=comments&amp;user_id='.$user_uid.'&amp;photo_id='.$fid[$n] : 'href="/album.php?mode=comments&amp;photo_id='.$fid[$n]); ?>">Комментировать</a>
		   </div>
	           <?php
	 }
?>