Размер файла: 6.64Kb
<?php
/*
Powered by NaPaZiTiVe Family
Автор кода - HOOF (ICQ: 47-888-48-35)
Организатор и автор идеи - PaZiTiF (ICQ: 738-828)
E-Mail: [email protected]
[email protected]
Официальный сайт проекта: http://napazitive.ru
Вы не имеете права продавать скрипт, присваивать себе авторство!
Разрешено вносить изменения в код скрипта, но при этом первоначальное авторство должно учитываться и сохраняться.
*/
$title='Голосование';
require'../system/config.php';
require'../system/o_inc.php';
require'../system/t_inc.php';
require'../system/inc_vizual.php';
echo $up;
echo'<div class="i">Голосование<br></div>';
if(isset($_GET['gtype'])){$gtype=prov($_GET['gtype']);}else{$gtype='norm';}
if(isset($_GET['id_vote'])){$id_vote=cifry($_GET['id_vote']);}else{$id_vote=0;}
switch($mod){
//Все голосования
default:
require'../system/auth.php';
if(isset($_GET['st'])){$st=cifry($_GET['st']);}else{$st=0;}
$num=5;
$avote=mysql_query("select * from votes where type='$gtype'");
$svote=mysql_query("select * from votes where type='$gtype' order by id_vote desc limit $st,$num");
$kol=mysql_num_rows($avote);
if($kol==0){
echo'<div class="p">Пока нет голосований...<br></div>';
}else{
while($vote=mysql_fetch_array($svote)){
echo'<div class="p">
<a href="./?mod=1&id_vote='.$vote['id_vote'].'&gtype='.$gtype.'&'.$s.'">'.vizual($vote['vopros']).'</a><br>
</div>';
}
if($st!=0){
echo'<div class="p"><img src="../design/default/act.gif" alt="-"> <a href="./?st='.($st-$num).'&gtype='.$gtype.'&'.$s.'">Назад</a><br></div>';
}
if($kol>$st+$num){
echo'<div class="p"><img src="../design/default/act.gif" alt="-"> <a href="./?st='.($st+$num).'&gtype='.$gtype.'&'.$s.'">Далее</a><br></div>';
}
}
break;
//О голосовании
case'1':
$votes=mysql_query("select * from votes where type='$gtype' and id_vote='$id_vote' limit 1");
if(mysql_num_rows($votes)==0){
echo'<div class="p">Голосования с таким ID нет!<br></div>';
}else{
$vote=mysql_fetch_array($votes);
echo'<div class="p">'.vizual($vote['vopros']).'<br>
Ответы:<br>';
if($vote['konec']==1){
if(!empty($vote['otvet1'])){echo'1) '.$vote['otvet1'].'<br>';}
if(!empty($vote['otvet2'])){echo'2) '.$vote['otvet2'].'<br>';}
if(!empty($vote['otvet3'])){echo'3) '.$vote['otvet3'].'<br>';}
if(!empty($vote['otvet4'])){echo'4) '.$vote['otvet4'].'<br>';}
if(!empty($vote['otvet5'])){echo'5) '.$vote['otvet5'].'<br>';}
if(!empty($vote['otvet6'])){echo'6) '.$vote['otvet6'].'<br>';}
if(!empty($vote['otvet7'])){echo'7) '.$vote['otvet7'].'<br>';}
echo date('d.m.Y - H:i',$vote['kogda']).'<br>';
}else{
if(!empty($vote['otvet1'])){echo'1) <a href="./?gtype='.$gtype.'&id_vote='.$id_vote.'&otvet=1&mod=2&'.$s.'">'.$vote['otvet1'].'</a><br>';}
if(!empty($vote['otvet2'])){echo'2) <a href="./?gtype='.$gtype.'&id_vote='.$id_vote.'&otvet=2&mod=2&'.$s.'">'.$vote['otvet2'].'</a><br>';}
if(!empty($vote['otvet3'])){echo'3) <a href="./?gtype='.$gtype.'&id_vote='.$id_vote.'&otvet=3&mod=2&'.$s.'">'.$vote['otvet3'].'</a><br>';}
if(!empty($vote['otvet4'])){echo'4) <a href="./?gtype='.$gtype.'&id_vote='.$id_vote.'&otvet=4&mod=2&'.$s.'">'.$vote['otvet4'].'</a><br>';}
if(!empty($vote['otvet5'])){echo'5) <a href="./?gtype='.$gtype.'&id_vote='.$id_vote.'&otvet=5&mod=2&'.$s.'">'.$vote['otvet5'].'</a><br>';}
if(!empty($vote['otvet6'])){echo'6) <a href="./?gtype='.$gtype.'&id_vote='.$id_vote.'&otvet=6&mod=2&'.$s.'">'.$vote['otvet6'].'</a><br>';}
if(!empty($vote['otvet7'])){echo'7) <a href="./?gtype='.$gtype.'&id_vote='.$id_vote.'&otvet=7&mod=2&'.$s.'">'.$vote['otvet7'].'</a><br>';}
}
echo'<img src="../design/default/act.gif" alt="-"> <a href="./?gtype='.$gtype.'&id_vote='.$id_vote.'&mod=3&'.$s.'">Результаты</a><br></div>';
}
break;
//Учёт голоса
case'2':
if($vhod==1){
$otvet=cifry($_GET['otvet']);
$votes=mysql_query("select * from votes where type='$gtype' and id_vote='$id_vote' limit 1");
if(mysql_num_rows($votes)==0){
echo'<div class="p">
Голосования с таким ID нет!<br>
</div>';
}else{
if($vote['konec']==1){
echo'<div class="p">
Голосование уже окончено!<br>
</div>';
}else{
$suchgol=mysql_num_rows(mysql_query("select * from votes_otv where id_User='$id_user' and id_vote='$id_vote' limit 1"));
if($suchgol==1){
echo'<div class="p">Вы уже голосовали!<br></div>';
}else{
mysql_query("insert into votes_otv set id_user='$id_user', id_otvet='$otvet', id_vote='$id_vote'");
echo'<div class="p">Ваш голос учтён! Спасибо!<br></div>';
}
}
}
}else{
echo'<div class="p">Вы не авторизованы!<br></div>';
}
break;
//Результаты
case'3':
$votes=mysql_query("select * from votes where type='$gtype' and id_vote='$id_vote' limit 1");
if(mysql_num_rows($votes)==0){
echo'<div class="p">Голосования с таким ID нет!<br></div>';
}else{
$vote=mysql_fetch_array($votes);
echo'<div class="p">'.vizual($vote['vopros']).'<br>
Ответы:<br>';
if(!empty($vote['otvet1'])){
$otvet1=mysql_num_rows(mysql_query("select * from votes_otv where id_otvet='1' and id_vote='$id_vote'"));
echo'1) '.$vote['otvet1'].' ['.$otvet1.']<br>';}
if(!empty($vote['otvet2'])){
$otvet2=mysql_num_rows(mysql_query("select * from votes_otv where id_otvet='2' and id_vote='$id_vote'"));
echo'2) '.$vote['otvet2'].' ['.$otvet2.']<br>';}
if(!empty($vote['otvet3'])){
$otvet3=mysql_num_rows(mysql_query("select * from votes_otv where id_otvet='3' and id_vote='$id_vote'"));
echo'3) '.$vote['otvet3'].' ['.$otvet3.']<br>';}
if(!empty($vote['otvet4'])){
$otvet4=mysql_num_rows(mysql_query("select * from votes_otv where id_otvet='4' and id_vote='$id_vote'"));
echo'4) '.$vote['otvet4'].' ['.$otvet4.']<br>';}
if(!empty($vote['otvet5'])){
$otvet5=mysql_num_rows(mysql_query("select * from votes_otv where id_otvet='5' and id_vote='$id_vote'"));
echo'5) '.$vote['otvet5'].' ['.$otvet5.']<br>';}
if(!empty($vote['otvet6'])){
$otvet6=mysql_num_rows(mysql_query("select * from votes_otv where id_otvet='6' and id_vote='$id_vote'"));
echo'6) '.$vote['otvet6'].' ['.$otvet6.']<br>';}
if(!empty($vote['otvet7'])){
$otvet7=mysql_num_rows(mysql_query("select * from votes_otv where id_otvet='7' and id_vote='$id_vote'"));
echo'7) '.$vote['otvet7'].' ['.$otvet7.']<br>';}
echo'</div>';
}
break;
}
echo'<div class="p"><img src="../design/default/act.gif" alt="-"> <a href="../?'.$s.'">На главную</a><br></div>';
echo $down;
?>