02-13-2003, 08:44 PM
How can I comment php code so that even if php is disabled on the host, the code will not dump to the browser display... For instance, if I have the following code:
The html commenting will prevent the code from dumping, but also screws up code execution as headers will already have been sent prior to the session start (I believe). Anyone have an idea? Thanks.
02-13-2003, 09:30 PM
If php is disabled on the server then the content is going to be sent to the browser just as if it were a static html page. There's no comment you can use.
02-14-2003, 11:18 PM
OK, thanks. Elsewhere, someone suggested having the php in included files, so that if php is disabled, the code will never show.
Seems like that should work.
02-14-2003, 11:31 PM
That's one approach I suppose although you will still be sending PHP code to the browser. And if your include files are in a web accesible folder then people would still be able to get at them.
02-15-2003, 02:05 PM
Thanks, Spookseter. It is not folks trying to figure out how to get at the code I am concerned about, but a situation where the code dumps out on the display - that is what seems unacceptable to me. When you say I will still be sending php code to the browser, I'm not sure if I follow. If php is disabled on the server, the include should not work, and therefore the code will not dump to the browser, I assume.
02-15-2003, 03:34 PM
I'm assuming you are using PHP to include the php file? If PHP is disabled then the PHP code that is in the page that is including the file will be sent to the browser. So users will see this:
02-16-2003, 03:41 PM
Yes, ok. Thanks. But that is much preferable to seeing 50 or 100 lines of code.