hmm, ok, this is the current script i have got:
<--! Questions and options calling !-->
<?php
$questionlist = file("quest.inc.php");
for ($i=1; $i<count($questionlist); $i++) {
list($q,$o1,$o2,$o3,$o4) = explode(':',chop($questionlist[$i]));
echo "<tr>";
echo "<b>$q</b><br><Br><input type=\"radio\" name=\"vote\" value=\"a\">$o1<br><input type=\"radio\" name=\"vote\" value=\"b\">$o2<br><input type=\"radio\" name=\"vote\" value=\"c\">$o3<br><input type=\"radio\" name=\"vote\" value=\"d\">$o4<br><input type=\"text\" name=\"email\" value=\"\">";
echo "</tr>\n";
}
?>
<--! End Questions and options calling !-->
<--! Submit stuff in form goes here !-->
<--! Allready voted check, and submit to file !-->
<?php
} else {
$polllist = file("poll.inc.php");
$done = false;
$auth = false;
$found = false;
$i = 0;
while ((!$found) && ($i<count($polllist))) {
$i++;
list($e,$v) = explode(':',$polllist[$i]);
$found = ($e==$email);
}
if ($found) {
echo "<b>Error: Either you have allready voted recently, or you did not suply an email address. Please Try Again<br><br></b>";
echo "<a class=towhite href=\"javascript: history.back();\">Back</a>";
}
elseif(!$email)
{
echo "<b>Error: You Must Supply an email address - please try again<br><br></b>";
echo "<a class=towhite href=\"javascript: history.back();\">Back</a>";
}
elseif(!$vote)
{
echo "<b>Error: You did not select an answer - please try again<br><br></b>";
echo "<a class=towhite href=\"javascript: history.back();\">Back</a>";
}
else {
$e = $email;
$v = $vote;
$i = count($polllist);
$polllist[$i] = implode(':',array($e,$v));
sort($polllist);
$fd = fopen("poll.inc.php","w");
fputs($fd,"<?php die(\"Access restricted\"); ?>
\n"); for ($i=1; $i<count($polllist); $i++) {
fputs($fd,chop($polllist[$i])."\n");
}
fclose($fd);
echo "<b>Thanxs for voting";}}?><br>
It checks for the question and options from a file called quest.inc.php,
Then it stores the users vote to:
poll.inc.php
It atm, checks users Email address's that they put in, but what can i do to make it use their ip address?