<?
require "include/bittorrent.php";
dbconn();
loggedinorreturn();
stdhead(testport);
if ($CURUSER)
{

$ip=$CURUSER['ip'];

if ($_SERVER["REQUEST_METHOD"] == "POST")
	$port = $_POST["port"];
  else
  $port=$_GET['port'];
if ($port)
{
$fp = @fsockopen ($ip, $port, $errno, $errstr, 10);
if (!$fp) {
  
   print ("<table width=40% id=torrenttable class=tableoutborder cellspacing=1 cellpadding=5><br><tr>".
"<td class=tabletitle align=center><b>Porttest</b></td></tr><tr><td class=tableb><font color=red><br><center><b>Die IP: $ip ist auf dem Port: $port nicht erreichbar!</b></center><br></font></td></tr><tr><td class=tableb><center><form><INPUT TYPE=\"BUTTON\" VALUE=\"Neuer Porttest\" ONCLICK=\"window.location.href='/testport.php'\"></form></center></td></tr></table");
} else {
  
   print ("<table width=40% id=torrenttable class=tableoutborder cellspacing=1 cellpadding=5><br><tr>".
"<td class=tabletitle align=center><b>Porttest</b></td></tr><tr><td class=tableb><font color=green><br><center><b>Die IP:$ip ist auf dem Port:$port erreichbar!</b></center><br></font></td></tr><tr><td class=tableb><center><form><INPUT TYPE=\"BUTTON\" VALUE=\"Neuer Porttest\" ONCLICK=\"window.location.href='/testport.php'\"></form></center></td></tr></table>");
}
}
 
else
{
print("<table width=40% id=torrenttable class=tableoutborder cellspacing=1 cellpadding=5><br><tr>".
"<td class=tabletitle align=center><b>Porttest</b></td>".
"</tr>");
print("</table>");
print ("<form method=post action=testport.php>");
print ("<table width=\"40%\" border=1 cellspacing=0 cellpadding=5>");
print ("<tr><td class=tableb><center>Portnummer:<center></td><td class=tableb><center><input type=text name=port></center></td></tr>");
print ("<tr><td class=tableb></td><td class=tableb><center><input type=submit class=btn value='Port testen'></center></td></tr>");
print ("</form>");
print ("</table>");
}
}
stdfoot ();
?>