Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: IP Block

  1. #1
    Join Date
    Mar 2007
    Location
    Great Yarmouth, United Kingdom
    Posts
    49
    Tokens
    0
    Habbo
    DJ-Whoeva

    Default IP Block

    Can any1 tell me the script or what eva to block an ip cos the ones i used before didnt work :S
    Alex

  2. #2
    Join Date
    Sep 2006
    Location
    England
    Posts
    2,299
    Tokens
    0

    Latest Awards:

    Default

    On cpanel that I use theres a section to Ban IPs I think its wat most people use
    Habbox eXpert Team Leader (B) Habbo
    PM me for ANY help

    Ex Habbox Super Moderator
    Ex CA HxHD SS
    Ex Articles Staff

  3. #3
    Join Date
    Mar 2007
    Location
    Great Yarmouth, United Kingdom
    Posts
    49
    Tokens
    0
    Habbo
    DJ-Whoeva

    Default

    kk wots it called
    Alex

  4. #4
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    3,285
    Tokens
    0

    Latest Awards:

    Default

    It's easy to do

    PHP Code:
    <?php
    if ($_SERVER['REMOTE_ADDR'] == "THE IP YOU WANT TO BAN") {
    die(
    "You have been IP banned.");
    }
    ?>



    i used to be NintendoNews. visit my blog or add me on twitter.
    need help with vista? i am a microsoft certified technology specialist in configuring windows vista and connected home integrator.. pm me for help!


    "I am the way, the truth, and the life. No one comes to the Father except through me"
    John 14:6 (NIV)


  5. #5
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    If you want to ban multiple IPs I reccommend to use an array not to use elseif's

  6. #6
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    3,285
    Tokens
    0

    Latest Awards:

    Default

    If you have multiple:

    PHP Code:
    <?php
    $array 
    = array("first ip""second ip""third ip""etc");
    foreach (
    $array as $ip) {
    if (
    $_SERVER['REMOTE_ADDR'] == $ip) {
    die(
    "You've been IP banned.");
    }
    }
    ?>



    i used to be NintendoNews. visit my blog or add me on twitter.
    need help with vista? i am a microsoft certified technology specialist in configuring windows vista and connected home integrator.. pm me for help!


    "I am the way, the truth, and the life. No one comes to the Father except through me"
    John 14:6 (NIV)


  7. #7
    Join Date
    Apr 2007
    Posts
    50
    Tokens
    0

    Default

    U Can use a Redirect One -
    HTML Code:
    <script language="JavaScript" type= "text/javascript" >
    // Script for visitor banning by IP address. 
    // 
     
    // May be placed in the head or in the body segment of an html page.
    // Always use Notepad or another plain text editor, not a WYSIWYG editor unless you work in code view mode.
     
    // Since this script uses SSI, the web page may have to be named with the extension shtml instead of html or it will not work,
    // unless the server allows SSI to be used in ordinary html pages.
    // Please not that the nature of SSI makes it impossible to turn this into a javascipt source, you must include everything.
     
    // Put in the address to which you want to redirect if the user is banned
    // it may be a page on your site or the url of another web site that exists
    // the url given below is just an example, as good as any
     
    var banned_ip_page = "http://www.google.com"; // This is the page to direct to if the ip is banned
     
     
    // get the visitor's IP address 
     
    var visitor_ip = ''; // This is the visitor's IP address as returned by the server
     
     
    // User defined test - add as many groups as you need for all the banned ips;
    // Make sure you modify these example ip addresses and do not lock yourself out.
    // The || (vertical bars or pipe lines) mean "or" and the == is used to test equality
    // Each individual test is enclosed in parentheses
    // The entire set of tests is enclosed in parentheses
     
    if ( // opening parenthesis for the entire test
     
    // You may change the tests from here
    (visitor_ip == "000.000.000.000" )
    || (visitor_ip == "111.111.111.111" )
    || (visitor_ip == "222.222.222.222" )
    // until here
     
    ) // closing parenthesis for the entire test
    { alert("Sorry, your IP has been banned from this site");
    document.location = banned_ip_page; }
     
    </script>
    OR PHP
    <SPAN style="COLOR: #000000">
    HTML Code:
    <?php 
    $banned[0]="ip address 1"; 
    $banned[1]="ip address 2"; 
    $banned[2]="ip address 3"; 
    
    if (in_array($_SERVER['REMOTE_ADDR'],$banned)) 
    { 
    echo "You have been banned from this site!!!"; 
    } else { 
    // Stuff to display if user is accepted 
    } 
    ?>
    Last edited by phpme; 19-04-2007 at 10:35 PM.

    Soon To Be Released....

  8. #8
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    NEVER use javascript for something like an IP Blocker

    PHP ftw.

  9. #9
    Join Date
    Dec 2006
    Posts
    3,467
    Tokens
    0

    Latest Awards:

    Default

    This one is quite good (PHP):

    Code:
    <?
    $ip = $_SERVER['REMOTE_ADDR'];
    if($ip == "IPHERE")
    {
    echo "<h1>Forbidden Access</h1>";
    }
    ?>

  10. #10
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    3,285
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by MrLore View Post
    This one is quite good (PHP):

    Code:
    <?
    $ip = $_SERVER['REMOTE_ADDR'];
    if($ip == "IPHERE")
    {
    echo "<h1>Forbidden Access</h1>";
    }
    ?>
    You need to use die, because with that the page will keep displaying itself So you won't be banned



    i used to be NintendoNews. visit my blog or add me on twitter.
    need help with vista? i am a microsoft certified technology specialist in configuring windows vista and connected home integrator.. pm me for help!


    "I am the way, the truth, and the life. No one comes to the Father except through me"
    John 14:6 (NIV)


Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •