School Map:  Home / Enroll $ Student Records; Class  
$ News @ LIVE Tech Radio * Support/FAQ | Store | FORUMS

Class / Forums / homeroom Refresh the current page Undefined variable?
 

 (#239 2004-04-30 09:07:41) Post Reply

redrum
Need To Set


Enrolled: Apr 2004
Posts: 1
AP: 1

I keep getting an error when using $remote_addr and $http_referer. Any idea why?

phpinfo file opened in web browser:

Notice: Undefined variable: REMOTE_ADDR in D:\www\phpinfo\phpinfo.php on line 2


phpinfo file opened in notepad:

<?php
$ip = $REMOTE_ADDR;
echo $ip
?>
<?php phpinfo(); ?>

 

 (#240 2004-05-04 22:53:33) Post Reply

IAmALlama
Need To Set


Enrolled: May 2004
Posts: 3
AP: 1

sounds like 'register globals' is set to off.

variables like $_SERVER are superglobals, if 'register globals' is set to on, then php will automatically set a variable like $_SERVER['REMOTE_ADDR'] to $REMOTE_ADDR. if 'register globals' is set to off, then $REMOTE_ADDR won't exist giving you the 'undefined variable' error. in the latter case you would need to get the remote address by using $SERVER['REMOTE_ADDR'].

 

 

View Previous Thread
Print this page Print This Page

View Next Thread

School Map:  Home / Enroll $ Student Records; Class  
$ News @ LIVE Tech Radio * Support/FAQ | Store

Advertising | Link To Us | Privacy 
Copyright 2000-2002 Script School Productions / KMR Enterprises 
No part of this website may be reproduced, copied and/or distributed in any medium 
without express written permission