<?php
/*------------------------------------------------------------------------
This function is the PHP version of the TCL proc PRODUCE_MENUBAR which
will produce the menubar for all PHP files
Syntax: echo PRODUCE_MENUBAR()
-------------------------------------------------------------------------*/
function PRODUCE_MENUBAR() {
global $HTTP_HOST;
global $REQUEST_URI;
$tcl = (preg_match("/\bdyndns\b/i", $HTTP_HOST)) ? 'tclsh83' : 'tclsh';
$path = (preg_match("/\bdyndns\b/i", $HTTP_HOST)) ? 'cgi-bin' : 'cgi-bin/cgiwrap/ppowell';
$menubar = @readfile("http://$HTTP_HOST/$path/menubar.cgi");
$menubar = preg_replace("/NON_CGI_REQUEST_URI/", "$REQUEST_URI", $menubar);
return $menubar;
}
?>
This simple function will do a "scrape" of a URL and will reproduce it within an existing PHP script.
The contents of the URL display just fine every time, however, upon doing readfile() I will wind up seeing the numerical filesize() also display immediately after the contents of $menubar are displayed.
I could suppress filesize() number at the end, however, I know that's risky business as it could affect the rest of the contents of $menubar. Is this normal behavior?
OS: FreeBSD
PHP: 4.3.6
Server: Apache 1.3.29
Browsers: Mozilla Firefox, Netscape 7.1, IE 6.0
Phil