|
| |||||||||
| Tags: address, block, ip address, java, php, script |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| Script for Blocking IP Address
Hello, I am new in the programming language and wanted to know that can it be possible to block any kind of IP address with the help of any type of script such as Java script or php script or any other. If you know how to write script which will block the IP address as per your requirement. Please give me coding or suggestions regarding the script. |
|
#2
| ||||
| ||||
| Re: Script for Blocking IP Address
You need to first create an array which will give you the IP address which you want to block. Then you will require the IP address of all the visitors of your site. Then just check that array with your recent visitor and for all those block IP address you can provide error page. This will solve your problem. I don't know the coding, but you can make use of this and create your own script. |
|
#3
| |||
| |||
| Re: Script for Blocking IP Address
The script below will block the IP address, by redirecting them to another website. Code: <script type="text/javascript">
var BannIP=["12.12.12.12", "45.45.45.45"]
var IPadd = '<!--#echo var="REMOTE_ADDR"-->'
var hIP=BannIP.join("|")
hIP=new RegExp(hIP, "i")
if (IPadd.search(hIP)!=-1)
{
alert("Your IP has been banned from this site. Redirecting...")
window.location.replace("<website address>")
}
</script> |
|
#4
| ||||
| ||||
| Re: Script for Blocking IP Address
If you want to block someones IP address then you need to use the script below: Code: <script language="javascript">
var IPAdd = '<!--#echo var="REMOTE_ADDR"-->'
if (IPAdd == '196.12.15.28')
{
alert("You are not allowed to use this page. ");
if (confirm("Do you want to leave this site"))
{
location.href="<site name>"
}
else
{
{
location.href="<site name>"
}
}
}
</script> |
|
#5
| ||||
| ||||
| Re: Script for Blocking IP Address
I don't have any idea about the coding of IP blocker script, but for blocking IP address you can make use of following different script applications:
|
|
#6
| ||||
| ||||
| Re: Script for Blocking IP Address
For blocking IP address on your website you need to use the php script below: Code: <?php
$deny = array("11.11.11.12", "45.65.98.85", "78.65.98.56");
if (in_array ($_SERVER['REMOTE_ADDR'], $deny)) {
header("location: <website name to redirect/");
exit();
} ?> |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "Script for Blocking IP Address" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to find how many Ids’ I have blocked by blocking an IP address? | Damodaran-G | Technology & Internet | 4 | 13-07-2011 09:01 AM |
| What is script Blocking in Antivirus program | Victorious mind | AntiVirus Software | 4 | 03-02-2011 12:02 PM |
| Ip address script | Catchkuber | Software Development | 3 | 24-02-2009 09:35 PM |
| script to get MAC address info. from DHCP | SalemOR97301 | Windows Server Help | 1 | 17-09-2008 02:37 AM |
| netsh script to hard-code IP address | Spin | Windows Server Help | 2 | 11-05-2008 06:41 PM |