PHPINFO overrides CSS code I start page with

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
churt
Forum Commoner
Posts: 39
Joined: Wed Oct 04, 2006 9:59 am

PHPINFO overrides CSS code I start page with

Post by churt »

I want to see PHPINFO but would like to keep my original CSS for everything on the page except PHPINFO. How would I go about this?
nickvd
DevNet Resident
Posts: 1027
Joined: Thu Mar 10, 2005 5:27 pm
Location: Southern Ontario
Contact:

Post by nickvd »

Why would you want to?

You dont EVER want phpinfo()'s output visible to the public, it exposes FAR too much information about the server and it's configuration...
User avatar
churt
Forum Commoner
Posts: 39
Joined: Wed Oct 04, 2006 9:59 am

phpinfo security

Post by churt »

It's on a secure page requireing login and a high permission level. I just hate the way it takes over the style info for my intranet admin page.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

phpinfo() outputs a complete page, complete with the style declarations in the head. When those declarations are parsed, they are applied to the whole document. Probably the easiest solution would be to put phpinfo() in it's own page, and show it through an iframe.


edit: just read the docs on phpinfo() - if you call:

Code: Select all

echo '<pre>'.shell_exec("php -r 'phpinfo();'").'</pre>';
You should be able to get around it. This of course, assumes you can run PHP as a CLI.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
churt
Forum Commoner
Posts: 39
Joined: Wed Oct 04, 2006 9:59 am

Thanks for both ideas.

Post by churt »

I do have CLI and that worked fine but then the output looks kind of crude. I went with the iframe idea. I usually try to avoid frames but in this case it was the best solution to date.

Here is what I ended up with:

Code: Select all

if (!$phpinfo){  echo "<table><tr><td><iframe SRC='$php_self?phpinfo=1' width=850 height=600></iframe></td></tr></table>"; }

if ($phpinfo){ phpinfo(); $phpinfo=''; }
Thanks for the help pickle :D
Post Reply