Просмотр файла gallery/index.php

Размер файла: 2.21Kb
<?php

require '../inc/func.php';
bk_head('Photos Album');
require '../inc/head.php';


if(!$user){
header('location: /index.php');
}

$id = (isset($_GET['id'])) ? num($_GET['id']) : NULL;


if(!$id){
$id = $userid;
}
$ch_id = mysql_query("SELECT id FROM users WHERE id = '$id' ");
if(!mysql_num_rows($ch_id)){
err (''.$lng_up['user'].'');
bk_foot();
exit;
}

if (!$id) {
	$id = $userid;
}
echo '<div class="list1">';
echo '<div class="tt">&nbsp;'.$lng_up['title'].'</div>';
if($id != $userid){
	echo ''.$lng_up['al'].' ';
	user($id);
} else {
	echo ''.$lng_up['al2'].'';
}

$count = mysql_result(mysql_query("SELECT COUNT(id) FROM `album` WHERE `user` = '$id'"),0);

if($count <= 0) {
	echo '<div class="index">'.$lng_up['al3'].'</div>';
}
//*Trang*//
$total = mysql_result(mysql_query("SELECT COUNT(*) FROM `album` WHERE `user` = '$id'"), 0);

$display = 3;
$count_pages = ceil($total/$display);
$page = (isset($_GET['page']) and is_numeric($_GET['page']) and $_GET['page']>1 and $_GET['page']<=$count_pages) ? $_GET['page'] : 1;
$start = $page*$display-$display;
//*Trang*//
$q = mysql_query("SELECT * FROM `album` WHERE `user` = '$id' ORDER BY `time` DESC LIMIT $start,$display");
while($album = mysql_fetch_assoc($q)) {
	echo '<div class="list1">';
		echo '<img src="/images/o.gif" alt="-" /> <a href="album.php?num=' . $album['id'] . '&amp;iau=' . $id . '">' . tags($album['name']) . '</a> [' . mysql_result(mysql_query("SELECT COUNT(id) FROM `album_photo` WHERE `album` = '$album[id]'"), 0) . ']';
	if ($id == $userid) {
		echo ' <a href="edit_album.php?num=' . $album['id'] . '"><img src="/images/pen.png" alt="" title="edit" /></a> [<a href="edit_album.php?num=' . $album['id'] . '&amp;dell" title="del">x</a>]';
	}
	echo '</div>' ;
}

if ($id == $userid) {
	echo '<a href="add_album.php"><input class="green" value="&rarr; '.$lng_up['add'].'" type="button"></a><br />';
}
if($total > 3 && $page < $count_pages)
{
echo '<div class="shadow">';
pages($page,$count_pages,'?page=');
echo '</div>';
}
echo '<hr><div class="shadow"><a href="/users/my.php"><b>My Menu</b></a> | <a href="/u/'.$userid.'"><b>Profile</b></a> | <a href="/exit.php"><b>LogOut</b></a></div></div>';
bk_foot();
?>