Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Thursday, October 15, 2026

Diff for phpWebLogAnalyzer/libident/Attic/libident.php between version 1.1 and 1.2

version 1.1, 2001/09/20 14:59:01 version 1.2, 2001/10/02 17:21:09
Line 1 
Line 1 
 <?php  <?php
   
 /*  /* vim: set expandtab tabstop=4 shiftwidth=4: */
     Find out more about the Ident protocol at  // +----------------------------------------------------------------------+
   // | PHP version 4.0                                                      |
   // +----------------------------------------------------------------------+
   // | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group             |
   // +----------------------------------------------------------------------+
   // | This source file is subject to version 2.0 of the PHP license,       |
   // | that is bundled with this package in the file LICENSE, and is        |
   // | available at through the world-wide-web at                           |
   // | http://www.php.net/license/2_02.txt.                                 |
   // | If you did not receive a copy of the PHP license and are unable to   |
   // | obtain it through the world-wide-web, please send a note to          |
   // | license@php.net so we can mail you a copy immediately.               |
   // +----------------------------------------------------------------------+
   // | Authors: Gavin Brown <gavin.brown@uk.com>                            |
   // +----------------------------------------------------------------------+
   //
   // $Id$
   
   // Find out more about the Ident protocol at
   //
   // http://www.ietf.org/rfc/rfc1413.txt
   
   class Net_Ident {
       var $_data;
       var $_error;
       var $_status = 0;
       var $_identport = 113;
       var $_timeout = 15;
   
         http://www.ietf.org/rfc/rfc1413.txt      function Net_Ident($peeraddr, $peerport, $localport) {
 */          $socket = @fsockopen($peeraddr, $this->_identport, $errno, $errstr, $this->_timeout);
   
 class ident {  
   
     var $data;  
     var $int_errormsg;  
   
     var $status = 1;  
   
     function ident($peeraddr, $peerport, $localport) {  
         $identport = 113;  
         $timeout = 30;  
         $socket = @fsockopen($peeraddr, $identport, $errno, $errstr, $timeout);  
         if (!$socket) {          if (!$socket) {
             $this->int_errormsg = "Error connecting to ident server ($peeraddr:$identport): $errstr ($errno)";              $this->_error  = "Error connecting to ident server ($peeraddr:" . $this->$_identport . "): $errstr ($errno)";
             $this->status = 0;              $this->_status = 1;
             return false;              return false;
         }          }
         @fputs($socket, "$peerport, $localport\r\n");          @fputs($socket, "$peerport, $localport\r\n");
         $line = @fgets($socket, 512);          $line = @fgets($socket, 512);
                 $this->data['rawdata'] = $line;                  $this->_data['rawdata'] = $line;
         list($undef, $response) = explode(":", $line, 2);          list($undef, $response) = explode(":", $line, 2);
         list($resp_type, $add_info) = explode(":", trim($response), 2);          list($resp_type, $add_info) = explode(":", trim($response), 2);
         fclose($socket);          fclose($socket);
         if (trim($resp_type) == 'ERROR') {          if (trim($resp_type) == 'ERROR') {
             $this->int_errormsg = trim($add_info);              $this->_error  = trim($add_info);
             $this->status = 0;              $this->_status = 1;
             return false;              return false;
         } elseif (trim($resp_type) == 'USERID') {          } elseif (trim($resp_type) == 'USERID') {
             list($os_type, $username) = explode(":", trim($add_info), 2);              list($os_type, $username) = explode(":", trim($add_info), 2);
             $this->data['username'] = trim($username);              $this->_data['username'] = trim($username);
             $this->data['os_type'] = trim($os_type);              $this->_data['os_type']  = trim($os_type);
             return true;              return true;
         } else {          } else {
             $this->int_errormsg = 'Unknown error';              $this->_error  = 'Unknown error';
             $this->status = 0;              $this->_status = 1;
             return false;              return false;
         }          }
     }      }
   
     function user() {      function user() {
         if ($this->data['username']) {          if ($this->_data['username']) {
             return $this->data['username'];              return $this->_data['username'];
         } else {          } else {
             $this->int_errormsg = 'Server returned an error, or no query has been made yet.';              $this->_error = 'Server returned an error, or no query has been made yet.';
             return false;              return false;
         }          }
     }      }
   
     function os_type() {      function osType() {
         if ($this->data['os_type']) {          if ($this->_data['os_type']) {
             return $this->data['os_type'];              return $this->_data['os_type'];
         } else {          } else {
             $this->int_errormsg = 'Server returned an error, or no query has been made yet.';              $this->_error = 'Server returned an error, or no query has been made yet.';
             return false;              return false;
         }          }
     }      }
   
     function error() {      function status() {
         return $this->int_errormsg;          return $this->_status;
     }      }
   
     function data($key) {      function error() {
         return $this->data[$key];          return $this->_error;
     }      }
 }  }
   

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

Platon Group <platon@platon.org> http://platon.org/
Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top