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

Re: fixing perl scripts for register_globals = Off



On Thu, Mar 13, 2003 at 04:41:59PM -0800, Ron Farrer wrote:
> I'm new to PHP and I have several PHP pages that were working fine until
> the admins changed register_globals = On to register_globals = Off. Now
> all of my PHP pages are broken. I looked through all of my PHP reference
> books and did a google search, but I couldn't find anything helpful. So
> I thought I'd ask here. Below is an example PHP page that is broken, can
> someone show me how to fix? That way I can see the changes in something 
> I somewhat understand.
> 
> ---cut-here---
> <? $agent_info = $HTTP_USER_AGENT . "\t" . $REMOTE_ADDR . "\t" . date("M
> d, Y
> H:i:s") . "\n";
> $fp = fopen("/home/rbf/public_html/output.txt", "a");
> fwrite($fp,$agent_info);
> fclose($fp);
> ?>
> ---cut-here---
> 
> This is just a simple bit of PHP that logs the users web browser and ip
> address.

Both of those variables are now part of the _SERVER array, you would
access them as $_SERVER["HTTP_USER_AGENT"] and $_SERVER["REMOTE_ADDR"].
Similar automatic array variables are used for GET and POST form data,
session variables, cookies, etc.

http://www.php.net/manual/en/language.variables.predefined.php

-- 
Michael Heironimus



Reply to: