Jump to content

Read banlist.txt and ban


Username:

Recommended Posts

I wrote a script that inserts an IP to a text file called 'banlist.txt', it works. But how can I read the text-file, and for everyline of IPs, die and don't let them see the content?  I've got this so far

 

<?php
$file = @fopen("banlist.txt", "r");
if ($file) {
    while (!feof($file)) {
        $buff = fgets($file, 4096);
        echo "" . $buff . "<br />";
    }
    fclose($handle);
}
?>

Link to comment
https://forums.phpfreaks.com/topic/214329-read-banlisttxt-and-ban/
Share on other sites

two things.

 

first you should be able to read the txt file and put the IPs in an array and then in your code do something like

 

$ip=$_SERVER['REMOTE_ADDR'];

 

then run $ip against your arry and if there is a match redirect them to yourwebsite.com/yousuck or something

 

and second it would still be easy to access your website if you were ban by using a proxy

 

two things.

 

first you should be able to read the txt file and put the IPs in an array and then in your code do something like

 

$ip=$_SERVER['REMOTE_ADDR'];

 

then run $ip against your arry and if there is a match redirect them to yourwebsite.com/yousuck or something

 

and second it would still be easy to access your website if you were ban by using a proxy

>proxy

What's your point? Lol.

By using a proxie a user can change the ip the access your site via.

 

Most users will have a dynamic ip address anyway, these can change anywhere from weekly to hourly. Not much you can do about it.

Lol I know what a proxy does.

From my experience with networking a majority of people have static.

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.