Hello its me again, Iv been working with a script thats supposed to scan you for open ports and also redirect you if your using a blocked IP/DNS. As of right now without any mod's from me it does not work. Heres the current main code.
$Ports = array('1080', '8080', '8000', '3128', '8888', '23', '80', '8081'); // To hold the list of ports.
$AllowedHosts = array('localhost', 'allowedhost.com'); // To hold the list of allowed hosts.
$DisallowedHosts = array('127.0.0.1.poo.com', 'something.msn.com'); // To hold the list of disallowed hosts.
$Redirect = "http://www.google.com"; // Redirect page
$SocketTimeout = 1; // Higher the number, the longer it takes.
/* End of modification. */
if ((!in_array ($REMOTE_ADDR, $AllowedHosts)) && (!in_array ($REMOTE_ADDR, $DisallowedHosts)))
{
$x = 1;
while ($Ports[$x])
{
$fSockPointer = fsockopen($REMOTE_ADDR, $Ports[$x], $errno, $errstr, $SocketTimeout);
if ($fSockPointer)
{
header ("Location: $Redirect");
fclose($fSockPointer);
}
$x++;
}
} else {
if (in_array ($REMOTE_ADDR, $AllowedHosts))
{
die();
} else {
header ("Location: $Redirect");
die();
}
}
?>
When I add 127.0.0.1 or locathost to DisallowedHosts it wont redirect me I dont know why.
Ok well since it dosnt work as it is this code will not work (these are changes I made and need help with)
$listp = "proxylist.txt"; // words file
$Ports = array('1080', '8080', '8000', '3128', '8888', '23', '80', '8081'); // To hold the list of ports.
$AllowedHosts = array('localhost', 'allowedhost.com'); // To hold the list of allowed hosts.
$DisallowedHosts = array('127.0.0.1.poo.com', 'something.msn.com', $listp); // To hold the list of disallowed hosts.
$Redirect = "http://www.google.com"; // Redirect page
$SocketTimeout = 1; // Higher the number, the longer it takes.
/* End of modification. */
if ((!in_array ($REMOTE_ADDR, $AllowedHosts)) && (!in_array ($REMOTE_ADDR, $DisallowedHosts)))
{
$x = 1;
while ($Ports[$x])
{
$fSockPointer = fsockopen($REMOTE_ADDR, $Ports[$x], $errno, $errstr, $SocketTimeout);
if ($fSockPointer)
{
header ("Location: $Redirect");
fclose($fSockPointer);
}
$x++;
}
} else {
if (in_array ($REMOTE_ADDR, $AllowedHosts))
{
die();
} else {
header ("Location: $Redirect");
die();
}
}
?>
As you can see I added $listp = "proxylist.txt"; . This file has a list of known Proxys I do not want viewing the page. Next I added $DisallowedHosts = array('127.0.0.1.poo.com', 'something.msn.com', $listp); $listp being the proxylist.txt file with all the known proxys that I want redirected to google or some other site.
Anyway the basic jist of this is, is that it wont work as it is and it will not work with my changes. Does anyone see anything that should be changed or a better way of doing this?
Thanks in advanced!