File size: 2.15Kb
<?php
require('includes/header.php');
require('includes/utils.php');
require('includes/db.php');
require('includes/auth.php');
$max_pages = 5;
?>
<wml>
<head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>
<card id="links" title="Менеджер файлов">
<do type="options" name="main" label="Меню"><go href="main.php?id=<?php echo $id; ?>&p=<?php echo $login; ?>"/></do>
<p>
<?php
$links_list = '';
if(isset($_GET['from']))
$from = $_GET['from'];
else
$from = 0;
$links = mysql_query('SELECT count(*) FROM links WHERE user_id = "' . (int)($_GET['id']) . '"');
list($total_links) = mysql_fetch_array($links);
$total_pages = ceil($total_links / $max_pages);
$links = mysql_query('SELECT id, name, url FROM links WHERE user_id = "' . (int)($_GET['id']) . '" LIMIT ' . $from * $max_pages . ', ' . $max_pages);
//$links = mysql_query('SELECT id, name, url FROM links WHERE user_id = "' . (int)($_GET['id']) . '"');
if(($n = mysql_num_rows($links)) > 0)
{
while($link = mysql_fetch_array($links, MYSQL_ASSOC))
{
$links_list .= "<a href=\"editlinks.php?id=$id&p=$login&link_id=$link[id]\">$link[name]</a>\n<br/>\n";
}
}
?>
Всего ссылок:<?php echo $total_links; ?>
Стр. <?php if($total_pages != 0) echo $from+1; else echo '0'; ?> из <?php echo $total_pages; ?><br/>
<?php echo $links_list; ?>
<br/>
<?php
if(($from+1) != $total_pages && $total_pages != 0)
{
echo "<a href=\"viewlinks.php?id=$id&p=$login&from=" . ($from+1) . "\">Далее</a>";
echo "<br/>";
}
if($from != 0)
{
echo "<a href=\"viewlinks.php?id=$id&p=$login&from=" . ($from-1) . "\">Назад</a>";
echo "<br/>";
}
?>
<a href="addlinks.php?id=<?php echo $id; ?>&p=<?php echo $login; ?>">Добавить</a>
<br/>
</p>
<p align="center">
*********<br/>
<a href="main.php?id=<?php echo $id; ?>&p=<?php echo $login; ?>">Меню</a><br/>
</p>
</card>
</wml>