php - Check redirect from -


i have 2 files, checking.php contain code check redirect redirect.php, , print corresponding message, redirect.php contain code redirect file a.

checking.php

$referrer = $_server['http_referer']; if (!preg_match("/redirect.php/",$referrer)) {     echo 'not redirect redirect.php'; } else {     echo 'is redirect redirect.php'; } 

redirect.php

header("location: http://abcdomain.com/checking.php"); exit(); 

but not working, please advice.

using header("location: http://abcdomain.com/checking.php");wont set referrer, 1 possible solution shown below(tested , works 100% fine)
use in redirect.php

echo "<script>parent.self.location='http://abcdomain.com/checking.php';</script>"; exit(); 

this set $_server['http_referer'] in checking.php


possible reasons problem shown below

browsers limit access not allow http_referer passed
type address in address bar not pass http_referer
open new browser window not pass http_referer, because http_referer = null
has browser addon blocks privacy reasons.
some firewalls , avs to.


Comments

Popular posts from this blog

php - Admin SDK -- get information about the group -

ruby on rails - one-to-many through referance table -