|
Posted by pek on June 24, 2008, 12:25 pm
Please log in for more thread options On Jun 24, 6:42=A0pm, "=C1lvaro G. Vicario"
> pek escribi=F3:
>
>
>
> > OK, I've been having this problem for quite some time but never until
> > now I really needed a solution. I have never thought of a work around,
> > so I really need your help. Sorry if this has been mentioned already.
> > You can point me to the post and I'll gladly read. I googled this a
> > lot but, first, most people have tutorials for sharing sessions in
> > subdomains, and, second, I have no clue what keywords to use.
>
> > I am currently developing two web sites in my localhost. The first one
> > ishttp://localhost/pageoneand the otherhttp://localhost/pagetwo. I
> > have a login script for each. The login script can either be session
> > based (for temporary logins) or cookie based (for long term logins).
>
> > When I login in one site, I create two session variables named user
> > and key which store a user name and a random 128 characters string.
> > The key is stored in the database and changes upon each login (a
> > little security). After successfully logging in in pageone using
> > sessions, I noticed that in pagetwo I am also logged in. So I added a
> > session variable "domain" which I check on both pages to see if the
> > session information is for the right page. Although this works, I
> > found that now I can only be logged in in one page at a time. I am
> > assuming that sessions are shared.
>
> Sessions are shared between all hosted sites unless you change it but it
> shouldn't be an issue. Your problem is with cookies. It's pointless to
> specify a *domain* in setcookie() because both sites are in the same
> domain (localhost). What you need to specify is a *path*.
>
> Same applies to session_set_cookie_params().
>
> --
> --http://alvaro.es- =C1lvaro G. Vicario - Burgos, Spain
> -- Mi sitio sobre programaci=F3n web:http://bits.demogracia.com
> -- Mi web de humor al ba=F1o Mar=EDa:http://www.demogracia.com
> --
Uhm, sorry, indeed, I was already using path in setting the cookie, so
logging in with cookie works correctly. My problem is with sessions.
Because I want a user to be able to login for the current browsing
session. I now have a session_name before session_start with different
name and looks like it's working. I haven't really tested it a lot.
|