visitor (0 QPoints)
  • FR
  • EN
  • NL
  • DE
  • ES
315 experts, 1193 registered users, 1659 questions already answered
European Experts Exchange, the very best site for high-quality IT solutions

New Improved Search!

 


05/10/2011 1h30 : Steve Jobs is dead, the father of Apple ][ is gone, we are all orphaned.

Languages :: PHP :: script called by IMG src="..." - need find calling page


By: michi001 U.S.A.  Date: 26/05/2003 00:00:00  English  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 English  Type : Answer
$_SERVER['HTTP_REFERER'] ?
By: VGR Date: 26/05/2003 06:37:00 English  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 English  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 English  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 English  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 English  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 English  Type : Comment
yes, I was worry about referrer, but escape(top.document.referrer) will probably works :)
thanks :)


Do register to be able to answer

EContact
browser fav
page generated in 306.662800 milliseconds

Why Google AdSense ads ?

compteur
 Ranking-Hits PageRank for this page