?> ______________ the $_SERVER['SERVER_PORT'] part should be changed to $_SERVER['HTTP_HOST'] Gregory Boshoff 14-Feb-2005 08:19 The Environment variable $ENV is useful for coding portable platform specific application constants. // Define a Windows or else Linux root directory path $_ENV['OS'] == 'Windows_NT' ? $path = 'L:\\www\\' : $path = ' /var/www/'; define('PATH', $path); echo PATH; magotes[at]netcabo.pt 12-Feb-2005 11:09 Sorry if this is old news to some, but it might not be obvious at a first glance: If you are using $_SERVER['remote_addr'] as a way to keep track of a logged-in user (this can be useful to avoid several types of hacking), remember that it might not be the user's actual IP address! I was trying to implement a login feature that used this, storing the IP into a DB. It went smoothly while on a LAN, but wrecked havoc when accepting outter connections. grlprgrmmr uses gmail 11-Feb-2005 03:05 you can use these to reconstructed the current page url. <?php echo 'http'; if($_SERVER['HTTPS']=='on'){echo 's';} echo '://'.$_SERVER['SERVER_PORT'].$_SERVER['SCRIPT_NAME']; if($_SERVER['QUERY_STRING']>' '){echo '?'.$_SERVER['QUERY_STRING'];} ?> If $_SERVER['HTTPS']=='on' does not work for you, try $_SERVER['SERVER_PORT']==443 (or whatever secure port is used) JSP001 27-Jan-2005 06:15 Hi dotpointer, I am new to php but I suggest a little modification of your script. Tell me what you think of it : function getThisFile() { [...] /* last resort __FILE__ */ } else { $strScript = __FILE__; } [...] } Thanks for this great function, I'll use it for my project ! Regards niles AT atheos DOT net 27-Jan-2005 04:51 If your having problems returning $_SERVER variables using apache, be sure you enable: ExtendedStatus On in your httpd.conf file. If it's off, then things like $_SERVER['HTTP_HOST'] won't be present. marcus at lastcraft dot com 24-Jan-2005 08:02 The variable $php_errormsg is not populated if you have XDebug running. arjini at gmail dot com 19-Jan-2005 08:29 Driven crazy by the lack of consistency with $_SERVER across installations? Check out this chart: http://www.koivi.com/apache-iis-php-server-array.php roy dot rico at gmail dot com 19-Jan-2005 05:48 if you are trying to use $php_errormsg, it acts more like a function than it does a variable. example |