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

Размер файла: 1.4Kb
<?php
include_once 'inc/db.php';
include_once 'inc/1.php';
if ($_GET['del'] && ($user['admin']==1)){
$id=intval($_GET['del']);
mysql_query("DELETE FROM `user_vote` WHERE `id` = '$id'");
echo "<div class='msg'>Удалено</div>";
}
$page=intval($_GET['page']);
if (!$_GET['page'])$page=1;
$start=(15*$page-15);
$a=1;
$c=2;
echo "<div class='msg'>Опросы<br><a href='/crv.php'>Создать опрос</a></div>";
$vote=mysql_query("SELECT * FROM `user_vote` ORDER BY `id` DESC LIMIT $start, 15");
while ($f=mysql_fetch_assoc($vote)){
$b=($a%2);
$us=mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id` = '$f[user]'"));
if ($f['v3'])$c++;
if ($f['v4'])$c++;
if ($f['v5'])$c++;
if ($f['v6'])$c++;
$ollo=mysql_num_rows(mysql_query("SELECT * FROM `user_votes` WHERE `vote` = '$f[id]'"));
if ($user['admin']==1)echo "<div class='p$b'><a href='/v2.php?id=$f[id]'>".htmlspecialchars($f['name'])."</a> <a href='?del=$f[id]'>[<font color='red'>x</font> удал]</a><br>$us[name]/$c вар/$ollo отв</div>";
else
echo "<div class='p$b'><a href='/v2.php?id=$f[id]'>".htmlspecialchars($f['name'])."</a><br>$us[name]/$c вар/$ollo отв</div>";
$a++;
$c=2;
}
$x=mysql_num_rows(mysql_query("SELECT * FROM `user_vote`"));
if ($page>1)echo "<a href='?page=".($page-1)."'>Назад</a> ";
if ($x>15)echo "<a href='?page=".($page+1)."'>Далее</a> ";
include_once 'inc/foot.php';
?>