Is it possible to make the script pretend the user did not receive connection?

Discussion in 'PHP' started by x0x, Mar 19, 2008.

  1. #1
    I have coded a php based ip ban system and right now when someone tries to access my site from a banned ip or range they would see my html error page. Would it be possible to give them the "Cannot find server" error? I don't mean html, they vary in every browser. So that the user would think the site is down..

    Thanks in advance!
     
    x0x, Mar 19, 2008 IP
  2. GreatMetro

    GreatMetro Peon

    Messages:
    117
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    One quick way to do it would be to do a header redirect to a non-live server:

    if ($ip == $banned_ip) {
    header("location: http://wwww.your-server.com");
    }


    That would force a server not found error. Not perfect, but it would definitely piss off a banned user.
     
    GreatMetro, Mar 19, 2008 IP
  3. GreatMetro

    GreatMetro Peon

    Messages:
    117
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    (Note the 4 www's in the redirect)
     
    GreatMetro, Mar 19, 2008 IP
  4. johndoes

    johndoes Peon

    Messages:
    738
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I agree with greatmetro. The only way is to redirect the page to a dead end.
    However the redirect may change the url in the address bar (I'm not a php expert not sure about it) so you may have to use a 100% width/height iframe inside the page and load the fake url into the iframe. It shouldn't be so hard.

    just pm me if you need help.
    regards,
     
    johndoes, Mar 19, 2008 IP
  5. 00johnny

    00johnny Peon

    Messages:
    149
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    ooo, i like:
    
    while(1);
    // or
    sleep(999999999);
    
    PHP:
    Just make them wait for like a minute or so till php times out then they get a server error and wonder what the heck went wrong...
     
    00johnny, Mar 19, 2008 IP
  6. ezprint2008

    ezprint2008 Well-Known Member

    Messages:
    611
    Likes Received:
    15
    Best Answers:
    2
    Trophy Points:
    140
    Digital Goods:
    1
    #6
    lol thats funny 00johnny

    Or just make a banned page. Where it shows big font = "BANNED" with a brief explanation why.
    "Your IP has been banned for malicious activity etc ... blahblah.

    "Please download this 'Help Guide' to find out how you can reset your IP to a non-banned status"
    help_guide.exe

    :)
     
    ezprint2008, Mar 20, 2008 IP