FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


session based image url





chatrack
Hi,

I want display some image in some logged in pages for member area.
These image (image url) should not be viewed from outside ( that is, in a log out condition).

To make it clear, You can view photos of your friends when you logon to - say, orkut.
but, these image url will not work when lacuched in a logged out stage.

How can I do this session based image view permission using PHP

Please share your idea

Smile
Fire Boar
You can actually write a PHP script to output an image as well as HTML or plain text. Simply use the header function to set the Content-type header, and use the GD functions to generate the image. For example, you could have a directory containing pictures with a .htaccess file redirecting all access from that directory to the PHP script, which would then pull the picture provided the user has the right credentials.
BlueVD
Here's one perfect way to secure images:
Make a folder outside the public_html (the root directory that is); place all of your images there, this way nobody can access them directly (except you, via FTP Smile )
Now, use mod_rewrite (you'll find the down 'n dirty quick example here on mod_rewite & php http://www.workingwith.me.uk/articles/scripting/mod_rewrite) and set a special rule for the pics that are to be secure (for example you can use a prefix "secure_" followed by the image name "picx23.jpg", thus the url being "secure_picx23.jpg"; point the rewrite to a php file that checks the login credentials, etc.
If the login is ok, use "fpassthru" function in your php file to read and display the image, otherwise you can display an "unauthorized" picture.
Cheers!
Fire Boar
Ah, I had forgotten about fpassthru. That's a much better and cleaner solution than using GD.
Related topics
my site
Anyone make custom fonts? **closed**
all my $F and more for a task on change cookie to session
Best Method for layout
Icon Design: Bitmap vs Vector. The explanation
Authentication Module
.: User login systems for your site :. CHEAP AND EASY!
Tool to create shadow effect for an Image using CSS
Running Linux without installing
OS based on Adobe Flash?
sessions help
Help with Css to insert image
Relatively Secure Session Management System for PHP
I want to output an img url from a random image script
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.