Файл: setk/mail/inc/attachments/photo.form.php
Строк: 34
<?
if (isset($_GET['category_id'])) {
$category_id = (int) $_GET['category_id'];
$set['p_str'] = 24;
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_foto` WHERE `id_user` = '$user[id]' AND `id_gallery` = '$category_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="mess">
У вас нет фотоальбомов
</div>
<?
}
$q = mysql_query("SELECT * FROM `gallery_foto` WHERE `id_user` = '$user[id]' AND `id_gallery` = '$category_id' ORDER BY `time` DESC LIMIT $start, $set[p_str]");
?><div class="email-list-photo"><?
while ($post = mysql_fetch_assoc($q))
{
?>
<a href="?type=<?= $type?>&attachments_id=<?= $post['id']?>">
<img src="/foto/foto50/<?= $post['id']?>.<?= $post['ras']?>" />
</a>
<?
}
?></div><?
if ($k_page > 1) {
str('?type=' . $type . '&category_id=' . $category_id . '&', $k_page, $page);
}
$urlBack = '?type=' . $type . '&category';
} elseif (isset($_GET['category'])) {
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery` WHERE `id_user` = '$user[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="mess">
У вас нет фотоальбомов
</div>
<?
}
$q = mysql_query("SELECT * FROM `gallery` WHERE `id_user` = '$user[id]' ORDER BY `time` DESC LIMIT $start, $set[p_str]");
while ($post = mysql_fetch_assoc($q))
{
$num++;
$count = mysql_result(mysql_query("SELECT COUNT(*) FROM `gallery_foto` WHERE `id_gallery` = '$post[id]'"), 0);
?>
<div class="email <?= ($num % 2 ? "nav1" : "nav2")?>">
<a href="?type=<?= $type?>&category_id=<?= $post['id']?>">
<img src="/mail/style/icons/images-stack.png" /> <?= text($post['name'])?> (<?= $count?> фото)
</a>
</div>
<?
}
if ($k_page > 1) {
str('?type=' . $type . '&category&', $k_page, $page);
}
$urlBack = '?type=' . $type;
} else {
$q = mysql_query("SELECT * FROM `gallery_foto` WHERE `id_user` = '$user[id]' ORDER BY `id` DESC LIMIT 5");
if (mysql_num_rows($q) > 0) {
?>
<div class="email-list-photo">
<?
while($post = mysql_fetch_assoc($q)) {
?>
<a href="?type=<?= $type?>&attachments_id=<?= $post['id']?>"><img src="/foto/foto50/<?= $post['id']?>.jpg" /></a>
<?
}
?>
</div>
<div class="email email-panel">
<a href="?type=<?= $type?>&category"><img src="/mail/style/icons/images.png" /> Показать все фото</a> »
</div>
<?
} else {
?>
<div class="mess">
У вас еще нет на сайте загруженных фотографий, но вы можете воспользоваться формой ниже.
</div>
<?
}
?>
<form action="?type=<?= $type?>" method="POST" enctype="multipart/form-data">
<div>
<b>Добавить файл</b><br />
<input type="file" name="file" accept="image/*,image/jpeg" />
</div>
<div>
<b>Описание</b><br />
<textarea name="msg" placeholder=""></textarea><br />
</div>
<div class="adult">
<label><input type="checkbox" name="adult" value="1" /> Файл для взрослых <span>(18+)</span></label>
</div>
<input type="submit" name="submit" value="Загрузить" />
</form>
<?
$urlBack = '/mail/messageList.php?contact='. urlencode($_SESSION['mail']['to']);
}
?>
<div class="email email-panel">
<a href="<?= $urlBack?>"><img src="style/icons/in.png" /> Назад</a>
</div>
<?