0) ){ if (getenv("HTTP_CLIENT_IP")){ $ip = getenv("HTTP_CLIENT_IP"); } elseif(getenv("HTTP_X_FORWARDED_FOR")) { $ip = getenv("HTTP_X_FORWARDED_FOR"); } elseif(getenv("REMOTE_ADDR")){ $ip = getenv("REMOTE_ADDR"); } else { $ip = "UNKNOWN"; } $sSQL = "SELECT (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(time)) AS time FROM poll_votes WHERE ip='".$ip."' AND poll_id = ".$poll_id.""; //echo $sSQL; $result = mysql_query( $sSQL); $r = mysql_fetch_assoc($result); if ($r['time'] && $r['time']<2592000) { $bFlag++; Header("Location: results.php?mess=nok&poll_id=".$poll_id.""); }elseif( $_COOKIE[$c_name]==$poll_id ){ $bFlag++; Header("Location: results.php?mess=nok&poll_id=".$poll_id.""); } if( $bFlag == 0 ){ $sSQL = "INSERT INTO poll_votes SET poll_id='".$poll_id."', ip='".$ip."', time=CURDATE()"; $result = mysql_query( $sSQL ); $sSQL = "UPDATE LOW_PRIORITY poll_answears SET broi = broi + 1 WHERE poll_id = ".$poll_id." AND ans_id = ".$ans_id.""; $result = mysql_query( $sSQL ); setcookie("FMAnketa_".$poll_id."", $poll_id, time()+2592000); Header("Location: results.php?mess=ok&poll_id=".$poll_id.""); } } $poll = 1; include "../header.inc"; echo '
АНКЕТИ
'; if( $_COOKIE[$c_name] == $poll_id ){ echo '

Вече сте гласувал за тази анкета!

Вижте резултатите »»'; }else{ $sSQL = "SELECT id, title, date FROM poll_poll WHERE active = '1' AND id = ".$Gpoll_id." "; $result = mysql_query( $sSQL ); $row = mysql_fetch_assoc($result); echo '
'.$row['title'].'
'; $sSQL = "SELECT ans_id, answear FROM poll_answears WHERE poll_id = ".$Gpoll_id." ORDER BY ans_id ASC "; $result = mysql_query( $sSQL ); while($row = mysql_fetch_assoc($result)){ echo ' '.$row['answear'].'
'; } echo '
'; } include "../footer.inc"; ?>