Dear noobs and pro's
i know that this post has not mutch to do with eo
but it is still used for eo ( my online checker script) as i want to get powerchaos.info back online so it can be used
but before i put it back online i need to have a good script that does his work instead a messy script (you will see what is changed as soon it is ready to go live)
i like to know who are the scripters here because i got a small request for them
i am searching for a way to block invalid ip's that get submitted with a form
to give a example
ip 258.12.20.14 is invalid
invalid is 192.168.1.1 (private lan network)
i got already a way to block hamachi ip's
i got in meantime a way to block all invalid ip's but for 1 of other reason it allows a few to get true
would some1 be nice to point me to the error or fix the error for me ?
a own code that does the same would be nice to :D
demo of below code can be found at [Only registered and activated users can see links. Click Here To Register...]
the user who can fix this and can show that it works get free Lifetime Premium hosting from me :P
to point it in small what need to be done
enjoy the fun :D
Greetings From PowerChaos
i know that this post has not mutch to do with eo
but it is still used for eo ( my online checker script) as i want to get powerchaos.info back online so it can be used
but before i put it back online i need to have a good script that does his work instead a messy script (you will see what is changed as soon it is ready to go live)
i like to know who are the scripters here because i got a small request for them
i am searching for a way to block invalid ip's that get submitted with a form
to give a example
ip 258.12.20.14 is invalid
invalid is 192.168.1.1 (private lan network)
i got already a way to block hamachi ip's
i got in meantime a way to block all invalid ip's but for 1 of other reason it allows a few to get true
would some1 be nice to point me to the error or fix the error for me ?
a own code that does the same would be nice to :D
demo of below code can be found at [Only registered and activated users can see links. Click Here To Register...]
PHP Code:
$validipcheck1 = "^([1-9]{1,1})+\.([0-9]{1,3})+\.([0-9]{1,3})+\.([0-9]{1,3})$";
$validipcheck2 = "^([1-2]{1,1})+([0-9]{1,2})+\.([0-9]{1,3})+\.([0-9]{1,3})+\.([0-9]{1,3})$";
$hamachiip = "^([5]{1,1})+\.([0-9]{1,3})+\.([0-9]{1,3})+\.([0-9]{1,3})$";
$local1 = "^([1]{1,1})+([9]{1,1})+([2]{1,1})+\.([1]{1,1})+([6]{1,1})+([8]{1,1})+\.([0-9]{1,3})+\.([0-9]{1,3})$";
$local2 = "^([1]{1,1})+([0]{1,1})+\.([0-9]{1,3})+\.([0-9]{1,3})+\.([0-9]{1,3})$";
$range1 = "^([1]{1,1})+([7]{1,1})+([2]{1,1})+\.([1-2]{1,1})+([6-9]{1,1})+\.([0-9]{1,3})+\.([0-9]{1,3})$";
$range2 = "^([1]{1,1})+([7]{1,1})+([2]{1,1})+\.([3]{1,1})+([0-2]{1,1})+\.([0-9]{1,3})+\.([0-9]{1,3})$";
$subcheck1 = "^([2-9]{1,1})+([5-9]{1,1})+([5-9]{1,1})+\.([0-9]{1,3})+\.([0-9]{1,3})+\.([0-9]{1,3})$";
$subcheck2 = "^([0-9]{1,3})+\.([2-9]{1,1})+([5-9]{1,1})+([5-9]{1,1})+\.([0-9]{1,3})+\.([0-9]{1,3})$";
$subcheck3 = "^([0-9]{1,3})+\.([0-9]{1,3})+\.([2-9]{1,1})+([5-9]{1,1})+([5-9]{1,1})+\.([0-9]{1,3})$";
$subcheck4 = "^([0-9]{1,3})+\.([0-9]{1,3})+\.([0-9]{1,3})+\.([2-9]{1,1})+([5-9]{1,1})+([5-9]{1,1})$";
if ((eregi($subcheck1, $ip)) OR (eregi($subcheck2, $ip)) OR (eregi($subcheck3, $ip)) OR (eregi($subcheck4, $ip)) OR (eregi($local1, $ip)) OR (eregi($local2, $ip)) OR (eregi($range1, $ip)) OR (eregi($range2, $ip)))
{
$sub == 1;
}
if ((!eregi($validipcheck1, $ip)) OR (!eregi($validipcheck2, $ip)) OR ( $sub == 1 ))
{
$proceed = 0;
$end = 1;
echo "<blockquote>
<p>
“Server ip adress is Not Allowed , Please fill in a differend ip adress.”
</p>
</blockquote>";
}
else if ((eregi($validipcheck1, $ip)) OR (eregi($validipcheck2, $ip)))
{
$proceed = 0;
$end = 1;
echo "<blockquote>
<p>
“Valid ip match.”
</p>
</blockquote>";
}
to point it in small what need to be done
- block private lan adresses
192.168.0.0 – 192.168.255.255
172.16.0.0 – 172.31.255.255
10.0.0.0 – 10.255.255.255
5.0.0.0 - 5.255.255.255 - block invalid ip adresses ( like 256 or higher in any block )
- check for 3 dots (valid ip adress )
- block invalid ip adresses ( 256.25.21.20 = working )
- allow short ip adresses ( 1.1.1.1 = fail )
- allow some valid ip adresses ( 205.25.25.25 = fail )
enjoy the fun :D
Greetings From PowerChaos