Jump to content

RQ: Help for PHP code of TestPort


error_404

Recommended Posts

Dear all,

I would like if it's possible to receive the source code for TestPOrt because I want to integrate it to one CMS system in the INTRANET for INTERNAL use only.

This is the reason for what i'm searching the NET and I like your TestPort how it works.

http://www.utorrent.com/testport.php

If somebody can help because i'm a noob in PHP!

Thank you in advance.

Link to comment
Share on other sites

Thank you in advance I'l check now!

This is the full code or part of that code used in testports.php?!?!?!

Thanks again!

I try this but t's not working!

<?php

// if getenv results in something, proxy detected

if (getenv('HTTP_X_FORWARDED_FOR')) {

$ip=getenv('HTTP_X_FORWARDED_FOR');

}

// otherwise no proxy detected

else {

$ip=getenv('REMOTE_ADDR');

}

// print the IP address on screen

print ('<span class="style1">YOUR IP IS: </span><span class="style2">'.$ip.'</span></br>');

if (!fsockopen($ip, (int)$_GET['port'], $errno, $errstr, 10))

else {

print ('<span class="style1">NOT OPEN PORT</span></br>');

}

else {

print ('<span class="style1">OPEN PORT</span></br>');

}

?>

Link to comment
Share on other sites

else {
print ('<span class="style1">NOT OPEN PORT</span></br>');
}

here's the problem :) it cant parse the file

change it to:

{
print ('<span class="style1">NOT OPEN PORT</span></br>');
}

btw you can change "!fsockopen" to "!@fsockopen" to prevent it from outputting errors :)

here's the final version:

<?php

if (!$ip = getenv('HTTP_X_FORWARDED_FOR')) // if getenv results in something, proxy detected
$ip=getenv('REMOTE_ADDR'); // otherwise no proxy detected

// print the IP address on screen
print ('<span class="style1">YOUR IP IS: </span><span class="style2">'.$ip.'</span></br>');

if (!@fsockopen($ip, (int)$_GET['port'], $errno, $errstr, 10))
print ('<span class="style1">NOT OPEN PORT</span></br>');
else
print ('<span class="style1">OPEN PORT</span></br>');
?>

Link to comment
Share on other sites

  • 4 months later...

Hello, could any one help me with his sticky problem I'm having with php sockets (I'd really appreciate it, I've been trying to find the cause of the problem since weeks now)

okay.. now lets consider this script: (credits to bugmenot)

http://www.erickxavier.com/test_port.php?inicio=80&fim=90

it shows you open ports from 80 to 90. My router has ports 82 and 88 OPEN, and the script shows ports 82 and 88 open.. Works.

BUT when I copy it to my web server.. it shows PORT CLOSE for all ports (thats the same script, different results!)

I contacted my web server and they said php sockets are disabled on the server due to security reasons. Well as mad as I was, I felt relieved for finally figuring out the cause of the problem. Well, maybe NOT!

I then singed up for a free web host to test the script at www.000webhost.com and PLEASE take a look at this page http://www.000webhost.com/free-php-hosting

it says that fopen() and PHP sockets are SUPPORTED. but I the script shows PORT CLOSE for all ports... NOT AGAIN :mad: (now this is really crazy) what is this? a discriminating script of some kind???

IP: 89.108.156.150 (you can copy the script and replace the IP declaration)

Ports OPEN: 82, 88

You can find the script here: http://forum.utorrent.com/viewtopic.php?id=38356

(bugmenot post)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...