Jump to content


Photo

Sessions crossing between http and https


  • Please log in to reply
2 replies to this topic

#1 fedematarrita

fedematarrita
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 01 August 2006 - 06:19 PM

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

#2 nogray

nogray
  • Members
  • PipPipPip
  • Advanced Member
  • 930 posts
  • LocationSan Francisco CA

Posted 01 August 2006 - 06:40 PM

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.

NoGray.com


#3 fedematarrita

fedematarrita
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 01 August 2006 - 10:16 PM

Thanx, in the end I put as you told me a session var on the http and on the https and its working fine.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users