Re: [PHP] Looking for complete entered URL

2013-04-21 Thread tamouse mailing lists
On Sat, Apr 20, 2013 at 1:51 PM, Angela Barone
ang...@italian-getaways.com 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



Re: [PHP] Looking for complete entered URL

2013-04-21 Thread Ashley Sheridan


tamouse mailing lists tamouse.li...@gmail.com wrote:

On Sat, Apr 20, 2013 at 1:51 PM, Angela Barone
ang...@italian-getaways.com 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



Re: [PHP] Looking for complete entered URL

2013-04-21 Thread Andrew Ballard
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 a...@ashleysheridan.co.uk wrote:



 tamouse mailing lists tamouse.li...@gmail.com wrote:

 On Sat, Apr 20, 2013 at 1:51 PM, Angela Barone
 ang...@italian-getaways.com 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




[PHP] Looking for complete entered URL

2013-04-20 Thread Angela Barone
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']

but nothing seems to get logged.

Is there a way, when either a false url is entered and a 404 is 
generated, or just when someone tacks on extra code to the URL, that I can grab 
that extra info?  I'm looking for the complete URL that was entered by the 
user, not anything returned by the server.

I've created my own 4xx_error.php files which calls my tracking script, 
along with creating the proper ErrorDocument lines in the main .htaccess file.

There are a lot of pages that have come up in my search, but nothing 
seems to pertain to what I'm trying to do.

Thank you,
Angela

BTW, I know about Piwik and I use that, as well.  This is something I'm doing 
on my own.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Looking for complete entered URL

2013-04-20 Thread Tom Rogers
Hello Angela,

Sunday, April 21, 2013, 4:51:37 AM, you 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']

 but nothing seems to get logged.

 Is there a way, when either a false url is entered and a
 404 is generated, or just when someone tacks on extra code to the
 URL, that I can grab that extra info?  I'm looking for the complete
 URL that was entered by the user, not anything returned by the server.

 I've created my own 4xx_error.php files which calls my
 tracking script, along with creating the proper ErrorDocument lines in the 
 main .htaccess file.

 There are a lot of pages that have come up in my search,
 but nothing seems to pertain to what I'm trying to do.

 Thank you,
 Angela

 BTW, I know about Piwik and I use that, as well.  This is something I'm doing 
 on my own.


You  can put this in the page and email your self the information that
is available:

?php
ob_start();
phpinfo(INFO_VARIABLES);
$s = ob_get_contents();
ob_end_clean();

email('y...@wherever.com', 'Error Listing, $s);

Then you can see all that's present and work out what to trap

-- 
Best regards,
 Tommailto:trog...@kwikin.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php