Page 2 of 2 FirstFirst 12
Results 11 to 19 of 19
  1. #11
    Join Date
    Aug 2004
    Location
    UK
    Posts
    11,283
    Tokens
    2,031

    Latest Awards:

    Default

    humm the in array is probably a better way of doing it, although i think your syntax has problems

    PHP Code:
    <?php

      $b
    [] = '0.0.0.1';
      
    $b[] = '0.0.0.2';
      
    $b[] = '0.0.0.3';

    if(
    in_array($_SERVER['REMOTE_ADDR'], $b)){
    die(
    "You're banned.");
    }
    ?>

  2. #12
    Join Date
    Aug 2004
    Location
    bristol
    Posts
    3,799
    Tokens
    0

    Latest Awards:

    Default

    I think my syntax is fine.

    Edit: http://joshjh.pwp.blueyonder.co.uk/testing.gif (PHP/5.1.2)
    Last edited by nets; 31-08-2006 at 08:07 PM.
    kinda quit.

  3. #13
    Join Date
    Apr 2006
    Location
    Leamington Spa
    Posts
    1,375
    Tokens
    72

    Latest Awards:

    Default

    This is how I'd do it.

    Save this as Ban.php if you want.
    PHP Code:
    <?php
    //Ban.php
    $ip1 'xxx.xxx.xxx.xxx';

    $ip2 'xxx.xxx.xxx.xxx';

    $ip3 'xxx.xxx.xxx.xxx';


    if(
    $_SERVER['HTTP_X_FORWARDED_FOR'] == $ip1||$_SERVER['HTTP_X_FORWARDED_FOR'] == $ip2||$_SERVER['HTTP_X_FORWARDED_FOR'] == $ip3) {
    echo(
    "Sorry your banned.");
    }
    ?>
    Then on your index page, to check if the IP is banned... Add this code anywhere, preferably at the top.

    PHP Code:
    <?php
    include("ban.php");
    ?>
    Last edited by lolwut; 02-09-2006 at 07:26 PM.
    i've been here for over 8 years and i don't know why

  4. #14
    Join Date
    Aug 2004
    Location
    UK
    Posts
    11,283
    Tokens
    2,031

    Latest Awards:

    Default

    Thats actualy quite a good idea? Since you dont need to worry about whether the public or proxie Ips are not the one you banned since it checks all "/
    Bravo

  5. #15
    Join Date
    Feb 2005
    Location
    Leicestershire / Sheffield
    Posts
    685
    Tokens
    0

    Default

    Nice tut there
    Last edited by Eric30; 06-09-2006 at 10:13 PM.

  6. #16
    Join Date
    Oct 2006
    Location
    Peterborough, UK
    Posts
    3,855
    Tokens
    216

    Latest Awards:

    Default

    Meh, you could use another way of doing it If you have a MySQL database and not alot of tables you can make)

    PHP Code:
    <?php
    include("configurationofmysqldatabasewithareallylongunneededname.php");
    $dynamite mysql_fetch_array(mysql_query("SELECT `ip` FROM `bannageness` ORDER BY `ip` DESC"));
    $explosion explode(";"$dynamite["ip"]);
    for(
    $num 0$num count($explosion); $num++)
    {
        if(
    $_SERVER["REMOTE_ADDR"] == "$explosion[$num]")
            {
                die(
    "lol banned");
            }
    }
    ?>
    Last edited by Jewish Bear; 22-01-2007 at 11:21 AM.


    visit my internet web site on the internet
    http://dong.engineer/
    it is just videos by bill wurtz videos you have been warned

  7. #17
    Join Date
    Nov 2006
    Location
    Boro
    Posts
    841
    Tokens
    1,650

    Latest Awards:

    Default

    right, i have this problem

    my ban.php is in a directory such as

    1/2/3/4/5/6/7/8/9/ban.php


    and if i put this incluede on my homepage

    <?php
    include("ban.php");
    ?>

    it only reads the same directory as the files in. and when i try to put in the full url such as

    http://www.bonxy.co.uk/1/2/3/4/5/6/7/8/9/ban.php it comes up with loads of error lines. anyone know how i can get around this problem ????


    +REP TO HELPERS!!!!!!


    xxxxxx
    *hi*


    Edited by Bonxy



  8. #18
    Join Date
    Oct 2007
    Location
    Luton, England
    Posts
    1,548
    Tokens
    388
    Habbo
    DeejayMachoo

    Latest Awards:

    Default

    Why not also set a banned cookie and a session and make it check for that so if it has either of the 3 then your banned...?


  9. #19
    Join Date
    Aug 2006
    Location
    Manchester, UK
    Posts
    2,016
    Tokens
    141
    Habbo
    florx

    Latest Awards:

    Default

    Can clear cookies, sessions, and change my IP very easily.

    I don't really think there is a decent way of banning someone!

Page 2 of 2 FirstFirst 12

Posting Permissions

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