Helpful Information
 
 
Category: Scripts
Block Specific User

Hi

i know websites such as Ebay got this option for their users that is you can add any user to your "block" list, he/she would not be able to post or bid anything related to you until you remove the user off your "block" list.

So does anyone here know how "Block Specific User" work? or is there a script or maybe, a tutorial that i can read up? Thanks

I would imagine this is done by IP address. If you can detect the user's IP, you can prevent them from viewing your site by checking each user's IP address when they visit your site.

I found some sample scripts on HotScripts that would accomplish this, using PHP:

http://www.hotscripts.com/PHP/Scripts_and_Programs/Redirection/User_Based/

However, this is assuming you're using PHP on your site; if not, or if you're not sure what you're using, you might look for a script that uses Perl (which is installed on almost every *nix system).

Hope that helps.

Actually the "Block Specific User" is more like the ignore lists being used in this forum...

Originally posted by Sim_Charlie
Actually the "Block Specific User" is more like the ignore lists being used in this forum...

Both eBay and the vBulletin forum software rely on the storing of user information in order to accomplish the banning of specific users - and, even then, it is essentially managed by the user's IP address.

Does your site implement a user login system? If so, then 'banning' users should be trivial, as recording their IP and matching this to personal information has already been taken care of... the only thing to implement at that point is restricting their access to the site.

If your site isn't using user login, employing one of the aforementioned scripts could be a time saver.

Here put this in the page you wish to block the user to:

<?

$blockip = array("555.555.55.55");
$x = count($blockip);
for ($y = 0; $y < $x; $y++) {
if ($REMOTE_ADDR == $blockip[$y]) {
echo ("Site Down");
Exit;}
}

?>

Ok here you go,

You have 2 options into doing this. if you have only 1 page to block, just use the code above, if you have 2 do this

copy this code above with your new ip in it. name it something like banned.php than upload to your server. Now any page you want to protect just add this line to the page:

<?php include 'banned.php'; ?>

This will pull that file every time to check their IP. If their ip is not on that list it will just load the page.

echo ("Site Down");

You can put any text you wish by Site Down. So when the script runs and they are blocked it says that message. I find Site Down fitting because they think the site is down and have no clue they have been banned.

Now to save you some headache and time, you will ask "how do I add more than one?"

change it from: $blockip = array("555.555.55.55");

to: $blockip = array("555.555.55.55", "555.555.55.55", "555.555.55.55");

This should help you, i hope so.

have a look at the 'im status' site.










privacy (GDPR)