Possible Duplicate:
AJAX only access
So I have these javascript functions I run depending on who won a contest.
function winA()
{
var x = "<?php echo $id;?>"
$.ajax({ url: 'win.php' ,
data: { id: x }
});
}
function winB()
{
var val = "<?php echo $i;?>"
$.ajax({ url: 'win.php' ,
data: { id: val }
});
}
The file win.php updates a MySQL with who won. What troubles me is if someone simply goes to
http://mysite.com/win.php?id=1
and refreshes it a whole lot of times I clearly will have some incorrect results on the MySQL server.
I am wondering exactly how one would make it so that URL could only be accessed when appropriate, via this ajax call. Alternatively make it so the win.php file only to actually execute when it has 'authorization' that expires after loading the php file.
Thanks in advance, Aaron.