Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Mar 2005
    Location
    Spokane, WA
    Posts
    148
    Thanks
    4
    Thanked 4 Times in 4 Posts

    IE Won't display default error page

    I have a php script I wrote using IP based authentication. I have code that looks like this:

    PHP Code:
    if ($_SERVER['REMOTE_ADDR'] != '127.0.0.1') {
        
    header("HTTP/1.0 403 Forbidden");
        die();

    The problem is all I get is a blank page if i access it on a remote machine, well on IE atleast. I haven't tried from another browser.

    What does it take to get IE to show its default 403 error page? I do not want to create a custom error page, the default browser one will work just fine....if i get get it to show.

    On second thought I think I identified the problem, a look at the page source reveals there is output

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML><HEAD>
    <META content="text/html; charset=windows-1252" http-equiv=Content-Type></HEAD>
    <BODY></BODY></HTML>
    So I think the browser is considering that a custom error page and thus not thowing its own. How can I prevent the boilerplate html from being sent?
    Last edited by RyanB88; 07-14-2012 at 04:43 AM.

  • #2
    Regular Coder jdswebservice's Avatar
    Join Date
    Aug 2010
    Location
    Moon Township, PA
    Posts
    107
    Thanks
    0
    Thanked 5 Times in 5 Posts
    use this instead

    PHP Code:
    header("HTTP/1.0 403 Forbidden"); 
    refer to

    http://www.codingforums.com/showthread.php?t=61558
    Jonathan R.
    Email: jonathan@logicaldevelopment.net
    Skype, Aim, & Jabber: logicaldevelopment
    Website: http://logicaldevelopment.net/

    NOTE: When contacting me please have the following things ready:

    Thread ID (This can be found in the URL of your thread)
    Budget of Project
    Methods of contacting you/your organization
    Preferred method if many methods are provided

    Any website information that you PM, Email, IM, or otherwise is strictly confidential and will not be disseminated, distributed, or copied in any way, shape or form.


  •  

    Posting Permissions

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