refering page in pop-up window 
Author Message
 refering page in pop-up window

I have a link on one page that opens a new "child" window. I would like to
create a link in the new window back to the "parent" window.

The following bit of code works great, but I would like to remove the
specific refernce to the page "test.php" and put some kind of variable in
it's place.
<?php
$href="test.php?var=something";
echo"<a href=\"javascript:;\" onclick=\"opener.location='$href';
self.close()\">return</a>";
?>

I would like to see $href = the refering page, but haven't been able to find
out how. Any suggestions.

Irvin Amoraal



Mon, 27 Jun 2005 00:30:48 GMT  
 refering page in pop-up window

Quote:

> I would like to see $href = the refering page, but haven't been able to
> find out how. Any suggestions.

http://www.php.net/manual/en/reserved.variables.php#reserved.variable...

'HTTP_REFERER'
 The address of the page (if any) which referred the user agent to the
current page. This is set by the user agent. Not all user agents will set
this, and some provide the ability to modify HTTP_REFERER as a feature. In
short, it cannot really be trusted.

--
----- stephan beal
Registered Linux User #71917 http://counter.li.org
I speak for myself, not my employer. Contents may
be hot. Slippery when wet. Reading disclaimers makes
you go blind. Writing them is worse. You have been Warned.



Mon, 27 Jun 2005 00:38:24 GMT  
 refering page in pop-up window
stphan,
Thanks, I had tried http_referrer but I get to the root of the site, not the
actual page that opened it.
ie.
'http://web_address/root_folder/'
rather than
'http://web_address/root_folder/filename.php'

Irvin.



Mon, 27 Jun 2005 01:13:29 GMT  
 refering page in pop-up window

Quote:

> Thanks, I had tried http_referrer but I get to the root of the site, not
> the actual page that opened it.
> ie.
> 'http://web_address/root_folder/'
> rather than
> 'http://web_address/root_folder/filename.php'

As the docs say:
" In short, it cannot really be trusted."
:/

--
----- stephan beal
Registered Linux User #71917 http://counter.li.org
I speak for myself, not my employer. Contents may
be hot. Slippery when wet. Reading disclaimers makes
you go blind. Writing them is worse. You have been Warned.



Mon, 27 Jun 2005 01:19:33 GMT  
 refering page in pop-up window

Quote:

> I have a link on one page that opens a new "child" window. I would like to
> create a link in the new window back to the "parent" window.

> The following bit of code works great, but I would like to remove the
> specific refernce to the page "test.php" and put some kind of variable in
> it's place.
> <?php
> $href="test.php?var=something";

$href="test.php?var=something&referer=".$_SERVER['PHP_SELF'];
or
$href="test.php?var=something&referer=".$_SERVER['REQUEST_URI'];
or whichever variable you want to use

Quote:
> echo"<a href=\"javascript:;\" onclick=\"opener.location='$href';
> self.close()\">return</a>";
> ?>

> I would like to see $href = the refering page, but haven't been able to find
> out how. Any suggestions.

> Irvin Amoraal

--

PHP POSTERS: Please use comp.lang.php for PHP related questions,
              alt.php* groups are not recommended.


Mon, 27 Jun 2005 01:48:09 GMT  
 refering page in pop-up window
Like, I must be asleep at the wheel here...
I just included the name of the parent page in the url
(test2.php?href=test1.php), then used the value of $href to create the
returning href value (tes1.php?var=this).
Sooo Simple.
<grin>

Thanks for your help though!

Irvin.



Mon, 27 Jun 2005 02:48:44 GMT  
 refering page in pop-up window


Quote:

> > Thanks, I had tried http_referrer but I get to the root of the site, not
> > the actual page that opened it.
> > ie.
> > 'http://web_address/root_folder/'
> > rather than
> > 'http://web_address/root_folder/filename.php'

> As the docs say:
> " In short, it cannot really be trusted."
> :/

As I learnt the hard way yesterday, IE does not give a valid referer to a
pop-up window.

I ended up having to call a secure server page by opening a window on my own
site which had a form and a javascript submit.

LD

---

Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.435 / Virus Database: 244 - Release Date: 30/12/02



Wed, 29 Jun 2005 18:32:24 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Mouse over pop-ups with VisualWorks

2. Pop-ups in VW 2

3. Error or notification pop-ups in Tk

4. Pop-ups on Canvas items

5. Examples for Pop-Ups, Keyboard Accelerators?

6. annoying pop ups

7. backdoor.trojan - popups that aren't pop-ups

8. pop ups

9. Pop-Ups

10. pop ups sent via open port

11. no help on pop-ups yet

 

 
Powered by phpBB® Forum Software