So you have images only for your site's members, and not for everyone else? Use this script to display your images to your members, and hide them for non-member visitors.
Instead of writing simple logic like:
if (member)
display_image
else
hide_image
for every images you have, why don't you write an image wrapper that does the logic automatically for you. Then you display the image like this: <img src="image.php?f=photo.jpg" />. The image wrapper does all the necessary stuffs. The listing is shown below:
Listing 1: image.php
The code above does these:
req_auth.jpg if the user has not logged in.not_found.jpg if the user has logged in but the requested image is not found.Using the code above, you have the advantage to hide the path of the requested image. It also supports JPEG, PNG and GIF images. In addition, you can add new features to the code like: create image's thumbnail on the fly, add watermark, etc.
Jim on Sep 16, 2009:
| Tel. | +62 31 8662872 +62 856 338 6017 |
| ICQ | 489571630 |
| Skype | dede_bl4ckheart |
| Yahoo | dede_bl4ckheart |
| nashruddin.amin |
alexander kena on Apr 3, 2009: