CodeIgniter Forums
Session Problem - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Session Problem (/showthread.php?tid=12913)

Pages: 1 2


Session Problem - El Forum - 11-04-2008

[eluser]alejandra[/eluser]
Hi Everybody,

I'm new in codeigniter framework and I'm developing a website using the framework, the website has a shopping cart that takes donations, magazine subscriptions and products. Everything works fine until I try to checkout, when I change to https section which uses a different domain name I can't see the session. If go back to cart using the other domain everything is in the session.

I have developed using php with the same scenario and did not have this problem. Is there something that I can do so tha my session can be view in my https site?


Session Problem - El Forum - 11-06-2008

[eluser]alejandra[/eluser]
It's me...again, I really need help. I try creating a php session to transfer the information of http site to the https site and when I try to generate duplicate the information in the https site it adds the session information to the http site. If some one cal help me please...I have try so many things.


Session Problem - El Forum - 11-07-2008

[eluser]diego.greyrobot[/eluser]
You said you handled this scenario before with regular php?
Are you using CI sessions this time or still the regular php sessions?


Session Problem - El Forum - 11-09-2008

[eluser]alejandra[/eluser]
Sorry I have not reply sooner, yes I'm using CI session. I have a time frame on this project If I try to use regular PHP session that could be a great problem for me. Thanks for replying.


Session Problem - El Forum - 11-11-2008

[eluser]diego.greyrobot[/eluser]
CI sessions are all stored in cookies. You should check out the section on CI sessions AND cookies in the CI user guide.

What i think your problem might be is that when you start and use the sessions on your site, the cookie's that CI sessions generate have a value for 'domain' which by default is set to your current http domain: 'http://current.domain.com' ...

and when you try to checkout and switch over to your https domain, the CI sessions can no longer find a session because it's checking for cookies written for its https domain.

hopefully this will give you a better clue as to how to solve your problem, but without looking at your code i cant give you a straight answer, all i can say is that PHP sessions may be your way out.


Session Problem - El Forum - 11-12-2008

[eluser]narkaT[/eluser]
[quote author="alejandra" date="1225855229"]when I change to https section which uses a different domain name[/quote]

cookies are only sent to the domain which set them.
is it possible to use a subdomain for the https url?
you could then declare that cookies should be send to all subdomains.


Session Problem - El Forum - 11-12-2008

[eluser]alejandra[/eluser]
Yes, I understand that my cookie is set in the http domain and that is the reason why I cant see it in the https domain allthought is in the same server, but the interesting thing is that if I add something (I try to copy the content of the http CI seesion to regular php session and when I go to the https I try to recreate the same cookie in the https site) to the cart in the https site i don't see it in the https site but if hit the back button in the in the browser I see what I added in the hppts site is in the http site.

I have explore the subdomain solution, but right know that is not an option. The hosting company that I'm using is not very flexible.

I need to find a way to connect the dot from place to another.

If there is a way that I can read the cookie on the https site it will be great, plan B will be to use the Native Session class because it has the same interface (function name and parameter) that the CI session class has.

I have few reasons for not adopting plan B right awyay and one of them is the Native Session does not keep the state of the session in the database like the CI session class, and that is a good security mesure.

I will keep on trying to find a solution to this problem and if anybody can help me I will be very greatfull if I find the solution I will posted here Smile .


Session Problem - El Forum - 11-12-2008

[eluser]dexcell[/eluser]
[quote author="alejandra" date="1226520808"]Yes, I understand that my cookie is set in the http domain and that is the reason why I cant see it in the https domain allthought is in the same server, but the interesting thing is that if I add something (I try to copy the content of the http CI seesion to regular php session and when I go to the https I try to recreate the same cookie in the https site) to the cart in the https site i don't see it in the https site but if hit the back button in the in the browser I see what I added in the hppts site is in the http site.

I have explore the subdomain solution, but right know that is not an option. The hosting company that I'm using is not very flexible.

I need to find a way to connect the dot from place to another.

If there is a way that I can read the cookie on the https site it will be great, plan B will be to use the Native Session class because it has the same interface (function name and parameter) that the CI session class has.

I have few reasons for not adopting plan B right awyay and one of them is the Native Session does not keep the state of the session in the database like the CI session class, and that is a good security mesure.

I will keep on trying to find a solution to this problem and if anybody can help me I will be very greatfull if I find the solution I will posted here Smile .[/quote]

you might wanna read post from barbazul here
http://ellislab.com/forums/viewthread/96652/#488717


Session Problem - El Forum - 11-12-2008

[eluser]alejandra[/eluser]
Here I'm posting the CI Session class which it was modify by an intern doring the summer to be able to hold the cart also the class that I created to backup the cookie in a regular php class and duplicate the cookie in the https site.

I call the backup_CIsession() function right before going to the https site and call the
get_backup_CIsession() function on the https site.

Thanks!


Session Problem - El Forum - 11-12-2008

[eluser]alejandra[/eluser]
[quote author="dexcell" date="1226521753"][quote author="dexcell" date="1226520808"]
you might wanna read post from barbazul here
http://ellislab.com/forums/viewthread/96652/#488717[/quote]

I have try barbazul suggest but using session and when I replicate the session on the https site it adds it to the http site , maybe there is something wrong with the way I am doing it 8-/ .

Thanks to all that have reply is nice to part of this community.