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..

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']
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.