| |||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| NamePros Regular | PHP IP block I wanting to create a better ip blocker but can't seem to figure it out. First here is the code that I get the ip with PHP Code: $ip = "216.86.152.216"; When an ip is blocked it is added to a table in the database. When the page is accessed it checks for the ip output from the above line against what is in the table. PHP Code:
__________________ Four Seasons Outfitters [ 25 $NP/Month ] [ 25 $NP/Month ] [ 25 $NP/Month ] [ 25 $NP/Month] [ 25 $NP/Month] |
| |
| | #2 (permalink) |
| Barru. | Edit: Oh, I just saw you said without re-doing the db. Ah well... There is probably a better way than this: PHP Code:
__________________ |
| |
| | #3 (permalink) |
| NamePros Member | There will most definitely be tidier ways of doing this, but PHP Code:
__________________ Regards Jamie Let the might of your compassion arise to bring a quick end to the flowing stream of the blood and tears ..... Please hear my anguished words of truth. Last edited by jabba_29; 05-08-2007 at 10:00 AM. |
| |
| | #5 (permalink) |
| NamePros Member | Of course. If you use file() you can open a text file as an array. Using in_array from there should do the trick. What exactly do you need to know? What is your coding level?... Do you need to know how to write the files or have you got something concrete already?
__________________ Regards Jamie Let the might of your compassion arise to bring a quick end to the flowing stream of the blood and tears ..... Please hear my anguished words of truth. |
| |
| | #6 (permalink) | |
| Senior Member | Quote:
can u please give me a proper code which i can insert in my already existing php files and use a text file to list out all the ip addresses that i need banned? | |
| |
| | #7 (permalink) | |
| Traveller | Quote:
PHP Code: BTW Twizted, you could probably go a bit easier on your DB by doing: banip LIKE '$ip%'" (No percent sign at the start) This assumes your `banip` field contains only a single IP, with no whitespace.
__________________ Internet.geek.nz NameCooler.com Unlimited Domain Name Web Hosting Travel Money Rates | |
| |
| | #9 (permalink) | ||
| NamePros Regular | Quote:
Quote:
__________________ Four Seasons Outfitters [ 25 $NP/Month ] [ 25 $NP/Month ] [ 25 $NP/Month ] [ 25 $NP/Month] [ 25 $NP/Month] | ||
| |
| | #13 (permalink) | |
| Senior Member | Quote:
http://www.webhostgear.com/61.html
__________________ || VPSByte Virtual & Dedicated Solutions || True 24/7/365 support with a 1 hour guaranteed response time! || We offer budget, yet powerful dedicated servers and vps solutions. || All servers come w/ 10Mbps unmetered bandwidth & lite management standard. | |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |