Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2002

    session control and images in PHP

    I was trying to build a mechanism that would prevent access to images if a session is not active. My plan was to write somthing echo the headers and the contents of the file unless a session var is not set:

    PHP Code:
    header('Content-type: image/jpeg');
    header('Content-Disposition: inline; filename="filename.jpg"');
    However, I realized that once a $_SESSION var has been accessed, it is too late for sending the headers.

    Why is this so? Any ideas how I can solve this problem?

  2. #2
    How about sending the headers first, then starting the session. If the correct session var isn't there, then just send out a 'no permission' image?

  3. #3
    Join Date
    Jun 2002
    Thank for your answer. This works on my home computer (windows) but not on the server on which the script it supposed to run.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts