ctx2002 wrote:
> Hi all:
> 
> I want a user to login into our web base system  to view a picture.
> I knew i can store the picture into Database to prevent unauthorized
> access.
> 
> but except store pictures into DB, are there other way to do it?
> I really want to just provide a url link, but i do not how to prevent
> unauthorized access
> if i just store picture under web server, every one can see it.

Standard approach is putting the files outside the webroot, and running
requests for a file through a script - that script then does whatever
authentication is required, and outputs the image as required. There are
some examples on the php man page for readfile().

A quick way of doing the link is having something like

/serve.php/file.jpg

and using $_SERVER["PATH_INFO"] to look up a file to grab. Other
approaches are things like mod_rewrite.

-- 
E|2 DIGITAL

TIM OLIVER
SOFTWARE ENGINEER

P +64 3 377 0007
F +64 3 377 6582
E [email protected]

www.e2digital.co.nz

--~--~---------~--~----~------------~-------~--~----~
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]
-~----------~----~----~----~------~----~------~--~---

Reply via email to