Re: A SESSION Problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Dec 11, 2007 9:53 AM, tedd <tedd@xxxxxxxxxxxx> wrote:
> Hi gang:
>
> I just had this happen and wonder what the fix is for it.
>
> I am sending session data from a script in a http to another script
> in https. However, sometimes the data gets through and sometimes it
> don't.
>
> Any ideas or fixes?
>
> Both scripts are listed below
>
>
> [1]
>
> <?php session_start();
> $x = 'zzz';
> $_SESSION['x'] = $x;
> ?>
>
> <form action="https://example.com/a-session2.php"; method="post">
> <input type="submit" value="Proceed to Step 2">
> </form>
>
>
> [2]
>
> <?php session_start();
> print_r($_SESSION);
> ?>
>
> <form action="http://example.com/a-session1.php"; method="post">
> <input type="submit" value="Proceed back to Step 1">
> </form>

    Provided the real code isn't directing to a different
CNAME/subdomain (e.g. - [Script 1] http://domain.com redirects to
[Script 2] https://www.domain.com/) it shouldn't be a problem.  The
snippet of code you provided looks fine.

    The other problem could be, though, that - because a session uses
a cookie on the client side - the cookie can't be accessed reliably
across both SSL and normal (unsecured) HTTP connections.  Try
appending the SID to the end of the URL, or as a hidden form field.
You may also want to make sure that session.cookie_secure is to set to
'Off', since the SID will change with each page load otherwise.

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux