0

i have installed ssl on my server. i m just running payment part in https and rest of the website in http. when i try to use session variable from http to https. i got blank result, i think https destroy my session variables. i want to use session variable from http to https.
how can i do that.

Kindly help please..

thanks in advance..

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by Echo89
0

You could use something like this:

On http:

    setcookie($prefix.'session_variable1', $_SESSION['session_variable1']);

On https:

    $_SESSION['session_variable1'] = $_COOKIE[$prefix.'session_variable1'];

Or you could use the database (more secure):

On http:

    mysql_query("INSERT INTO temp(
        session_variable1
    )
    VALUES (
    '".$_SESSION['session_variable1']."'
    )");

    $query = mysql_query("SELECT * FROM temp WHERE session_variable1 = '".$_SESSION['session_Variable1']."'");

    $array = mysql_fetch_array($query);

    setcookie($prefix.'id', $array['id']);

On https:

    $query = mysql_query("SELECT * FROM temp WHERE id = '".$_COOKIE[$prefix.'id']."'");
    $array = mysql_fetch_array($query);

    // Do something with $array['mysql_field']
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.