日期:2014-05-17 浏览次数:20571 次
<?php
/**
* name:薛如飞
* qq:6706250
* e-mail:xuerufei@163.com
* blog:<a href="http://hi.baidu.com/" target="_blank">http://hi.baidu.com/</a>飞云盖天
* date:08.08.28
**/
if (isset($_POST['host']) and isset($_POST['user']))
{
$host= $_POST['host'];
$user= $_POST['user'];
$pass= $_POST['pass'];
$cmd= stripslashes($_POST['cmd']);
require_once "phptelnet.php";
$telnet = new PHPTelnet();
$telnet->show_connect_error=0;
$result = $telnet->Connect($host,$user,$pass);
switch ($result)
{
case 0:
$telnet->DoCommand($cmd, $result);
echo $result;
$telnet->Disconnect();
break;
case 1:
echo '[PHP Telnet] Connect failed: Unable to open network connection';
break;
case 2:
echo '[PHP Telnet] Connect failed: Unknown host';
break;
case 3:
echo '[PHP Telnet] Connect failed: Login failed';
break;
case 4:
echo '[PHP Telnet] Connect failed: Your PHP version does not support PHP Telnet';
break;
}
}
else
{
?>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<form action="index.php" method="post" name="form0" id="form0">
<p> </p>
<p align="center" >Telnet</p>
<table width="200" border="0" align="center">
<tr>
<td width="81" height="18">host:</td>
<td width="109"><input name="host" type="text" size="16" value="" /></td>
</tr>
<tr>
<td width="81" height="18">user:</td>
<td width="109"><input name="user" type="text" size="16" value="" /></td>
</tr>
<tr>
<td width="81" height="18">pass:</td>
<td width="109"><input name="pass" type="text" size="16" value="" /></td>
</tr>
<tr>
<td width="81" height="18">cmd:</td>
<td width="109">
<textarea rows="6" name="cmd" cols="16"></textarea></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit" value="提交" /></td>
</tr>
</table>
<p> </p>
</form>
<