| version 1.1, 2001/09/20 14:59:01 |
version 1.2, 2001/10/02 17:21:09 |
|
|
| <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| <html> |
<html> |
| <head> |
<head> |
| <title>libident.php - PHP Ident Client Class</title> |
<title>libident - PHP Ident Client Class</title> |
| </head> |
</head> |
| <body> |
<body> |
| |
|
| <h1>NAME</h1> |
<h1>NAME</h1> |
| <p>libident.php - PHP Ident Client Class</p> |
<p>libident - PHP Ident Client Class</p> |
| <hr> |
<hr> |
| |
|
| <h1><a name="SYNOPSIS">SYNOPSIS</a></h1> |
<h1><a name="SYNOPSIS">SYNOPSIS</a></h1> |
| <pre> |
<pre><?php |
| <? |
|
| |
|
| include("libident.php"); |
include('libident.php'); |
| |
|
| /* some users will be going through a proxy - this attempts to work out their real IP address: */ |
// some users will be going through a proxy - this attempts to work out their real IP address: |
| if (getenv('HTTP_X_FORWARDED_FOR') != '') { |
if (getenv('HTTP_X_FORWARDED_FOR') != '') { |
| $addr = getenv('HTTP_X_FORWARDED_FOR'); |
$addr = getenv('HTTP_X_FORWARDED_FOR'); |
| } else { |
} else { |
| $addr = getenv('REMOTE_ADDR'); |
$addr = $REMOTE_ADDR; |
| } |
} |
| |
|
| /* Constructor: */ |
// Constructor: |
| $ident = new ident(gethostbyaddr($addr), getenv('REMOTE_PORT'), getenv('SERVER_PORT')); |
$ident = new Net_Ident(gethostbyaddr($addr), $REMOTE_PORT, $SERVER_PORT); |
| |
|
| if ($ident->status == 0) { |
if ($ident->status() == 1) { |
| print "Ident query failed: " . $ident->error() . ".<br>\n"; |
print "Ident query failed: " . $ident->error() . ".<br>\n"; |
| } else { |
} else { |
| print "Ident query OK, username '" . $ident->user() . "', ostype '" . $ident->os_type() . "'.<br>\n"; |
print "Ident query OK, username '" . $ident->user() . "', ostype '" . $ident->osType() . "'.<br>\n"; |
| } |
} |
| |
|
| ?> |
?> |
| Line 36 if ($ident->status == 0) { |
|
| Line 35 if ($ident->status == 0) { |
|
| <hr> |
<hr> |
| |
|
| <h1><a name="OVERVIEW">OVERVIEW</a></h1> |
<h1><a name="OVERVIEW">OVERVIEW</a></h1> |
| <p><tt>libident.php</tt> is an RFC 1413 compatible PHP4 Ident client class. The Identification Protocol (a.k.a., "ident", a.k.a., "the Ident Protocol") provides a means to determine the identity of a user of a particular TCP connection. Given a TCP port number pair, it returns a character string which identifies the owner of that connection on the server's system.</p> |
<p><tt>libdient.php</tt> is an RFC 1413 compatible PHP4 Ident client class. The Identification Protocol (a.k.a., "ident", a.k.a., "the Ident Protocol") provides a means to determine the identity of a user of a particular TCP connection. Given a TCP port number pair, it returns a character string which identifies the owner of that connection on the server's system.</p> |
| <hr> |
<hr> |
| |
|
| <h1><a name="CONSTRUCTOR">CONSTRUCTOR</a></h1> |
<h1><a name="CONSTRUCTOR">CONSTRUCTOR</a></h1> |
| <blockquote><tt>$ident = new ident($remote_addr, $remote_port, $local_port);</tt></blockquote> |
<blockquote><tt>$ident = new Net_Ident($remote_addr, $remote_port, $local_port);</tt></blockquote> |
| <p>The constructor of this class accepts three arguments. <tt>$remote_addr</tt> is the IP address or DNS hostname of the remote computer running the ident server. <tt>$remote_port</tt> is the port number the remote computer is using to make a connection to the local machine. PHP can access the remote port for a given HTTP connection using the <tt>REMOTE_PORT</tt> environment variable. Finally, <tt>$local_port</tt> is the local port being connected to. Regular HTTP connections will be on port 80, HTTPS connections on port 443. A more robust solution would be to use the <tt>SERVER_PORT</tt> environment variable to specify this port.</p> |
<p>The constructor of this class accepts three arguments. <tt>$remote_addr</tt> is the IP address or DNS hostname of the remote computer running the ident server. <tt>$remote_port</tt> is the port number the remote computer is using to make a connection to the local machine. PHP can access the remote port for a given HTTP connection using the <tt>REMOTE_PORT</tt> environment variable. Finally, <tt>$local_port</tt> is the local port being connected to. Regular HTTP connections will be on port 80, HTTPS connections on port 443. A more robust solution would be to use the <tt>SERVER_PORT</tt> environment variable to specify this port.</p> |
| <p>When the object is created with this constructor, a TCP connection to the remote ident server will be established and an ident query will be made. The result of this query will form the basis of the returned object.</p> |
<p>When the object is created with this constructor, a TCP connection to the remote ident server will be established and an ident query will be made. The result of this query will form the basis of the returned object.</p> |
| <hr> |
<hr> |
| |
|
| <h1><a name="METHODS">METHODS</a></h1> |
<h1><a name="METHODS">METHODS</a></h1> |
| |
<blockquote><tt>$ident->status();</tt></blockquote> |
| |
<p>Returns a boolean integer indicating the status of the query. A 1 is considered to be an error.</p> |
| <blockquote><tt>$ident->error();</tt></blockquote> |
<blockquote><tt>$ident->error();</tt></blockquote> |
| <p>Returns a string containing the last error message generated. This message may be internally generated, or returned by the remote ident server.</p> |
<p>Returns a string containing the last error message generated. This message may be internally generated, or returned by the remote ident server.</p> |
| <blockquote><tt>$ident->username();</tt></blockquote> |
<blockquote><tt>$ident->username();</tt></blockquote> |
| <p>Returns a string containing the <tt>USERID</tt> returned by the remote ident server. This will return false if there was an error with the query.</p> |
<p>Returns a string containing the <tt>USERID</tt> returned by the remote ident server. This will return false if there was an error with the query.</p> |
| <blockquote><tt>$ident->os_type();</tt></blockquote> |
<blockquote><tt>$ident->osType();</tt></blockquote> |
| <p>Returns a string containing the operating system type of the remote host, as returned by the remote ident server. Permitted values may be an ASCII string or a numerical code compliant with RFC 1340, "Assigned Numbers".</p> |
<p>Returns a string containing the operating system type of the remote host, as returned by the remote ident server. Permitted values may be an ASCII string or a numerical code compliant with RFC 1340, "Assigned Numbers".</p> |
| <hr> |
<hr> |
| |
|
| <h1><a name="PROPERTIES">PROPERTIES</a></h1> |
|
| <blockquote><tt>$ident->status;</tt></blockquote> |
|
| <p>Returns either a 1 or a 0 depending on the current status of the ident query. A 1 is considered to indicate a successful query, a 0 (zero) is a failed query.</p> |
|
| <blockquote><tt>$ident->data;</tt></blockquote> |
|
| <p>Is the class' internal structure for storing data returned by the server. This variable is an associative array keyed by response type.</p> |
|
| <hr> |
|
| |
|
| <h1><a name="DISCLAIMER">DISCLAIMER</a></h1> |
<h1><a name="DISCLAIMER">DISCLAIMER</a></h1> |
| <p>I make NO WARRANTY or representation, either express or implied, with respect to this software, its quality, accuracy, merchantability, or fitness for a particular purpose. This software is provided "AS IS", and you, its user, assume the entire risk as to its quality and accuracy.</p> |
<p>I make NO WARRANTY or representation, either express or implied, with respect to this software, its quality, accuracy, merchantability, or fitness for a particular purpose. This software is provided "AS IS", and you, its user, assume the entire risk as to its quality and accuracy.</p> |
| <hr> |
<hr> |
| |
|
| <h1><a name="AUTHOR">AUTHOR</a></h1> |
<h1><a name="AUTHOR">AUTHOR</a></h1> |
| <p>Gavin Brown, <<a href="mailto:gavin.brown@zoom.co.uk">gavin.brown@zoom.co.uk</a>></p> |
<p>Gavin Brown, <<a href="mailto:gavin.brown@uk.com">gavin.brown@uk.com</a>></p> |
| <hr> |
<hr> |
| |
|
| <h1><a name="COPYRIGHT">COPYRIGHT</a></h1> |
<h1><a name="COPYRIGHT">COPYRIGHT</a></h1> |
| <p>Copyright (c) 2001 Gavin Brown. All rights reserved. This PHP class is released under the GNU General Public License (GPL).</p> |
<p>Copyright (c) 2001 Gavin Brown. All rights reserved. This PHP class is released under the GNU Lesser General Public License (LGPL).</p> |
| <hr> |
<hr> |
| |
|
| <h1><a name="REVISION_HISTORY">REVISION HISTORY</a></h1> |
<h1><a name="REVISION_HISTORY">REVISION HISTORY</a></h1> |
| |
<p><b>V1.0.1</b> (13/09/01)</p> |
| |
<blockquote>PEAR-compatible release with no functional changes. Migration to the LGPL.</blockquote> |
| <p><b>V1.0</b> (30/06/01)</p> |
<p><b>V1.0</b> (30/06/01)</p> |
| <blockquote>Initial release.</blockquote> |
<blockquote>Initial release.</blockquote> |
| <p>Future revisions of this PHP class will be released at <<a href="http://jodrell.uk.net/">http://jodrell.uk.net/</a>></p> |
<p>Future revisions of this PHP class will be released at <<a href="http://jodrell.uk.net/">http://jodrell.uk.net/</a>></p> |
| <hr> |
<hr> |
| |
|
| <h1><a name="SEE_ALSO">SEE ALSO</a></h1> |
<h1><a name="SEE_ALSO">SEE ALSO</a></h1> |
| <p>RFC1413, RFC1340.</p> |
<p><a href="http://www.ietf.org/rfc/rfc1413.txt">RFC1413</a>, <a href="http://www.ietf.org/rfc/rfc1340.txt">RFC1340</a>.</p> |
| <hr> |
<hr> |
| |
|
| </body> |
</body> |