Re: Hide the real URL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 7/26/2007 08:08 AM, M. Sokolewicz wrote:
// output to browser, suppressing error message
why are you suppressing error messages??
                                @readfile($Filename);


http://php.net/readfile

"Reads a file and writes it to the output buffer.

"Returns the number of bytes read from the file. If an error occurs, FALSE is returned and unless the function was called as @readfile(), an error message is printed."

I figured that in the case of an image it would make more sense to download a FALSE value to the browser than a text error message. During development & debugging phases error messages are invaluable, but after publication some circumstances dictate no display rather than display of a message. Since the OP was looking for a solution that obfuscated the image URL, I thought the less techy information communicated to the user the better.

Richard Heyes' suggestion of using passthru() might work better if it can be used with a mixture of content types on the same page.

And, yes, heredoc is definitely a matter of taste. In my own work, its disadvantage (hugging left margin) is outweighed by its advantages (separation of logic from data/template/output, omission of escape codes except the occasional {}, fewer typographical errors, faster proofreading, etc.). I don't feel the need to convince anyone else to use heredoc, but I'm totally sold on it myself.

Regards,

Paul
__________________________

Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux