Jump to content

[SOLVED] separate the good from the bad


zhangy

Recommended Posts

Hello,

 

I am trying to disallow form submissions from being processed based upon the users ip address.

 

As of now all forms are processed regardless of ip, Im just trying to figure out how to ad something like a $blockip variable that will basically stop the processing code from working if the ip address of the user matches said variable. Does anyone have an idea as to how I could perform this?

 

 

Link to comment
https://forums.phpfreaks.com/topic/141730-solved-separate-the-good-from-the-bad/
Share on other sites

Arrays are only valid during the running of the script. So when the script ends, the array disappears.

 

Basically, you need to store the IP addresses somewhere. If you don't store them, then how will you know which ones to block? You can store it a few different ways:

 

* in the database

* in a file

* hard code the IPs directly into the script you are using

 

Whichever method you use, the testing is the same - see if the current IP is the same as one of the blocked IPs.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.