0

i want to know programmatically if the user had explicitly requested the running php page context or was it a redirect from another php page on my site, how is it done correctly, while keeping it secure as possible?

Ofek Ron
  • 8,354
  • 13
  • 55
  • 103
  • I think you need `http_referer` for that. [More info here on PHP.net](http://php.net/manual/en/reserved.variables.server.php) – Funk Forty Niner Jul 31 '13 at 00:49
  • 3
    the 'very' unreliable `$_SERVER['HTTP_REFERER']` or set a session as its your site –  Jul 31 '13 at 00:50
  • Redirects are accomplished with HTTP responses containing a status code like 302, which tells a conforming browser to make a request at the new location. Redirects and direct accesses look the same, in general. – Platinum Azure Jul 31 '13 at 00:51
  • 1
    the important point here is to remember is that http is a stateless protocol. –  Jul 31 '13 at 00:52
  • Now that we've established what is **not** reliable, anyone here know what actually is, in order to help out the OP? – Funk Forty Niner Jul 31 '13 at 00:55
  • 1
    i mentioned sessions, as he was tracking on his own site. but not all questions have answers, not everything that a poster wants to do, can be done. –  Jul 31 '13 at 00:56
  • Obviously, this would require some form of tracking system with log files. – Funk Forty Niner Jul 31 '13 at 00:57
  • 1
    May not be exactly what you're looking for, but I like using [**PHP Junkyard's Click Counter**](http://www.phpjunkyard.com/php-click-counter.php). Although it doesn't keep track of who or where the link was clicked from, is intended on masking the URL it's to redirect to, that way you're sure that if a page was accessed, it would have originated from your Web site. I'm sure there are many other scripts out there that will give extra options, but this one is rather well done for a Freebie. – Funk Forty Niner Jul 31 '13 at 01:05
  • http://stackoverflow.com/a/5073204/1948627 – bitWorking Jul 31 '13 at 01:21

0 Answers0