Jump to content

Sessions crossing between http and https


fedematarrita

Recommended Posts

Hi everyone, I this small section of my site where you have to be logged to be able to see it, the login and the section is over http, when the person logs in, I set a session var to tell me that the guy has log in, if the some one clicks on a link to a page that is on the http(not logged part) and on that page, they click back to the page that needs to be logged to be viewed, aperently the session var is not alive on the http side because I get the login page and not the other one.

what I'm doing is, after a succesfull login I set session_register("loginid"); and on the header of all the pages I do something like 
session_start();
if (session_is_registered('loginid))
{
$logged=1;
}

.....

and on the menu links:
if(isset($logged) && $logged==1)
echo "link to https page";
else
echo"link to http page";


it works correctly on the pages that are on the https side, but not on the http pages, what I'm doing wrong? or is it that sessions vars cant be set on https and used on http ? ??? ???

I will apreciate and will be thankful to any one that helps

Peace!!
Link to comment
Share on other sites

It's mainly firefox that doesn't cross session info between https and http, what you can do is set two sessions, one in the http side and one in the https side (two files with 2 redirection), maybe that'll work.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.