To Black List Users On Your Site

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    To Black List Users On Your Site

    Code:
    <?
    $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 &#39;Your Ip Has being banned from this services&#39;;
    echo "</font>";
    echo "</div>";
    echo "</body>";
    echo "</html>";
    exit();
    }
    ?>

    You can enter a new line thou php or a script

    Code:
    -- 
    -- Table structure for table `banned`
    -- 
    
    CREATE TABLE `banned` (
      `ip` varchar(200) NOT NULL default &#39;&#39;
    ) 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...
    _______
    Info & Tips
    php.net
    w3schools.com

    #2
    You could make a ban like this:

    Code:
    <?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=&#39;$subno&#39; || agent=&#39;$agent&#39; )";
        $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

    Code:
    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 &#39;1&#39;,
      PRIMARY KEY  (`id`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;

    Comment


      #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...
      _______
      Info & Tips
      php.net
      w3schools.com

      Comment


        #4
        <div class='quotetop'>QUOTE (subzero @ Mar 5 2009, 08:06 PM) <{POST_SNAPBACK}></div>
        Code:
        <?
        $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 &#39;Your Ip Has being banned from this services&#39;;
        echo "</font>";
        echo "</div>";
        echo "</body>";
        echo "</html>";
        exit();
        }
        ?>

        You can enter a new line thou php or a script

        Code:
        -- 
        -- Table structure for table `banned`
        -- 
        
        CREATE TABLE `banned` (
          `ip` varchar(200) NOT NULL default &#39;&#39;
        ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
        [/b]
        sub and 4 bann a range ip???
        if like my post click:

        http://coding-talk.com/images/totall...ost_thanks.gif

        Comment


          #5
          Code:
          $getip = $_SERVER["REMOTE_ADDR"];
          $banned_ip = array();
          
          $banned_ip[] = &#39;194.9.94.*&#39;;
          $banned_ip[] = &#39;77.105.2.*&#39;;
          
          foreach($banned_ip as $banned)
          {
          $blacked=str_replace(&#39;*&#39;, &#39;&#39;, $banned);
          $len=strlen($blacked);
          if ($getip==$blacked || substr($getip, 0, $len)==$blacked)
          {
          $_banned_ip=true;
          }
          }
          Advertise your mobile site for FREE with AdTwirl

          Comment


            #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...
            _______
            Info & Tips
            php.net
            w3schools.com

            Comment


              #7
              gum I wont use networks table of ip2location...with flag UK. how I can this??
              if like my post click:

              http://coding-talk.com/images/totall...ost_thanks.gif

              Comment


                #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

                Comment


                  #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...
                  _______
                  Info & Tips
                  php.net
                  w3schools.com

                  Comment

                  Working...
                  X