Script to allow only 3 log in and then block IP

Discussion in 'PHP' started by TheSyndicate, Feb 19, 2009.

  1. #1
    Does anybody know a secure and free log in script that will block the IP after 3 times or block log in for 10 min or something. If it also sends an email to me with the IP would be even better.
     
    TheSyndicate, Feb 19, 2009 IP
  2. Gonzo4u

    Gonzo4u Well-Known Member

    Messages:
    410
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    110
    #2
    Just google php anti flood script and you will get your script.

    Gonzo
     
    Gonzo4u, Feb 19, 2009 IP
  3. TheSyndicate

    TheSyndicate Prominent Member

    Messages:
    5,410
    Likes Received:
    289
    Best Answers:
    0
    Trophy Points:
    365
    #3
    anti flood ? Ok i just wanted some rec from other DP users since there is so many half good scripts
     
    TheSyndicate, Feb 19, 2009 IP
  4. ActiveFrost

    ActiveFrost Notable Member

    Messages:
    2,072
    Likes Received:
    63
    Best Answers:
    3
    Trophy Points:
    245
    #4
    You can simply add incorrect login counter ! If login successful - clear this field .. if not - increase it by 1. When you see that there are already 3 warnings - disable login for 15 minutes ! Easy .. :rolleyes:
     
    ActiveFrost, Feb 19, 2009 IP
  5. TheSyndicate

    TheSyndicate Prominent Member

    Messages:
    5,410
    Likes Received:
    289
    Best Answers:
    0
    Trophy Points:
    365
    #5
    Active Forest do you have sample code of this. I am looking for something to Ban IP or country and also send me an email as well.
     
    TheSyndicate, Feb 19, 2009 IP
  6. imchandan

    imchandan Guest

    Messages:
    50
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #6
    <?
    session_start();
    $uid = $_POST['username'];
    $pwd = $_POST['password'];
    $incorrect_login = $_SESSION['incorrect'];
    if($incorrect_login==3)
    {
    //user has exceeded max allowed logins. redirect him to index page or wherever
    header("Location : index.php?you+have+exceeded+max+allowed+logins");
    }
    if($uid=='chandan'&&$pwd=='chandan')//here you can add your database verification or whatever
    {
    header("Location : welcome_user.php");
    }else
    {
    //that means it is an incorrect login attempt
    $_SESSION['incorrect']=$_SESSION['incorrect']+1;
    mail("admin@Yellowberry.org","Incorrect Login Attempt","Incorrect Login","From : ");
    }


    ?>
     
    imchandan, Feb 20, 2009 IP
  7. Singhals

    Singhals Banned

    Messages:
    81
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    use whm firewalls..
     
    Singhals, Feb 20, 2009 IP
  8. wacamoi

    wacamoi Peon

    Messages:
    810
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #8
    now the day blocking IPs become less useful
    that is one reason why DP uses "enter random code" to verify each new thread post
    or you can only make 5 mistakes every hour
     
    wacamoi, Feb 20, 2009 IP
  9. TheSyndicate

    TheSyndicate Prominent Member

    Messages:
    5,410
    Likes Received:
    289
    Best Answers:
    0
    Trophy Points:
    365
    #9
    thanks IM i take a look at that code
     
    TheSyndicate, Feb 20, 2009 IP
  10. alphamonk

    alphamonk Peon

    Messages:
    116
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #10


    This piece of code is going in my tool bag. Thanks for sharing
     
    alphamonk, Feb 20, 2009 IP
  11. TheSyndicate

    TheSyndicate Prominent Member

    Messages:
    5,410
    Likes Received:
    289
    Best Answers:
    0
    Trophy Points:
    365
    #11
    Can this code redirect to diffrent URL i heard that it is not good to just redirect to one?
     
    TheSyndicate, Feb 21, 2009 IP