IP blocker script

  • Arman
  • Newbie
  • Newbie
  • Arman
  • Posts: 9

Post 3+ Months Ago

Hi there,
I was wondering if some one can help me to get some kind of scripts to block ips from entering my web page.. thank you.
Arman :roll:
http://members.vpchat.com/arman/Armans-Place-Backgammon.html[/url]
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9086
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

Hey good to see you here. About blocking IPs to your webpage can I ask why you need to block IPs? Also do you know exactly which IP you want to block? There are numerous ways in which you can block an IP from visiting your site, but it kind of depends on your circumstances and what you are trying to accomplish.
  • Arman
  • Newbie
  • Newbie
  • Arman
  • Posts: 9

Post 3+ Months Ago

Good to be here,
Reason I need a ip blocker is that I have this gammon league with over 300 members in halsoft but there is this guy keeps coming there and harrassing people while they are in a tournament. so I just was wondering if there is anyway i could block him from entering my pages. any :idea: ?
Arman
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9086
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

Okay well first you will need to know his IP. If you cannot figure out his IP you will not be able to block him from your site. If you do know his IP then you can try placing a .htaccess file in your root directory of your website. However it is possible this will not work if your host provider for your website does not allow overrides to take place in the .htaccess file or if your system simply does not support the .htaccess file

Anyway you can try this:

  • Create a file named .htaccess in your main directory of your website
  • For the contents of the file put this:
    Code: [ Select ]
    <Limit GET POST>
    order allow,deny
    allow from all
    deny from 111.111.111.111
    </Limit>
    1. <Limit GET POST>
    2. order allow,deny
    3. allow from all
    4. deny from 111.111.111.111
    5. </Limit>
  • Now simply change 111.111.111.111 to the ip address you wish to block.

I recommend you test this code with your own IP address or someone elses IP address. That way you can be sure if it is working or not. If it works the IP address that you list there will have no access to the site, they will be denied.
  • Arman
  • Newbie
  • Newbie
  • Arman
  • Posts: 9

Post 3+ Months Ago

I sure do know his IP, but the thing is he is on dile up and changes Ip like I change girlfriends..LOL
anyhow I will try that.. I belive there is a script to tell you people's ip when they enter your page.. Thank you so much, will let you know if it did work.
Arman
  • Arman
  • Newbie
  • Newbie
  • Arman
  • Posts: 9

Post 3+ Months Ago

sorry to bother you, but I didn't undrestand what you meant by Create a file named .htaccess in your main directory of your website
For the contents of the file put this:
would you please explain a bit more?
Thank you
Arman
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9086
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

Simply make file with notepad. Put the contents above that I posted above in that file and change the ip address to the IP you want to block. Now upload that file to your server and make sure the file name says .htaccess on the server.
  • Arman
  • Newbie
  • Newbie
  • Arman
  • Posts: 9

Post 3+ Months Ago

Hi there
I undrestood most of the instructions you gave me but the last part.. What do I name the file as? I'm sure it has to be something.htaccess or is it just .htaccess !
Thank you for all your time.
Arman
  • ED
  • Student
  • Student
  • ED
  • Posts: 66
  • Loc: Halifax

Post 3+ Months Ago

JUST ".htaccess"

thats it.
you can put it in any directory you want to protect from the guy... it'll also protect any subdirectory of the directory you place it in.
  • Arman
  • Newbie
  • Newbie
  • Arman
  • Posts: 9

Post 3+ Months Ago

here what I got when i uploaded it.
Invalid file name: .htaccess.txt
is that mean my server does not support it?
Arman
  • ED
  • Student
  • Student
  • ED
  • Posts: 66
  • Loc: Halifax

Post 3+ Months Ago

its because you probably created it in notepad or wordpad...
on your PC... rename the file to... ".htaccess"
not ".htaccess.txt"

you might have your options set to not show known file types so it might not even show .txt when you view the file on your PC..

anyway... i'm sure your FTP program allows you to rename files too...
so... through whatever means .... rename that file ".htaccess" and thats it..
then it'll work
  • Arman
  • Newbie
  • Newbie
  • Arman
  • Posts: 9

Post 3+ Months Ago

Hi there
Thank you for being patient with me, now I'm lost.. well if I use notepad then the file name will be .htaccess.txt for sure, if I use my dreamweaver, I give the file name .htaccess after its saved it shows there is no name on that file but it showing like an html file. I must be doing something wrong here cause even that when i upload it says Invalid file name: .htm.. all I know is there has to be a name before .htaccess. the file I have saved on my pc says .htaccess but only when I upload it it shows as .htaccess.txt, now this either should be a html file or just a txt , the reason is failing is cause the file name is starting with a dot. :(
  • Arman
  • Newbie
  • Newbie
  • Arman
  • Posts: 9

Post 3+ Months Ago

Only letters, numbers, or '_' are allowed in the name of a file or directory.
just tried two other servers to upload the file name .htaccess and both said the same thing!
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9086
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

Okay Arman do this.

Make a file on your computer called htaccess.txt and put the contents that i said above in it. It should work as that filename is windows compatible.

Now upload that file to your server. You will now have a file called htaccess.txt on your server.

Now rename the file on the server (NOT YOUR COMPUTER). Rename it to .htaccess

Hope that makes sense.
  • Arman
  • Newbie
  • Newbie
  • Arman
  • Posts: 9

Post 3+ Months Ago

Hi there,
Do you know where I can find a script for floating tool bar which stays on the page eventhough when you scroll up and down?
Thank you
Arman
  • cromagnon
  • Born
  • Born
  • cromagnon
  • Posts: 2

Post 3+ Months Ago

Thanks for a nice way to block IP's. Is it possible to moderate the code in the htaccess-fil so you can redirect the visitor instead of blocking?

Cromag
  • b_heyer
  • Web Master
  • Web Master
  • User avatar
  • Posts: 4581
  • Loc: Maryland

Post 3+ Months Ago

I am sure there is a way. You might have to do that on a per IP basis though, making for a pretty large file if you have a lot of IP's you want to ban.

You could redirect certain IPs with this:

Code: [ Select ]
RewriteEngine On
RewriteCond %{REMOTE_ADDR} 111.111.111 [OR]
RewriteCond %{REMOTE_ADDR} ^222.*
RewriteRule ^/$ /redirectedpage.html [L]
  1. RewriteEngine On
  2. RewriteCond %{REMOTE_ADDR} 111.111.111 [OR]
  3. RewriteCond %{REMOTE_ADDR} ^222.*
  4. RewriteRule ^/$ /redirectedpage.html [L]


That will redirect anyone with IP 111.111.111 or IP 222.*.* to redirectedpage.html.

You could also exchange this for the last line:
Code: [ Select ]
RewriteRule ^/$ http://www.google.com/ [R]


And that would send them to Google.
  • cromagnon
  • Born
  • Born
  • cromagnon
  • Posts: 2

Post 3+ Months Ago

Hallo B_heyer

Thank you for your reply. I have tried your post, but can not get it to work. I have no idea about coding, so please correct me if I am wrong. I use this code in the .htaccess-file:

Code: [ Select ]
<Limit GET POST>
RewriteEngine On
RewriteCond %{REMOTE_ADDR} 111.111.111.111
RewriteRule ^/$ http://www.google.com/ [R]
</Limit>
  1. <Limit GET POST>
  2. RewriteEngine On
  3. RewriteCond %{REMOTE_ADDR} 111.111.111.111
  4. RewriteRule ^/$ http://www.google.com/ [R]
  5. </Limit>


Ofcause the IP is changed with the IP I wanna redirect.

Can you help me?

Cromag
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9086
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

I do not think the rewrite rules are supposed to be in a limit block. Try getting rid of the line:
Code: [ Select ]
<Limit GET POST>


and

Code: [ Select ]
</Limit>


and see if that makes a difference.
  • b_heyer
  • Web Master
  • Web Master
  • User avatar
  • Posts: 4581
  • Loc: Maryland

Post 3+ Months Ago

BWM hit it on the head of the nail...or however that saying goes, hit the nail right on the head? eh? who knows.
  • MastressAlita
  • Born
  • Born
  • MastressAlita
  • Posts: 1

Post 3+ Months Ago

This there a way to modify this script in the .htaccess file to block a range of IP addresses rather than an individual address? For example, to keep any addresses from a certain country from being able to view your site.

And yes, in all honestly I know nothing about scripting... I'm still using that plain HTML I learned when I was 10. :wink: So any help is appreciated.
  • BinaryTox1n
  • Beginner
  • Beginner
  • BinaryTox1n
  • Posts: 55
  • Loc: Deer Park, Texas

Post 3+ Months Ago

beh, if you know php you can have a php script do it for you, fairly easily too... i have a pre-written script that you can php-include on your page to block any number of ips you like... it uses a database to hold the ip adresses and displays a customized block message. (i know, i was bored, leave me alone lol) i can give it to you if you like, its fairly portable.
  • madmonk
  • Mastermind
  • Mastermind
  • madmonk
  • Posts: 2115
  • Loc: australia

Post 3+ Months Ago

dude. use this.
http://www.tlhouse.co.uk/HTAccessible.shtml

product reviews guys...??

:)
  • seanradio
  • Born
  • Born
  • seanradio
  • Posts: 1

Post 3+ Months Ago

I have read the various postings around IP BLOCKING using an .htaccess file. Hey it works - but I can't seem to master the ability to block a range of IP's - any ideas? Help!
  • HellEden
  • Born
  • Born
  • HellEden
  • Posts: 3

Post 3+ Months Ago

Hiya...

Looking for #1: a relatively easy way to block specific countries via their IP address (possibly using the ip-to-country database)

Reason: I have a pay-per-click search engine that will be up soon ... my feeds do not allow searches from specific countries... the reason is mainly cheating (or wasted revenue, depending on how you look at it :) ) So to ensure that *I* don't lose my feeds I need to put something in place to block these types of visitors...

Any sort of informational help or a possible direction I could possible go in to find more information would be greatly appreciated...

Thanks in advance!
  • suzie
  • Guru
  • Guru
  • User avatar
  • Posts: 1134
  • Loc: England

Post 3+ Months Ago

My thanks go to BWM for that imformation !
arman try "hotscripts" you may get one there!
http://www.hotscripts.com/
Nice code b_heyer..google..lolol
Interesting topic..great solutions, well done guys...and thanks.
suzie
:)
  • mikeruss
  • Born
  • Born
  • mikeruss
  • Posts: 2

Post 3+ Months Ago

Try this

http://www.mikeruss.dircon.co.uk/htaccess/
  • lifeanatomy
  • Novice
  • Novice
  • lifeanatomy
  • Posts: 27
  • Loc: England!

Post 3+ Months Ago

b_heyer wrote:
I am sure there is a way. You might have to do that on a per IP basis though, making for a pretty large file if you have a lot of IP's you want to ban.

You could redirect certain IPs with this:

Code: [ Select ]
RewriteEngine On
RewriteCond %{REMOTE_ADDR} 111.111.111 [OR]
RewriteCond %{REMOTE_ADDR} ^222.*
RewriteRule ^/$ /redirectedpage.html [L]
  1. RewriteEngine On
  2. RewriteCond %{REMOTE_ADDR} 111.111.111 [OR]
  3. RewriteCond %{REMOTE_ADDR} ^222.*
  4. RewriteRule ^/$ /redirectedpage.html [L]


That will redirect anyone with IP 111.111.111 or IP 222.*.* to redirectedpage.html.

You could also exchange this for the last line:
Code: [ Select ]
RewriteRule ^/$ http://www.google.com/ [R]


And that would send them to Google.


just a couple of extremely simple questions why, on 1 of the scripts does it say [R] and on the other [L]

the second: do i just throw the code in the top of the page or is this a .htaccess file?
  • Sharky
  • Student
  • Student
  • Sharky
  • Posts: 89
  • Loc: US

Post 3+ Months Ago

wow thats great ive been looking for a php ipblocker script i never thought of doing something like that thats great :D!!!
i had one the only proble i found with it u have to put the php tag in every page.
  • any1
  • Born
  • Born
  • any1
  • Posts: 2

Post 3+ Months Ago

BinaryTox1n wrote:
beh, if you know php you can have a php script do it for you, fairly easily too... i have a pre-written script that you can php-include on your page to block any number of ips you like... it uses a database to hold the ip adresses and displays a customized block message. (i know, i was bored, leave me alone lol) i can give it to you if you like, its fairly portable.


I've been looking for a script like that! I'd like to get it if you don't mind :wink:
Would it be possible to redirect visitors instead of displaying a blocking message?
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

Post Information

  • Total Posts in this topic: 39 posts
  • Users browsing this forum: No registered users and 104 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.