Размер файла: 2.06Kb
<?php
require('includes/header.php');
require('includes/utils.php');
require('includes/db.php');
$max_pages = 5;
?>
<wml>
<head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>
<card id="votes" title="Голосования">
<do type="options" name="main" label="Меню"><go href="<?php echo $_GET['login']; ?>/index.wml"/></do>
<p>
<?php
$links_list = '';
if(isset($_GET['from']))
$from = $_GET['from'];
else
$from = 0;
$login = addslashes($_GET['login']);
$links = mysql_query('SELECT count(*) FROM polls_questions l, users u WHERE u.login = "' . $login . '" AND u.id = l.user_id');
list($total_links) = mysql_fetch_array($links);
$total_pages = ceil($total_links / $max_pages);
$links = mysql_query('SELECT l.id as id, l.question as question, l.date as date FROM polls_questions l, users u WHERE u.login = "' . $login . '" AND u.id = l.user_id LIMIT ' . $from * $max_pages . ', ' . $max_pages);
if(($n = mysql_num_rows($links)) > 0)
{
while($link = mysql_fetch_array($links, MYSQL_ASSOC))
{
$links_list .= "<a href=\"vote.php?login=$_GET[login]&vote_id=$link[id]\">$link[question]</a>\n<br/>\n";
}
}
$banners = mysql_query('SELECT banner FROM users WHERE login = "' . $login . '"');
list($banner) = mysql_fetch_array($banners);
?>
<?php
if($banner == 'top')
echo get_random_link();
?>
Всего голосований:<?php echo $total_links; ?>
Стр. <?php if($total_pages != 0) echo $from+1; else echo '0'; ?> из <?php echo $total_pages; ?><br/>
<?php echo $links_list; ?>
<?php
if($banner == 'bottom')
echo get_random_link();
?>
<br/>
<?php
if(($from+1) != $total_pages)
{
echo "<a href=\"votes.php?login=$login&from=" . ($from+1) . "\">Далее</a>";
echo "<br/>";
}
if($from != 0)
{
echo "<a href=\"votes.php?login=$login&from=" . ($from-1) . "\">Назад</a>";
echo "<br/>";
}
?>
</p>
<p align="center">
</p>
</card>
</wml>