khaldoon82 Posted January 16, 2010 Share Posted January 16, 2010 Hello there .. im trying to get an urgent code for my graduation project which is as the following using an iframe in ex. test.php that contains the following code <i frame src="test1.php" ></iframe> test1.php contains <a href="test2.php">click here </a> now in test2.php ,there should be a function that catchs the url referer of test.php not test1.php i have been searching for so long and no clue .. tried $_SERVER['HTTP_REFERER'] and getenv(HTTP_REFERER) and all return blank value ! is there any idea ? or if i could use a javascript code like google adsense ! or anything !! thank you for helping ! Quote Link to comment Share on other sites More sharing options...
JAY6390 Posted January 16, 2010 Share Posted January 16, 2010 does your server run on apache or another web server such as IIS? Quote Link to comment Share on other sites More sharing options...
khaldoon82 Posted January 16, 2010 Author Share Posted January 16, 2010 Apachi server Quote Link to comment Share on other sites More sharing options...
JAY6390 Posted January 16, 2010 Share Posted January 16, 2010 put this in your script and see if you can find the referrer key echo '<pre>'.print_r($_SERVER, true).'</pre>'; Quote Link to comment Share on other sites More sharing options...
khaldoon82 Posted January 16, 2010 Author Share Posted January 16, 2010 it keeps giving me the url of tes1.php now if tes.php is located for example in www.domain1.com/tes.php and it contains <i frame src="www.domain2.com/test1.php" ></iframe> tes1.php which is from another domain name www.domain2.com/tes1.php contains <a href="www.domain3.com/test2.php">click here </a> when i click on that link in tes.php it should print welcome guest ,you were in "www.domain1.com/tes.php" not from www.domain2.com/tes1.php" in each time i try the known functions .. it shows me blank result in www.domain3.com/tes2.php !! any idea why ? Quote Link to comment Share on other sites More sharing options...
khaldoon82 Posted January 16, 2010 Author Share Posted January 16, 2010 hello any clue ? Quote Link to comment Share on other sites More sharing options...
khaldoon82 Posted January 16, 2010 Author Share Posted January 16, 2010 Hello anybody there ? Quote Link to comment Share on other sites More sharing options...
trq Posted January 16, 2010 Share Posted January 16, 2010 Calm down, remove the urgency from your post and actually describe what your expecting, what your getting and how your getting it. Quote Link to comment Share on other sites More sharing options...
ignace Posted January 16, 2010 Share Posted January 16, 2010 when i click on that link in tes.php it should print welcome guest ,you were in "www.domain1.com/tes.php" not from www.domain2.com/tes1.php" Yes it does if it wouldn't REFERER would be broken your iframe is the caller which is tes1 so last REFERER for tes2 is tes1 If you want tes the remove the iframe. Don't forget the iframe makes a different request (tes1) then your own (tes) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.