note 99689 added to function.fsockopen

From: Date: Tue, 31 Aug 2010 03:56:40 +0000
Subject: note 99689 added to function.fsockopen
Groups: php.notes 
Request: Send a blank email to php-notes+get-172186@lists.php.net to get a copy of this message
<?php /* this script i used for remote my PvPGN Server, to check email user. not good, but it work. */ set_time_limit(0); $host = 'host'; $port = 'port'; $user = 'user'; $pass = 'pass'; $socket = fsockopen($host, $port) or die('Could not connect to: '.$host); $userdota = "palma"; if($socket) { sendcmd("\r",$socket); $status = "open"; // set status open while($status=="open") //while we are connected to the server { $line = @fgets($socket, 1024) ; /////////////login//////////////// if (strstr($line, "there is no guest account")) { sendcmd($user."\r\n",$socket); sendcmd($pass."\r\n",$socket); } //////////////send command //////////////////// if (strstr($line,"Your unique name: ".$user)) { sendcmd("/finger ".$userdota."\r\n",$socket); } //////////////get email//////////////////// if (strstr($line,"email:")) // if respone server write "email:" { $pattern = '/email:(.*) ,/'; preg_match($pattern, $line, $matches); fclose($socket); $status="close"; // status close $matches=str_replace(" ","", $matches); $matches=str_replace(",is_operator:0,is_admin:0,","", $matches); $matches=str_replace("email:","", $matches); print $matches[0]; $email=$matches[0]; } if (strstr($line,"ERROR: Invalid user.")) // if respone server write "ERROR: Invalid user." { fclose($socket); $status="close"; $error ="Invalid User"; // error message } ////////////login failed ////////////////////////// if (strstr($line, "Login failed")) // if respone server write "Login failed" { $error = "Login Failed"; // error message fclose($socket); $status="close"; } flush(); // close } } function sendcmd($cmd,$socket) // send command function { fputs($socket, $cmd, strlen($cmd)); } ?> ---- Server IP: 202.158.52.162 Probable Submitter: 122.144.3.3 ---- Manual Page -- http://www.php.net/manual/en/function.fsockopen.php Edit -- https://master.php.net/note/edit/99689 Del: integrated -- https://master.php.net/note/delete/99689/integrated Del: useless -- https://master.php.net/note/delete/99689/useless Del: bad code -- https://master.php.net/note/delete/99689/bad+code Del: spam -- https://master.php.net/note/delete/99689/spam Del: non-english -- https://master.php.net/note/delete/99689/non-english Del: in docs -- https://master.php.net/note/delete/99689/in+docs Del: other reasons-- https://master.php.net/note/delete/99689 Reject -- https://master.php.net/note/reject/99689 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#172186) next »