note 59556 added to function.fsockopen

From: Date: Fri, 09 Dec 2005 15:40:30 +0000
Subject: note 59556 added to function.fsockopen
Groups: php.notes 
Request: Send a blank email to php-notes+get-99851@lists.php.net to get a copy of this message
This is an ident request example. If your client is running identd your real username will be known by the server. It is also usefull to identify people bypassing IP ACLs by using SOCKS proxy and dynamic IP forwarding. If the socks proxy server uses ident (most unices do) you will know his real username. For more information see RFC1413 Timeout of 2 seconds in the example may not be enough. <? error_reporting(E_ALL); $remip = $HTTP_SERVER_VARS['REMOTE_ADDR']; $remport = $HTTP_SERVER_VARS['REMOTE_PORT']; ob_implicit_flush(); $fp = fsockopen($remip, 113, $errno, $errstr, 2); if (!$fp) { echo "$errstr ($errno)<br>\n"; exit; } else { $out = "$remport, 80\r\n"; fwrite($fp, $out); $answer=fgets($fp, 128); } fclose($fp); $ansparts=explode(":",$answer); $user=chop($ansparts[3]); echo "You are $user@$remip:$remport"; ?> ---- Manual Page -- http://www.php.net/manual/en/function.fsockopen.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+59556 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+59556&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+59556&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+59556&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+59556&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+59556&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+59556&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+59556&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+59556&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#99851) next »