Page 1 of 1

404ing People based on Cookie

Posted: Sun Feb 15, 2009 6:33 pm
by braveryonions
How can I 404 someone who is attempting to access an image, but does not have a necessary cookie? Is this even possible with PHP?

Re: 404ing People based on Cookie

Posted: Sun Feb 15, 2009 6:46 pm
by Benjamin
Yes, you can set a cookie on one page, then create another page for sending images. The second page will check for the cookie, then send the image to the browser if it's set. You'll need to set the headers so the browser knows it's an image. The page will also need to know which image to send.

Code: Select all

 
<img src="renderImage.php?image=protected.jpg" alt="Alt Text" height="80" width="80" />