Welcome Guest, Not a member yet? Register   Sign In
session from http to https
#1

[eluser]sampada[/eluser]
Hi,

I want to redirect the user to the previous page which he was referring before login. so I kept the link of previous page in a session variable and redirected to that session after login.
It worked fine in local server. But when I moved the same code to main site then it didn;t work.
I think the main cause is separate domains i.e www and after login they move to secure

I have also set $config['cookie_domain'].

Is there any way to accomplish this?

Thanks
#2

[eluser]johnwbaxter[/eluser]
Why is it a different domain? Why does the www change?
#3

[eluser]TheFuzzy0ne[/eluser]
Set your cookie domain to ".mysite.tld" (note the leading '.'). Then your cookie will be available to all subdomains.
#4

[eluser]sampada[/eluser]
Hi,

yeah I have already tried that. I set $_config['cookie_domain']='.xxx.ttt'
but it didn't work.

thanks
#5

[eluser]TheFuzzy0ne[/eluser]
I don't understand the problem. A cookie is a cookie regardless of whether or not it's a secure request.
#6

[eluser]srisa[/eluser]
As far as I know there is no easy way to maintain session across http and https. You can pass the cookie for the first time through the url, store it in the https side and then you can use the cookie normally.
#7

[eluser]sampada[/eluser]
Hi,
thanks, i'll try that and get back to u if I could not make it work
#8

[eluser]sampada[/eluser]
Hi,

I am just wondering where I did wrong:

Let's say a users is viewing a sponsorship page and to sponsor a particular child he has to be logged in. So in view page of sponsorship controller I set
$_SESSION['redirect']="rapyd/sponsor".

In auth controller:
Login takes the user to secure domain

function login()
{
....
if (isset($_SESSION['redirect'])){
$redirect = $_SESSION['redirect'];
unset($_SESSION['redirect']);
redirect(keep_lang("$redirect"));
}
else
{
redirect(keep_lang("homepage/index"));
}

}


In config.php

$config['cookie_domain']=".xxx.xxx";



But here the redirect session variable is blank.

Any ideas where I did wrong??
#9

[eluser]bretticus[/eluser]
What you haven't made absolutely clear in your posts is whether the ssl and the non-ssl websites are the same domain. ex. http://samedomain.tld and https://samedomain.tld.
#10

[eluser]sampada[/eluser]
yeah it's different,
http://www.samedomain.tld and https://secure.samedomain.tld.




Theme © iAndrew 2016 - Forum software by © MyBB