note 66455 added to function.fgets

From: Date: Tue, 23 May 2006 09:09:55 +0000
Subject: note 66455 added to function.fgets
Groups: php.notes 
Request: Send a blank email to php-notes+get-111850@lists.php.net to get a copy of this message
An easy way to authenticate Windows Domain users from scripts running on a non-Windows or non-Domain box - pass the submitted username and password to an IMAP service on a Windows machine. <?php $server = 'imapserver'; $user = 'user'; $pass = 'pass'; if (authIMAP($user, $pass, $server)) { echo "yay"; } else { echo "nay"; } function authIMAP($user, $pass, $server) { $connection = fsockopen($server, 143, $errno, $errstr, 30); if(!$connection) return false; $output = fgets($connection, 128); // banner fputs($connection, "1 login $user $pass\r\n"); $output = fgets($connection, 128); fputs($connection, "2 logout\r\n"); fclose($connection); if (substr($output, 0, 4) == '1 OK') return true; return false; } ?> ---- Server IP: 85.116.0.130 Probable Submitter: 82.110.10.98 (proxied: 1.1 SERVER2) ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.fgets.php Edit -- http://master.php.net/note/edit/66455 Del: integrated -- http://master.php.net/note/delete/66455/integrated Del: useless -- http://master.php.net/note/delete/66455/useless Del: bad code -- http://master.php.net/note/delete/66455/bad+code Del: spam -- http://master.php.net/note/delete/66455/spam Del: non-english -- http://master.php.net/note/delete/66455/non-english Del: in docs -- http://master.php.net/note/delete/66455/in+docs Del: other reasons-- http://master.php.net/note/delete/66455 Reject -- http://master.php.net/note/reject/66455 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#111850) next »