NYCPHP Meetup

NYPHP.org

[nycphp-talk] Single-Logon User Authentication, PHP and viewingnon-ASCII

Chris Snyder csnyder at chxo.com
Mon Aug 18 19:14:11 EDT 2003


Phil Powell wrote:

>Could you show me an example of this? I honestly can't follow what you want
>me to do.  Perhaps overcomplicating the issue, but I am totally lost.
>  
>

Why certainly:

<?php
define("CONTENT_ROOT", "/home/foo/content"); // outside of HTTP 
DOCUMENT_ROOT

$filename= CONTENT_ROOT."/path/to/image.jpg";
if  ( file_exists($filename) )
{
    header("Content-type: image/jpg");
    $content= file_get_contents($filename);
    print $content;
    exit;
}
else {
    print "<h1>File Not Found</h1><p>Sorry, $filename does not exist in 
".CONTENT_ROOT.".</p>";
}
?>

Perhaps there are better ways, but that's what I'm getting at.

    chris.




More information about the talk mailing list