Re: PHP Session in new window

From: Harrie Verveer (newsgroup{remove-this}_at_harrieverveer.com)
Date: 01/14/05


Date: Fri, 14 Jan 2005 10:47:23 +0100

Hi axrock,

I think you can't do things with the session because you are switching
between https and http... Do you really need the entire session from the
popup window or just succes or not? You could try some javascript like this:

<script language="JavaScript">
window.opener.location = "success.php";
</script>

when you really want the session vars you could do this by get-vars:

<?
$passGetVars = array();
foreach ($_SESSION as $key => $val)
   $passGetVars[] = $key . "=" . $val;

$passGetVarsStr = "?" . implode("&",$passGetVars);
?>

<script language="JavaScript">
window.opener.location = "success.php<?=passGetVarsStr?>";
</script>

something like that... untested but should work - however, I don't think
it's possible to just use the same session in the opener window and the
popup window (because of the cross-protocol). this sollution isn't the
most pretty solution in the world, but it should work...

Harrie

Axrock wrote:
> Hi,
>
> I really need some help here.
>
> I have a shopping cart where all cart contents are stored in a session
> array. At the checkout stage, a new window is opened on a secure URL for
> entering credit card details. This is a new window (JavaScript popup)
> because the payment section is actually part of the bank. They have a
> payment gateway. I am able to pass variables to this which will be returned.
>
> Problem is on return (successful transaction etc) I cannot access the
> session variables in the parent browser window.
>
> Can I some how force the popup window (with some PHP code in the return
> page) to pickup that session so I can access the session variables from the
> parent window and update them based on my transaction result?
>
> I can and have the ability to pass the session id into the popup which will
> be returned when the transaction is completed via the banks automated
> system.
>
> If somebody can help me out in this area, I would really appreciate it.
>
> C.
>
>



Relevant Pages

  • Re: restricting direct access to popup form--advice needed
    ... Because the new popup window is treated as a new session. ... >> hyperlink points to a JavaScript function which opens the popup. ...
    (comp.lang.php)
  • Re: detect exiting the website
    ... and set the session timeout to a few minutes. ... especially not a popup window. ... navigating away, or that the browser must navigate away first and then ...
    (comp.lang.javascript)
  • Re: Session not passed to AxWebBrowser popup
    ... It doesn't seem to be in Navigate events. ... >> some of these call window.open to display popup pages. ... >> the popup doesn't see the browser session from the parent in the ... it opens a new window within the same ...
    (microsoft.public.inetsdk.programming.webbrowser_ctl)
  • Re: Session not passed to AxWebBrowser popup
    ... Pooran Prasad ... some of these call window.open to display popup pages. ... the popup doesn't see the browser session from the parent in the ... it opens a new window within the same ...
    (microsoft.public.inetsdk.programming.webbrowser_ctl)
  • Re: session loss
    ... straight without the redirection, and the popup comes up, is your session ... Web Developer 0.9.3 "Adds a menu and a toolbar with various web ...
    (comp.lang.php)