Просмотр файла viewlinks.php

Размер файла: 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="&#x041C;&#x0435;&#x043D;&#x0435;&#x0434;&#x0436;&#x0435;&#x0440; &#x0444;&#x0430;&#x0439;&#x043B;&#x043E;&#x0432;">
<do type="options" name="main" label="&#x041C;&#x0435;&#x043D;&#x044E;"><go href="main.php?id=<?php echo $id; ?>&amp;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&amp;p=$login&amp;link_id=$link[id]\">$link[name]</a>\n<br/>\n";
      }
   }
?>
Всего ссылок:<?php echo $total_links; ?>
 &#x0421;&#x0442;&#x0440;. <?php if($total_pages != 0) echo $from+1; else echo '0'; ?> &#x0438;&#x0437; <?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&amp;p=$login&amp;from=" . ($from+1) . "\">Далее</a>";
   echo "<br/>";
}

if($from != 0)
{
   echo "<a href=\"viewlinks.php?id=$id&amp;p=$login&amp;from=" . ($from-1) . "\">Назад</a>";
   echo "<br/>";
}

?>
<a href="addlinks.php?id=<?php echo $id; ?>&amp;p=<?php echo $login; ?>">Добавить</a>
<br/>
</p>
<p align="center">
*********<br/>
<a href="main.php?id=<?php echo $id; ?>&amp;p=<?php echo $login; ?>">Меню</a><br/>
</p>
</card>
</wml>