require_once("include/config.inc.php"); $result = mysql_query("select * from pollquestion where published = 1"); $poll = mysql_fetch_array($result); /** * Disabling cookie - rather just always show the poll */ //if ($_COOKIE["pollvoted_".$poll["pollquestion_uid"]]){ //if they already voted stop show them results only // include("index_pollresults.php"); // exit(); //} $result = mysql_query("select * from pollquestion where pollquestion_uid = '".$poll["pollquestion_uid"]."'"); $pollquestion = mysql_fetch_array($result); $q = "select * from pollanswer where pollquestion_uid = '".$pollquestion["pollquestion_uid"]."'"; $result = mysql_query($q); while ($row = mysql_fetch_array($result)){ $pollanswers[] = $row; } if ($_POST['pollanswer']) { mysql_query("insert into pollvote (pollquestion_uid, pollanswer_uid, datetime) values ('".$pollquestion["pollquestion_uid"]."', '".$_POST['pollanswer']."', NOW())"); setcookie("pollvoted_".$poll["poll_uid"], 1, mktime(0,0,0,6,14,2010)); header("Location: http://".$_SERVER['HTTP_HOST']."".str_replace("index.php", "index_pollresults.php", $_SERVER['REQUEST_URI'])); exit(); } ?>
website by webfactory
photographs © touchline & gallo images