Re: [PHP] Looking for complete entered URL

[email protected] (Andrew Ballard)
Newsgroups php.general
Message-ID <CAC1b6Ru+siK2D62G04CWuMaT=YdxG9bcuEOJZH3ymhN2UVBZcQ@mail.gmail.com>
Correct. Just to expand on that, a browser will not send the hash fragment
part of a URL with the request. If you ever receive that part at the web
server, that's a pretty good sign the request came from a robot.

Andrew
On Apr 21, 2013 3:29 AM, "Ashley Sheridan" <[email protected]> wrote:

>
>
> tamouse mailing lists <[email protected]> wrote:
>
> >On Sat, Apr 20, 2013 at 1:51 PM, Angela Barone
> ><[email protected]> wrote:
> >>         I've written a script that logs all visits to a web site,
> >complete with referrer and IP address.  It also logs all 4xx errors.
> >What I'd like to add to this is, if someone adds extra code after the
> >page_name.php, to be able to capture any extra code and log that.
> >>
> >>         I've tried:
> >>
> >> $_SERVER['QUERY_STRING']
> >> $_SERVER['REDIRECT_QUERY_STRING']
> >> $_SERVER['REDIRECT_URL']
> >
> >So, since I wasn't exactly sure what got put into $_SERVER, and since
> >I'm lazy, I tapped out the following script:
> >
> ><?php
> >header("Content-type: text/plain");
> >echo '$_SERVER:'.PHP_EOL;
> >var_dump($_SERVER);
> >?>
> >
> >When I called it with the following URL:
> >
> >http://localhost/~tamara/teststuffout/logger.php/one/two?a=true#fragment
> >
> >It showed all the stuff in $_SERVER as a result of that, including:
> >
> > ["REQUEST_URI"]=>
> >  string(47) "/~tamara/teststuffout/logger.php/one/two?a=true"
> >
> >  ["PATH_INFO"]=>
> >  string(8) "/one/two"
> >
> >  ["QUERY_STRING"]=>
> >  string(6) "a=true"
> >
> >Interestingly, it appears nothing reports #fragment...
> >
> >--
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
>
> It wont, the fragment is always local. You'd need javascript to handle that
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.