404ing People based on Cookie

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
braveryonions
Forum Newbie
Posts: 14
Joined: Wed Feb 11, 2009 3:31 pm

404ing People based on Cookie

Post 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?
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: 404ing People based on Cookie

Post 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" />
 
Post Reply