Файл: photos_top.php
Строк: 18
<?
require_once("core/core.php");
$location = 'В ТОП-фото';
include 'head.php';
echo '<div class="title"><center><b>ТОП фото</b></center></div>';
$all = mysql_result(mysql_query("SELECT COUNT(*) FROM `photos_photo` WHERE `top` = '1'"), 0);
if ($all > 0) {
$total = intval(($all - 1) / 10) + 1;
$page = intval($_GET['page']);
if (empty($page) or $page < 0)
$page = 1;
if ($page > $total)
$page = $total;
$start = $page * 10 - 10;
$result = mysql_query("SELECT * FROM `photos_photo` WHERE `top` = '1' ORDER BY `rating` DESC LIMIT $start, 10");
while ($photo = mysql_fetch_assoc($result)) {
echo $i % 2 ? '<div class="div">' : '<div class="nav">';
$user = mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id` = '" . $photo["user"] . "'"));
$arhiv = intval(($user['id'] / 1000) + 1);
$name = checkout($photo['name']);
$info = getimagesize('base/' . $arhiv . '/' . $user['id'] . '/photos_small/' . $photo['id'] . '.jpg');
if ($info[0] <= 320) {
echo '<a href = "photos.php?act=photo&id=' . $photo['id'] . '"><img src = "base/' . $arhiv . '/' . $user['id'] . '/photos_small/' . $photo['id'] . '.jpg" ></a>';
} else {
echo '<a href = "photos.php?act=photo&id=' . $photo['id'] . '"><img src = "base/' . $arhiv . '/' . $user['id'] . '/photos_small/' . $photo['id'] . '.jpg" width = "65px"" height = "60%" ></a>';
}
echo '</div>';
$i++;
}
navigation($page, $total, 'photos_top.php?&sort=' . $sort . '&');
} else {
echo '<div class="div">Фотографий пока нет!</div>';
}
echo '</div>';
include 'foot.php';
?>