Размер файла: 2.85Kb
<?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="links" title="Менеджер файлов">
<do type="options" name="main" label="Меню"><go href="<?php echo $_GET['login']; ?>/index.wml"/></do>
<p>
<?php
$links_list = '';
$login = addslashes($_GET['login']);
$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 AND l.id = "' . (int)$_GET['vote_id'] . '" LIMIT 1');
$months = array('января', 'февраля', 'марта', 'апреля', 'мая', 'июня', 'июля', 'августа', 'сентября', 'октября', 'ноября', 'декабря');
if(($n = mysql_num_rows($links)) > 0)
{
while($link = mysql_fetch_array($links, MYSQL_ASSOC))
{
$raw_date = $link['date'];
$month = (int)substr($raw_date, 5, 2);
$month = $months[$month-1];
$day = (int)substr($raw_date, 8, 2);
$hour = (int)substr($raw_date, 11, 2);
$minute = (int)substr($raw_date, 14, 2);
$links_list .= "$link[question]\n<br/>[от $day $month]\n<br/>\n";
}
}
$n = 1;
$links = mysql_query('SELECT sum(votes) FROM polls_answers WHERE qid = "' . (int)$_GET['vote_id'] . '"');
list($total_votes) = mysql_fetch_array($links);
$links = mysql_query('SELECT l.qid as qid, l.answer as answer, l.votes as votes FROM polls_answers l WHERE l.qid = "' . (int)$_GET['vote_id'] . '" ORDER by aid');
// echo mysql_error();
while($link = mysql_fetch_array($links, MYSQL_ASSOC))
{
if($total_votes != 0)
$links_list .= "<b>$n.</b> $link[answer]<br/>[голосов: $link[votes] ] " . sprintf("%.1f", 100.0 * $link['votes'] / $total_votes) . " %<br/>";
else
$links_list .= "<b>$n.</b> $link[answer]<br/>[голосов: $link[votes] ] " . sprintf("%.1f", 0) . " %<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 $links_list; ?>
<?php
if($banner == 'bottom')
echo get_random_link();
?>
<br/>
<br/>
<a href="vote_answer.php?login=<?php echo $_GET['login']; ?>&vote_id=<?php echo $_GET['vote_id']; ?>">Голосовать</a>
<br/>------<br/>
<a href="votes.php?login=<?php echo $_GET['login']; ?>">Все опросы</a>
<br/>
<a href="<?php echo $_GET['login']; ?>/">На главную</a>
</p>
</card>
</wml>