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

Размер файла: 1.4Kb
  1. <?php
  2. include_once 'inc/db.php';
  3. include_once 'inc/1.php';
  4. if ($_GET['del'] && ($user['admin']==1)){
  5. $id=intval($_GET['del']);
  6. mysql_query("DELETE FROM `user_vote` WHERE `id` = '$id'");
  7. echo "<div class='msg'>Удалено</div>";
  8. }
  9. $page=intval($_GET['page']);
  10. if (!$_GET['page'])$page=1;
  11. $start=(15*$page-15);
  12. $a=1;
  13. $c=2;
  14. echo "<div class='msg'>Опросы<br><a href='/crv.php'>Создать опрос</a></div>";
  15. $vote=mysql_query("SELECT * FROM `user_vote` ORDER BY `id` DESC LIMIT $start, 15");
  16. while ($f=mysql_fetch_assoc($vote)){
  17. $b=($a%2);
  18. $us=mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id` = '$f[user]'"));
  19. if ($f['v3'])$c++;
  20. if ($f['v4'])$c++;
  21. if ($f['v5'])$c++;
  22. if ($f['v6'])$c++;
  23. $ollo=mysql_num_rows(mysql_query("SELECT * FROM `user_votes` WHERE `vote` = '$f[id]'"));
  24. 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>";
  25. else
  26. echo "<div class='p$b'><a href='/v2.php?id=$f[id]'>".htmlspecialchars($f['name'])."</a><br>$us[name]/$c вар/$ollo отв</div>";
  27. $a++;
  28. $c=2;
  29. }
  30. $x=mysql_num_rows(mysql_query("SELECT * FROM `user_vote`"));
  31. if ($page>1)echo "<a href='?page=".($page-1)."'>Назад</a> ";
  32. if ($x>15)echo "<a href='?page=".($page+1)."'>Далее</a> ";
  33. include_once 'inc/foot.php';
  34. ?>
  35.