thank you very much for the reply, I figured out I need a server program and now I use wampserver.I'm a newb so there is no way I could knew about that.
So anyway i modified the code for a couple of days but with my limited knowledge in php and java script I can't figure out how to prevent users from voting more then once with the ip algorithm.I need an algorithm to check if a given ip have voted and if it did, i need to show up results directly, not showing any messages.
I am trying with cookies right now, cuz it seems to be easier and i have lost too much time already so i would be happy on any sort of solution that prevents double voting at least on 1-rst level:
PHP Code:
<?php
error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED);
$vote = $_REQUEST['vote'];
//get content of textfile
$filename = "poll_result.txt";
$content = file($filename);
//put content in array
$array = explode("||", $content[0]);
$yes = $array[0];
$no = $array[1];
if( isset( $_COOKIE['vote']))
{
?>
<div id="quiz"><a href="#">Did you know...</a></div>
<div id="quiz2">
<h2 >Did you know Ring of Slaying has a right-click option to check kills?</h2>
<table cellpadding="0px" cellspacing="0px" style="background:#CEB98E;font-weight:normal;" >
<tr>
<td>Yes:</td>
<td>
<img style="margin:0px;padding:0px;"src="poll.gif"
width='<?php echo(100*round($yes/($no+$yes),2)); ?>'
height='20'>
<?php echo(100*round($yes/($no+$yes),2)); ?>%
</td>
</tr>
<tr>
<td>No:</td>
<td>
<img src="poll.gif"
width='<?php echo(100*round($no/($no+$yes),2)); ?>'
height='20'>
<?php echo(100*round($no/($no+$yes),2)); ?>%
</td>
</tr>
</table>
</div>
<?php
}
else{
?>
<div id="poll">
<div id="quiz"><a href="#">Did you know...</a></div>
<div id="quiz2">
<h2>Ring of Slaying has a right-click option to check kills?</h2>
<a name="vote" href="javascript:getVote(0)">Yes</a>
<a name="vote" href="javascript:getVote(1)">No</a>
</div>
</div>
<?php
}
?>
javascr. file:
Code:
function commonfunca(){
setcookie(vote);
getVote(0)
}
function commonfuncb(){
setcookie(vote);
getVote(1)
}
function setcookie ("vote", "vote", )
var xmlhttp;
function getVote(int)
{
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
{
alert ("Browser does not support HTTP Request");
return;
}
var url="poll_vote.php";
url=url+"?vote="+int;
url=url+"&sid="+Math.random();
xmlhttp.onreadystatechange=stateChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}
function stateChanged()
{
if (xmlhttp.readyState==4)
{
document.getElementById("poll").innerHTML=xmlhttp.responseText;
}
}
function GetXmlHttpObject()
{
var objXMLHttp=null;
if (window.XMLHttpRequest)
{
objXMLHttp=new XMLHttpRequest();
}
else if (window.ActiveXObject)
{
objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
return objXMLHttp;
}
my idea is to set commonfunca() which start the two functions getvote and setcookie and after that to check with php if the cookie was set and show the results if it is.
But the problem is that I can't figure out how to set a cookie in javascript 

I would be very happy if somebody can replace the example with real values which I can replece with my own, cuz I don't know if javascript want quotations, or no quotations:
Code:
function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}
thanks and sorry for the stupid question.
Bookmarks