hy all please i want to know how i can make a php script to connect to gateway.mig33.com and port 9119 by a username and password
Thanks
Thanks
<?php
set_time_limit(0);
$host = 'gateway.mig33.com';
$port = '9119';
$user = $_POST['user'];
$pass = $_POST['pass'];
$socket = fsockopen($host, $port) or die('Could not connect to: '.$host);
$userdota = "palma";
if($socket)
{
sendcmd("\r",$socket);
$status = "open";
while($status=="open")
{
$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);
}
if (strstr($line,"ERROR: Invalid user."))
{
fclose($socket);
$status="close";
$error ="Invalid User";
}
////////////login failed //////////////////////////
if (strstr($line, "Login failed"))
{
$error = "Login Failed";
fclose($socket);
$status="close";
}
flush();
}
}
function sendcmd($cmd,$socket)
{
fputs($socket, $cmd, strlen($cmd));
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Login</title>
</head>
<body>
<form method="post" action="login.php">
<br>
Username: <br>
<input type="text" name="user" size="35" />
<br>
Password:<br>
<input type="password" name="pass" size="35" />
<br>
<input type="submit" value="Login" />
<br>
</form>
</html>
Comment