if you wanted the poll code modified, you should have asked...
ill get on it.
EDIT:
made changes to match yours. you'll only have to copy this new file over your old one.
PHP Code:
<?php
$savefile = "save.txt";
$ipfile = "ip.txt";
$cho = $_POST['choice'];
$address = $_SERVER[REMOTE_ADDR];
$mes = array(
"File Not Found",
"You, or someone using the same proxy or on the same network, have already voted.",
"You picked choice number ". $cho ."\r\n<br>Click <a href=\"?look\">Here</a> to View The Results."
);
$contentsave = file_get_contents($savefile);
$file = explode("|",$contentsave);
$contentip = file_get_contents($ipfile);
$ip = explode("\r\n",$contentip);
if(!$file || !$ip) {die($mes);};
$in = array_search($address, $ip);
if(isset($cho)) {
if($ip[$in] == $address) {
echo $mes['1'];
} else {
$file[$cho]++;
$data = implode("|",$file);
/* Save Poll Choice */
$handle = fopen($savefile,"w+");
fwrite($handle,$data);
fclose($handle);
/* Write IP */
$handip = fopen($ipfile,"a+");
fwrite($handip,$address ."\r\n");
fclose($handip);
/* Echo Out Choice Num */
echo $mes['2'];
};
} elseif (isset($_GET['look'])) { ?>
#1 - Awesome: <?php echo $file['0']; ?><br>
#2 - Ok: <?php echo $file['1']; ?><br>
#3 - Terrible: <?php echo $file['2']; ?><br>
<?php } else { ?>
<form action="poll.php" method="post">
#1 - Vote that the game is Awesome: <input type="radio" name="choice" value="0"><br>
#2 - Vote that the game is Ok: <input type="radio" name="choice" value="1"><br>
#3 - Vote that the game is Terrible: <input type="radio" name="choice" value="2"><br>
<input type="submit" value="Vote" name="Vote"></form>
<?php };
?>
Bookmarks