SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Oct 2009
    Posts
    134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    need help with header problem PLEASE.

    sorry if post is in wrong section, but am using PHP to write these headers. my php script echos links to user's docs and pics for browser to display. all is well, and the good headers look like this:

    Response Headers
    Date Tue, 03 Jul 2012 02:14:02 GMT
    Server Apache
    Last-Modified Tue, 03 Jul 2012 02:01:07 GMT
    Accept-Ranges bytes
    Content-Length 169175
    Keep-Alive timeout=5, max=75
    Connection Keep-Alive
    Content-Type image/jpeg

    Request Headers
    Host www.mysite.com
    User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.2.8) Gecko/20100722 AskTbHIP/3.15.4.23821
    Firefox/3.6.8 (.NET CLR 3.5.30729)
    Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Language en-us,en;q=0.5
    Accept-Encoding gzip,deflate
    Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
    Keep-Alive 115
    Connection keep-alive
    Referer https://www.mysite.com/files/box/index.php
    Cookie PHPSESSID=90bae8f5ad8ca690beaf8e389b2cc3fb

    HOWEVER have added this PHP code to prevent other users from snooping where they don't belong:

    $fp = fopen($_SERVER['DOCUMENT_ROOT'].$_SERVER['REQUEST_URI'], 'r');
    // Set mime type to header
    header('Content-type: '.mime_content_type($_SERVER['DOCUMENT_ROOT'].$_SERVER['REQUEST_URI']));
    // Send the contents of the file the browser
    fpassthru($fp);
    fclose($fp);

    but now browser is unable to display a legit request. just getting back a little image icon with the x on it.
    here are the bad headers:

    Response Headers
    Date Tue, 03 Jul 2012 02:15:36 GMT
    Server Apache
    Expires Thu, 19 Nov 1981 08:52:00 GMT
    Cache-Control no-store, no-cache, must-revalidate, post-check=0, pre-check=0
    Pragma no-cache
    Keep-Alive timeout=5, max=75
    Connection Keep-Alive
    Transfer-Encoding chunked
    Content-Type image/jpeg

    Request Headers
    same as GOOD HEADERS

    seeing this behavior with IE, Chrome, and Firefox. SO PLEASE, what's the problemo here and how can I change my bad headers to good ones? please note site is HTTPS.

    many thanks guys!

  2. #2
    SitePoint Zealot
    Join Date
    Oct 2009
    Posts
    134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am not above a low down & dirty & ugly fix :-)

    any ideas at all please ???


Bookmarks

Posting Permissions

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