include ('connect.phtml'); # English language version of voting script ## 1. check for viarables if(!$id) { print "You didn't select a participant to vote for\n"; exit; } ## 2. consturct cookie $dat=date("Y-m-d",time()); $dat=$country.$dat; ## 3. check if cookie is present if (${$dat}) { print "You can't vote for a country more than one time per day, sorry. Please try again tomorrow\n"; } else { ## 4. set voting cookie for today setcookie("$dat","voted",time()+31536000,"","",0); ## 5. check if the cookie was set # if (!${$dat}) { # if ($lang) { print "Your browser doesn't support cookies. Sorry, you can't vote from it\n"; } # else { print "Ваш броузер не поддерживает cookie. Извините, Вы не сможете голосовать с него\n"; } # exit; # } else { ## 6. cookie set Ok, proceed to voice counting. Open filename and write the voice. $line = "[".$dat."][Name=".$name."][Email=".$email."][Girl=".$id."]\n"; $filename = "/usr/local/apache/data/2003.log"; $fp = fopen ($filename, "a"); fwrite($fp, $line, 256); fclose($fp); $res=mysql_query("update girls set votes=votes+1 where ID='$id'"); ## 7. Ok, data written, give thanks ?>