WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : WHOIS is a class to make your life easier in case you use a lot of APACHE PREDEFINED VARIABLES.
Categories : PHP, PHP Classes Update Picture
Maxim Maletsky
Date : Oct 06th 2000
Grade : Be the 1st to grade this Code Example
Viewed : 4611
File : whois.php
Images : No Images for this code example.
Search : More code by Maxim Maletsky
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

<html><head><title>Whois</title>
<STYLE TYPE="text/css"><!--
.style {font-family:Verdana;color:#A40000;font-size:10px;line-height:12px}
.style A:link { text-decoration: none; color: #990000 }
.style A:visited { text-decoration: none; color: #990000 }
.style A:hover { text-decoration: none; color: #FF3300 }
.head {font-family:Verdana;color: #FF9900;font-size:24px} --></STYLE>
</head>

<span class="head"><B>Whois</B></span><span class="style"><br>by <A
HREF="mailto:maxim@maxim.cx">Maxim Maletsky</A>

<?
/*
* 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();
                
                elseif($who == 'dns')
                        $is = gethostbyaddr($this->ip());
                
                elseif($who == 'user')
                        $is = getenv('HTTP_USER_AGENT');
                
                elseif($who == 'uri')
                        $is = getenv('REQUEST_URI');
                
                elseif($who == 'ref')
                        $is = getenv('HTTP_REFERER');

                elseif($who == 'query')
                        $is = getenv('QUERY_STRING');

                elseif($who == 'host')
                        $is = getenv('HTTP_HOST');

                elseif($who == 'root')
                        $is = getenv('DOCUMENT_ROOT');

                elseif($who == 'name')
                        $is = getenv('SCRIPT_NAME');

                elseif($who == 'self')
                        $is = $PHP_SELF;

                elseif($who == 'path')
                        $is = getenv('SCRIPT_FILENAME');

                return $is;
        }
}

$whois = new whois;

echo '<HR size="1" color="#000000">';
                        
echo '( <B>ip</B> ) => <B>'.$whois->whois('ip').'</B><BR>';
echo '( <B>dns</B> ) => <B>'.$whois->whois('dns').'</B><BR>';
echo '( <B>user</B> ) => <B>'.$whois->whois('user').'</B><BR>';
echo '( <B>uri</B> ) => <B>'.$whois->whois('uri').'</B><BR>';
echo '( <B>ref</B> ) => <B>'.$whois->whois('ref').'</B><BR>';
echo '( <B>query</B> ) => <B>'.$whois->whois('query').'</B><BR>';
echo '( <B>host</B> ) => <B>'.$whois->whois('host').'</B><BR>';
echo '( <B>root</B> ) => <B>'.$whois->whois('root').'</B><BR>';
echo '( <B>name</B> ) => <B>'.$whois->whois('name').'</B><BR>';
echo '( <B>self</B> ) => <B>'.$whois->whois('self').'</B><BR>';
echo '( <B>path</B> ) => <B>'.$whois->whois('path').'</B><BR>';
                                

/*
* 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...

<br>Cheers!

<BR><HR size="1" color="#000000"><HR size="1" color="#000000"><BR>

<P>Tests Made:
<PRE>

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
--------------------------------------------------------------------------------

                                Total Execution Time : 3.317
</PRE></span>



Remote Archive (Zip, Tar, Gzip) downloader with FTP and local extration support
Categories : PHP, FTP, Filesystem, PHP Classes, Compression
DbObject - A PHP wrapper for working with various databases
Categories : Databases, PHP, PHP Classes
Authorize.net AIM Interface Class v1.0.0
Categories : PHP, PHP Classes, Ecommerce, Payment Gateways
Browser Detecor Class
Categories : PHP Classes, PHP, HTML
filesplit : Split big text files in multiple small ones
Categories : PHP, Log Files, Filesystem, PHP Classes
A File Browser Class.To Read Drives,Directories and Files .Files writing is also possible
Categories : PHP, PHP Classes, Filesystem
Specify your connection settings and create a link to a MySQL database.
Categories : PHP, PHP Classes, Databases, MySQL, Beginner Guides
Filter - A simple class that lets you use multiple functions to create custom filters.
Categories : PHP, PHP Classes, Strings
Customizable Calendar Class
Categories : HTML and PHP, Date Time, PHP, PHP Classes, Calendar
HTML_Graphs uses PHP to provide a consistent interface for creating HTML based charts. The user of the class sets up arrays that are passed to html_graph() which then takes care of all the messy HTML layout.
Categories : Graphics, Arrays, PHP, PHP Classes, Charts and Graphs
Simple and fast user authentication
Categories : PHP, PHP Classes, Authentication
Client classes for Dictionary servers UPDATED: 2000-06-06
Categories : Network, Search, Complete Programs, PHP Classes, PHP
file class , uploade file , download file already uploaded on another website
Categories : PHP, PHP Classes, Filesystem, Web Services
Bs_IniHandler is a class that can read and write ini-style files (and strings)
Categories : PHP, Filesystem, PHP Classes
Array Insertion
Categories : PHP, PHP Classes, Arrays