Open GoogleCodeExporter opened 9 years ago
One can have same page on many tabs. Only sure way to fix this would be to send
unnique hash with the answer to the server with $_POST.
Unique value can be simply made by UUID class with
http://stackoverflow.com/questions/2413754/how-to-create-uniqe-key-value-in-php#
answer-2413781 v4 is pseudorandom and should be enough for this purpose.
<img src="captcha.php?mathrandomstuff&check=UNIQUE_FOR_EACH_PAGE_VIEW" />
<input type="hidden" name="check" value="UNIQUE_FOR_EACH_PAGE_VIEW" />
<input type="text" name="chekcAgainst" value="" />
Check would be unique for each word (not image).
So when generating image (or regenerating it):
$_SESSION['captcha'][$_REQUEST['check']] = 'new captcha';
Check against after submitting:
if( $_SESSION['captcha'][$_REQUEST['check']] == $_REQUEST['captcha'] )
{
// clear to proceed.
}else
{
// incorrect captcha
}
unset($_SESSION['captcha'][$_REQUEST['check']]);
Original comment by matti.t....@gmail.com
on 1 Mar 2012 at 4:09
Original issue reported on code.google.com by
svecp...@gmail.com
on 31 Aug 2010 at 5:51