To Black List Users On Your Site

Started on the old forum in March 2009 · view the original in the archive · old links redirect here

8 replies · 708 views · started 17 years ago · 1 min read

5 participants
subzero Super moderator Fellow · 3,954 posts #1
<?
$blacklisted = mysql_fetch_array(mysql_query("SELECT  ip  FROM banned WHERE ip "));
$ip= $_SERVER["REMOTE_ADDR"];
if($blacklisted[0] == "$ip")
{
echo "<font face=\"Verdana\" size=\"2\" color=\"#FFFAFA\">";
echo 'Your Ip Has being banned from this services';
echo "</font>";
echo "</div>";
echo "</body>";
echo "</html>";
exit();
}
?>

You can enter a new line thou php or a script 🙂

-- 
-- Table structure for table `banned`
-- 

CREATE TABLE `banned` (
  `ip` varchar(200) NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

coder Newbie · 6 posts #2

You could make a ban like this:

<?php
include("config.php");
$agent = $HTTP_USER_AGENT;

if (empty($HTTP_X_UP_SUBNO))
    {
    $subno = gethostbyaddr ($REMOTE_ADDR);
    }
    else {
    $subno = $HTTP_X_UP_SUBNO;
    }

    $query_b = "SELECT * FROM banned WHERE ( subno='$subno' || agent='$agent' )";
    $result_b = mysql_query($query_b);
    $num_rows_b = mysql_num_rows($result_b);
    
    if ($num_rows_b != 0)
           {
            $row_b = mysql_fetch_array($result_b);
            echo "

            [b]Banned[/b]
            
";

?>
</p>
<?php

echo "</body></html>";
            exit;
           }

elseif ($num_rows_b == 0 )

    {
echo "

Allow page if not banned</p>";

?>

Footer</p>
</body></html>
<?php    
    exit;
}    

?>

And mysql

CREATE TABLE IF NOT EXISTS `banned` (
  `id` int(10) NOT NULL auto_increment,
  `subno` varchar(255) default NULL,
  `agent` varchar(255) default NULL,
  `state` int(1) NOT NULL default '1',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
subzero Super moderator Fellow · 3,954 posts #3

Yeah i want to ban ip only lol

thats for like if i want to block users from usa,uk, etc etc

and leave the au

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

sweetangel Lead · 885 posts #4

QUOTE (subzero @ Mar 5 2009, 08:06 PM) <{POST_SNAPBACK}>

<?
$blacklisted = mysql_fetch_array(mysql_query("SELECT  ip  FROM banned WHERE ip "));
$ip= $_SERVER["REMOTE_ADDR"];
if($blacklisted[0] == "$ip")
{
echo "<font face=\"Verdana\" size=\"2\" color=\"#FFFAFA\">";
echo 'Your Ip Has being banned from this services';
echo "</font>";
echo "</div>";
echo "</body>";
echo "</html>";
exit();
}
?>

You can enter a new line thou php or a script 🙂

-- 
-- Table structure for table `banned`
-- 

CREATE TABLE `banned` (
  `ip` varchar(200) NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

sub and 4 bann a range ip??? 😀

if like my post click:

External image (may be gone)

GumSlone Administrator Principal · 1,690 posts #5
$getip = $_SERVER["REMOTE_ADDR"];
$banned_ip = array();

$banned_ip[] = '194.9.94.*';
$banned_ip[] = '77.105.2.*';

foreach($banned_ip as $banned)
{
$blacked=str_replace('*', '', $banned);
$len=strlen($blacked);
if ($getip==$blacked || substr($getip, 0, $len)==$blacked)
{
$_banned_ip=true;
}
}

Advertise your mobile site for FREE with AdTwirl

External image (may be gone)

subzero Super moderator Fellow · 3,954 posts #6

like gumslone coding it like that this also can act the same in sql

its a ip ban for chat and forums makers

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

WhiteWarrior Principal · 1,419 posts #8

Banning ANY ip address will ban more than 1 person, who ever uses that IP and loads of people use the same IP address will be banned from using the site so really, IP bnning is pointless.. and its simple to change an IP address

subzero Super moderator Fellow · 3,954 posts #9

its for banned users from some where else lol not for one place lol

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close