File size: 3.26Kb
<?php
////////////////////////////////////////////
//
// Скрипт Голосований на MySql
//
// Версия - 1.0 (wap1.1)
// Автор - CHEZZ
// гМыло :) - [email protected]
// wap-сайт - http://underwap.net
//
////////////////////////////////////////////
Error_Reporting(E_ALL & ~E_NOTICE);
header("Pragma: no-cache");
header ("Content-type:text/vnd.wap.wml; charset=utf-8");
include "config.php"; /////Подключаем настройки
include "connect.php"; /////Подключаемся к БД
include "func.php"; /////Подключаем функции
if (isset($p))
{
$p=filtr($p);
$z=filtr($z);
if(!isset($z)) $z="";
} else {
$z=""; }
@mysql_query("OPTIMIZE TABLE vote_votes");
@mysql_query("OPTIMIZE TABLE vote_count");
//@mysql_query("OPTIMIZE TABLE vote_admin");
$r3=mysql_query("SELECT * FROM vote_votes");
if ($z==false OR $z==1) { $start=0; $page="first"; }
else
{
$pg=mysql_num_rows($r3)/$na_stranice;
if ($p="next") $start=$z*$na_stranice-$na_stranice;
else $start=$z*$na_stranice+$na_stranice;
$pg=ceil($pg);
$minpage=1;
$maxpage=$pg;
}
if (!isset($page))
{
if ($z == $maxpage) $page="last";
else $page="some";
}
$thispage=$z;
$r=mysql_query("SELECT * FROM vote_votes ORDER BY `id` DESC LIMIT $start, $na_stranice");
$r2=mysql_query("SELECT countall FROM vote_count ORDER BY `id` DESC LIMIT $start, $na_stranice");
body_begin();
echo "<p><b>Голосования:</b></p>";
for($i = 0;$i < mysql_num_rows($r);$i++)
{
if(!isset($num))
{
if(isset($p))
{
$num=$start+1;
}
else $num=1;
}
else $num++;
$row = mysql_fetch_array($r);
$row2 = mysql_fetch_array($r2);
$id = $row['id'];
$count = $row2['countall'];
if(!$count) $count="0";
$name = $row['name'];
echo $num.') <a href="show.php?id='.$id.'">'.$name."</a> [".$count."]<br/>\n";
}
if (mysql_num_rows($r3)>$na_stranice)
{
if ($page=="first")
{
$z=2;
echo "<anchor title=\"next\">$next<go href=\"index.php?p=next\" method=\"post\">\n";
echo "<postfield name=\"z\" value=\"$z\"/>\n";
echo "</go></anchor><br/>\n";
}
elseif ($page=="last")
{
$z=$thispage-1;
echo "<anchor title=\"prev\">$prev<go href=\"index.php?p=prev\" method=\"post\">\n";
echo "<postfield name=\"z\" value=\"$z\"/>\n";
echo "</go></anchor><br/>\n";
}
else
{
$z=$thispage-1;
echo "<anchor title=\"prev\">$prev<go href=\"index.php?p=prev\" method=\"post\">\n";
echo "<postfield name=\"z\" value=\"$z\"/>\n";
echo "</go></anchor>/";
$z=$thispage+1;
echo "<anchor title=\"next\">$next<go href=\"index.php?p=next\" method=\"post\">\n";
echo "<postfield name=\"z\" value=\"$z\"/>\n";
echo "</go></anchor><br/>\n";
}
}
echo "<br/><a href=\"http://$main_link\">$main_name</a>\n\r";
echo "$copy";
body_end();
mysql_close($connect);
?>