Results 1 to 6 of 6

Thread: [RESOLVED] ipban

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Resolved [RESOLVED] ipban

    i need a code to ipban people from my site, does anyone know how?

  2. #2
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    Re: ipban

    $ip = $_SERVER['REMOTE_ADDR'];

    And then depending on how you render your page, if the IP matches an IP in your banlist, deny them access.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Re: ipban

    look, can you explain the code, how do i use it and...?

  4. #4
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    Re: ipban

    I coulda swore this was in the PHP section..

    The function I gave you is PHP. Google "PHP Tutorials" if you want an into into it.

    You can do it with other server-side scripting language as well. If you plan to use HTML or JavaScript to stop someone from a certain IP from visiting your site -- you cannot.

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Re: ipban

    oh, thank you.
    found a code...
    Code:
    <?php
    $ban_ip = 'iphere'; 
    
    $visitor_ip = $_SERVER['REMOTE_ADDR']; 
    if($visitor_ip == $ban_ip)
    {
    die("You are banned from this site!");
    }
    
    $visitor_ip = $_SERVER['REMOTE_ADDR'];
    $ip_list = explode(",", $ban_ip);
    foreach($ip_list as $ip)
    {
    if($visitor_ip == $ip)
    {
    die("You are banned from this site!");
    }
    }
    
    ?>
    Last edited by Justa Lol; Dec 5th, 2008 at 04:37 PM.

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Re: [RESOLVED] ipban

    sorry for double post...

Posting Permissions

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



Click Here to Expand Forum to Full Width