GetSimple Support Forum
Block ip address - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: General Questions and Problems (http://get-simple.info/forums/forumdisplay.php?fid=16)
+--- Thread: Block ip address (/showthread.php?tid=5765)



Block ip address - Prog - 2014-03-10

Okay I'm a total noob when it comes to getsimple, so please bear that in mind. I was wondering if there was anyway in which I could block a certain ip address from accessing my website, or if I could block out all ip addresses except for my own. And if there is could you say how it is done (again I'm a total noob) Thanks


RE: Block ip address - shawn_a - 2014-03-10

You can put this in a .htaccess file in /admin
but with your ip

Code:
order deny,allow
deny from all
allow from 127.0.0.1



RE: Block ip address - Prog - 2014-03-11

Thanks a lot, you really helped

(2014-03-10, 23:44:14)shawn_a Wrote: You can put this in a .htaccess file in /admin
but with your ip

Code:
order deny,allow
deny from all
allow from 127.0.0.1



RE: Block ip address - shawn_a - 2014-03-11

afaik there is not a plugin or anything specific to gs for this, but that is what I use, if you use something other than apache you will of course need some other way.


RE: Block ip address - Prog - 2014-03-11

I did it but now even I can't access the website (I did use my own ip) and when I delete the.htacces file I still can't access the website. HELP!


RE: Block ip address - shawn_a - 2014-03-11

What version of apache are you on ?

Also you sure it was successfully deleted ?
Where did you put it?


RE: Block ip address - Kolyok - 2014-03-15

Maybe it should be

Code:
order allow,deny
allow from all
deny from xxx.xxx.xxx.xxx

Where xxx.xxx.xxx.xxx the IP should be written that u wanna ban.


RE: Block ip address - Angryboy - 2014-03-15

Wrote up a little plugin to try automating what shawn said, except this is strictly for denying access to the given IPs; 1 per line. Does it in any way do the job for you? (if there are any problems, deactivate the plugin and delete the .htaccess file from /admin)

[attachment=370]


RE: Block ip address - shawn_a - 2014-03-15

Denying? Is it at least a pattern of some sort? Why would you want to deny specific ips?
Also is this for back end only or frontend?

I imagine you would want deny specific on front and allow specific on back, they are kind of reversed roles


RE: Block ip address - Angryboy - 2014-03-15

It can easily be modified to allow only those IPs instead.

To deny front-end scripts, would the IPs need to be appended to the .htaccess in the root?


RE: Block ip address - shawn_a - 2014-03-15

Well if you are making this a plugin then I would just use the first hook available and
$_SERVER["REMOTE_ADDR"] and match a pattern in php.


RE: Block ip address - Angryboy - 2014-03-15

Oh fair enough. So just store the list of IP addresses in either a text or xml file and compare it to that, then exit the PHP script immediately if it matches one of the IPs. I wondered if the htaccess method was in some way more elegant (since I've used the previous method on CUsers before), but that seems to work. I'll code it soon.

Also, when you say match a pattern, are you saying that the IP addresses stored by this plugin should allow for wildcards too?


RE: Block ip address - shawn_a - 2014-03-15

Of course htaccess is better, it stops at the request level, but a plugin would always work as opposed to sometimes.

Yeah wildcards are handy for subnets.

how were you doing it modifying the htaccess directly?