View previous topic :: View next topic |
Author |
Message |
Koray -
Joined: 14 Jun 2004 Posts: 2
|
Posted: Mon Jun 14, 2004 6:34 am Post subject: REMOTE_ADDR |
|
|
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 |
|
 |
iNaNimAtE -
Joined: 05 Nov 2003 Posts: 2381 Location: Everywhere you're not.
|
Posted: Mon Jun 14, 2004 7:11 am Post subject: |
|
|
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 |
 |
 |
Koray -
Joined: 14 Jun 2004 Posts: 2
|
Posted: Mon Jun 14, 2004 6:48 pm Post subject: |
|
|
Thanks a lot, it fixed the error. Anyone wanna take a crack at the second one? ;p |
|
Back to top |
|
 |
Anonymoose -
Joined: 09 Sep 2003 Posts: 2192
|
Posted: Mon Jun 14, 2004 6:53 pm Post subject: Re: REMOTE_ADDR |
|
|
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 |
|
 |
|