REMOTE_ADDR

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
Koray
-


Joined: 14 Jun 2004
Posts: 2

PostPosted: Mon Jun 14, 2004 6:34 am    Post subject: REMOTE_ADDR Reply with quote

Notice: Undefined variable: REMOTE_ADDR in C:\Program Files\Abyss Web Server\htdocs\index.php on line 77

I get that error when i try to use
Code:
<?
$ip ="$REMOTE_ADDR";
echo "$ip";
?>

Im guessing abyss doesn't define it.. but I was wondering if there was something I could do to fix this? Any help is greatly appreciated, thanks.

Edit: I also recieve
Notice: Undefined offset: 2 in C:\Program Files\Abyss Web Server\htdocs\server.php on line 89
That error when i try to use
Code:
<?php
   $loadavg_array = explode(" ", exec("cat /proc/loadavg"));
   $loadavg = $loadavg_array[2];
   print("Server load: " . $loadavg . "%");
?>

that script.. again, any help is greatly appreciated.
Back to top View user's profile Send private message
iNaNimAtE
-


Joined: 05 Nov 2003
Posts: 2381
Location: Everywhere you're not.

PostPosted: Mon Jun 14, 2004 7:11 am    Post subject: Reply with quote

Your using the old style variables. To use it, turn "register_globals" to "on" in your php.ini file, or use the new style (I think it is "$_SERVER['REMOTE_ADDR']").
_________________
Bienvenidos!
Back to top View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
Koray
-


Joined: 14 Jun 2004
Posts: 2

PostPosted: Mon Jun 14, 2004 6:48 pm    Post subject: Reply with quote

Thanks a lot, it fixed the error. Anyone wanna take a crack at the second one? ;p
Back to top View user's profile Send private message
Anonymoose
-


Joined: 09 Sep 2003
Posts: 2192

PostPosted: Mon Jun 14, 2004 6:53 pm    Post subject: Re: REMOTE_ADDR Reply with quote

Koray wrote:
Edit: I also recieve
Notice: Undefined offset: 2 in C:\Program Files\Abyss Web Server\htdocs\server.php on line 89
That error when i try to use
Code:
<?php
   $loadavg_array = explode(" ", exec("cat /proc/loadavg"));
   $loadavg = $loadavg_array[2];
   print("Server load: " . $loadavg . "%");
?>

that script.. again, any help is greatly appreciated.


Are you coding this for your own use on Windows + Abyss, or is it for a site you have hosted elsewhere ? I assume you know cat /proc/loadavg is a *nix command looking for a *nix file on a *nix system? It won't work on Windows.
Back to top View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group