Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stop FIREFOX from caching captcha

So I have this form here: http://www.piataterenuri.info/register.php The problem is that Firefox caches the captcha image and after an incorect input, or a page refresh the captcha will show the old image instead of the curent one.

I've already placed:

header("Cache-Control: no-cache");
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");

And also changed the captcha img src to

<?php $rand=microtime() * mktime(); echo "src=\"captcha.php?time=$rand\""; ?>

What else can I do to stop firefox from caching the image?

like image 760
XCS Avatar asked Sep 03 '26 22:09

XCS


1 Answers

Fix this Last-Modified: Tue, 12 Oct 2010 18:11:57 GMT. Send the current time in the Last-Modified header.

like image 142
Alin Purcaru Avatar answered Sep 05 '26 10:09

Alin Purcaru