Languages :: PHP :: script called by IMG src="..." - need find calling page |
|||
| By: michi001 |
Date: 26/05/2003 00:00:00 |
Points: 75 | Status: Answered Quality : Excellent |
|
my script hit.php is called from any html page by <IMG src="hit.php"> tag in this hit.php script I do saving statistics about caller (ip, browser), but I also need find what page is this script called from (to adjudge this hit to right page) how??? thank you very much :) Michal |
|||
| By: VGR | Date: 26/05/2003 06:36:00 | Type : Answer |
|
| $_SERVER['HTTP_REFERER'] ? |
|||
| By: VGR | Date: 26/05/2003 06:37:00 | Type : Comment |
|
| or modify your calls this way : (with $PHP_SELF = $_SERVER['PHP_SELF'] or with register_globals=On ) <IMG src="hit.php?calledfrom=$PHP_SELF"> and of course in hit.php you now have the calling page (in fact, the full URI) in $_GET['calledfrom'] |
|||
| By: michi001 | Date: 26/05/2003 07:12:00 | Type : Comment |
|
| Well done :) and do you know, how to use this on the page, where are FRAMES? - how to put it on the main page (in framed page is REF set to the page where are frames set - not to the page where user came from) ? |
|||
| By: VGR | Date: 26/05/2003 07:42:00 | Type : Comment |
|
| not understood 8-))) do you mean "how to detect the frame it came from" ? |
|||
| By: michi001 | Date: 26/05/2003 07:47:00 | Type : Comment |
|
| no, my page main.htm is frameset and I want to make statistics for it, not for frames that it defines but I can't put <img src.. into <FRAMESET.. page.. or I can? how? |
|||
| By: VGR | Date: 26/05/2003 08:02:00 | Type : Comment |
|
| yes you can : create a hidden FRAME (height=0) and put a small HTML/PHP page with the <IMG SRC in it ;-)) |
|||
| By: michi001 | Date: 26/05/2003 08:14:00 | Type : Comment |
|
| yes, I was worry about referrer, but escape(top.document.referrer) will probably works :) thanks :) |
|||
|
Do register to be able to answer |
|||
©2010 These pages are served without commercial sponsorship. (No popup ads, etc...). Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE.
Please DO link to this page!








