Salve! Con i miei soliti esperimenti sono arrivato a questo, un sondaggio che non fa votare gli stessi IP:
pagina vs.php:
pagina result.php:Codice HTML:<form id="form1" name="form1" method="get" action="result.php"> <label> <input name="radiobutton" type="radio" value="a" /> </label> a <br /> <input name="radiobutton" type="radio" value="b" /> b <br /> <input name="radiobutton" type="radio" value="c" /> c<br /> <input name="radiobutton" type="radio" value="d" /> d<br> <input name="radiobutton" type="radio" value="e" /> e <p> <label> <input type="submit" name="Submit" value="Vota!" /> </label> </p> </form>
Ma non funziona (ovviamente).Codice PHP:<?php
echo $_GET['radiobutton'];
$ip=$_SERVER['REMOTE_ADDR'];
if (file_exists('ip/'.$ip)) {
echo "Hai già votato!";
} else {
$file=file_get_contents($_GET['radiobutton']);
$var=fopen($_GET['radiobutton'],"w+");
$file=fread($var,filesize($_GET['radiobutton']));
$filedopo=$file + 1;
fwrite($var,$filedopo);
fclose($var);
$scriviip=fopen('ip/'.$ip,"w+");
fclose($scriviip);
}
?>
Dove sbaglio? Saluti!

LinkBack URL
About LinkBacks

