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 6 of 6
  1. #1
    New Coder
    Join Date
    Jan 2012
    Posts
    32
    Thanks
    0
    Thanked 1 Time in 1 Post

    finding the GETS from previous error

    I have a custom erro404.php file that shows when someone vists an incorrect page or something goes wrong they get redirected to this page.

    I have the ErrorDocument 404 entery in htaccess

    What I am after is to know what the URL was when the error happened.

    If someone visits say http://www.site.com/thisPageDoesNotE...hp?a=1&b=2&c=3
    they would get taken to my error page.

    When the error404 page loads is there a way to grab the $_GETS that were in the URL before ?
    Last edited by FreelanceCoder; 04-23-2012 at 04:25 PM.

  • #2
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    try this;

    PHP Code:
    $_SERVER['PATH_INFO'

  • #3
    New Coder
    Join Date
    Jan 2012
    Posts
    32
    Thanks
    0
    Thanked 1 Time in 1 Post
    Quote Originally Posted by angst View Post
    try this;

    PHP Code:
    $_SERVER['PATH_INFO'
    I tried this and got..

    Notice: Undefined index: PATH_INFO

  • #4
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    looks like you have your error report set pretty high, try adding this to the top of your script or in your settings file.

    PHP Code:
    error_reporting(E_ALL & ~E_NOTICE); 

  • #5
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,091
    Thanks
    51
    Thanked 506 Times in 493 Posts
    I'd actually use:
    $_GET['REQUEST_URI']

    Alternatively you can just save the entire $_GET array instead (which can be far more useful) and then store it in the database.

    To do this, you turn it into a string by using serialize($_GET). Should you need to then use this data in another script you can unserialize($Data) to turn it back into it's original array.

    You can also do this with the $_POST array, $_REQUEST and with some work to save / move the files first and updating the values, $_FILES.
    My helpful sig is on vacation trying to loose some weight. It got a bit fat and caused a few problems but it will be back at some point!

  • #6
    New Coder
    Join Date
    Jan 2012
    Posts
    32
    Thanks
    0
    Thanked 1 Time in 1 Post
    strange i added the extra code to the error reporting as requested and the request_url is empty.


  •  

    Posting Permissions

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