test-port.php -- source code?

Post Reply
User avatar
brettalton
Member
Member
Posts: 21
Joined: Sun Oct 28, 2007 11:29 pm

test-port.php -- source code?

Post by brettalton »

Can I see the source code to test-port.php? I'm interested in how it works.
gerdradecke
Member
Member
Posts: 11
Joined: Thu Aug 02, 2007 8:15 pm

Re: test-port.php -- source code?

Post by gerdradecke »

dunno if you need the exact deluge test-port code, but since utorrent pretty much does the same, afaik, this should help you:

http://forum.utorrent.com/viewtopic.php?id=38356
markybob
Compulsive Poster
Compulsive Poster
Posts: 1230
Joined: Thu May 24, 2007 11:27 pm
Location: Chicago, IL, USA
Contact:

Re: test-port.php -- source code?

Post by markybob »

it's no secret. here it is:

Code: Select all

<?php
error_reporting(0);
$host = $_SERVER['REMOTE_ADDR'];
$i = $_GET['port'];
$fp = fsockopen("$host",$i,$errno,$errstr,10);
if($fp){
    echo "TCP port " . $i . " open on " . $host . "<br><br>Yay! :-)";
    fclose($fp);
}
else{
    echo "TCP port " . $i . " closed on " . $host . "\n";
}
flush();
?> 
Post Reply