<?
/*
* WHOIS
* Whois is just an easier way to use Predefined Variables;
*
* Class tested on Linux running PHP 4.0.1pl2.
* Load Time: approximatly 3 milliseconds.
*
* COPYRIGHT
* Copyright (C) 2000,
* Maxim Maletsky, [maxim.maletsky@lincmedia.co.jp],
* LINC Media Inc., J-Door.com, J@pan Inc.
*
* LICENCE
* This software is FREEWARE. Do with it what you want to, as long as
* the copyright notice remains intact.
*
* DISCLAIMER
* Do not blaim me for anything that my software could do wrong.
* It's a FREE software - respect it!
*
* If you redistribute this code please mention in your script my info (Name & Email) as it's
creator.
* If you are using this code please send me your feedback and your improvements to it.
*/
class whois
{
function ip()
{
if (getenv(HTTP_X_FORWARDED_FOR))
return getenv(HTTP_X_FORWARDED_FOR);
else
return getenv(REMOTE_ADDR);
}
function whois($who='name', $data='')
{
Global $PHP_SELF;
if($who == 'ip')
$is = $this->ip();
/*
* You of course can add more here and there...
* To use this class
* just remove every line that is not needed like this examples,
* then add/remove the Enviroment variables to your own needs,
* include and define Whois everywhere you need it (better in a configuration file)
*
* and go wild: examples of use are above!
*
* mail me at maxim@maxim.cx or webmaster@j-door.com if you have any questions
*/
echo '<HR size="1" color="#000000">';
?>
<p>Basically, there's no particular reason to use this class, since it doesn't do much.<br>
However classes when included work faster then just a function call from a script.
<p>Few reasons to use Whois:
<ol>
<li>It is much easier call a class to get an Apache predefined variable then look manuals each
time and test it.
<li>You can modify the class to do more complicated things while you still writing the same call
to it.<br>
<ul><li>Means: you modify one file and all the pages are using it
</ol>
Dynamic, Simple, Usable...
Tests were done on a Linux Box, 133 MHz, 32 MB RAM, PHP4.0.1pl2
Interval Name ( Lines ) Process Time( Milliseconds )
--------------------------------------------------------------------------------
ip Between line 88 and 89 0.247
--------------------------------------------------------------------------------
dns Between line 89 and 90 1.155
--------------------------------------------------------------------------------
user Between line 90 and 91 0.193
--------------------------------------------------------------------------------
uri Between line 91 and 92 0.182
--------------------------------------------------------------------------------
ref Between line 92 and 93 0.212
--------------------------------------------------------------------------------
query Between line 93 and 94 0.187
--------------------------------------------------------------------------------
host Between line 94 and 95 0.188
--------------------------------------------------------------------------------
name Between line 95 and 96 0.173
--------------------------------------------------------------------------------
self Between line 96 and 97 0.188
--------------------------------------------------------------------------------
path Between line 97 and 98 0.197
--------------------------------------------------------------------------------