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
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

 

Link to comment
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

>proxy

What's your point? Lol.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.