Search
Left Quote    A clever person solves a problem. A wise person avoids it.
- Einstein    
Right Quote
 
[login] | [Register]
Forum Index » PHP and mySQL » Viewing Topic and Replies
Post Reply


        Viewing Topic: sessions
  This user is offline  badgett
  Subject: "sessions" Posted: @ 7:33 am on May 23 2007   
Member #: 330
Rank: User - (7)
Since: 05/23/07
Posts: 7

when I login into my site and the url is with a "www" it logins and stays in but when I do it WITHOUT the "www" and doesn't stay logged in.
Problem with my code?

    Viewed: 13,412 Times | Reply to This | To top
  This user is offline  bs0d
  Subject: "re: sessions" Posted: @ 12:14 pm on May 23 2007    

Member #: 1
Rank: Admin. - (1,505)
Since: 02/06/05
Posts: 600
From: USA

Lets see what you got!




-bs0d | AllSyntax.com

    Viewed: 13,403 Times | Reply to This | To top
  This user is offline  misterhaan
  Subject: "re: sessions" Posted: @ 2:04 pm on May 23 2007    

Member #: 5
Rank: User - (213)
Since: 02/11/05
Posts: 148
From: chair

a cookie for the domain 'www.example.c om' can't be used by the domain 'example.com' -- i'm guessing that's your problem. sessions are tracked by a cookie (named PHPSESSID by default), and it looks like if you start a session on www.example.com then the cookie is for www.example.com , not .example.com. i'm not sure how to change that though.




please note that the above post is likely made up in its entirety.

    Viewed: 13,399 Times | Reply to This | To top
  This user is offline  badgett
  Subject: "re: sessions" Posted: @ 7:39 am on May 24 2007    
Member #: 330
Rank: User - (7)
Since: 05/23/07
Posts: 7

I'm pretty much using the same code as the tutorial you have. how do I fix it?



    Viewed: 13,383 Times | Reply to This | To top
  This user is offline  badgett
  Subject: "re: sessions" Posted: @ 8:20 am on May 24 2007    
Member #: 330
Rank: User - (7)
Since: 05/23/07
Posts: 7

I found out it only does it on firefox. works fine on IE...still loooking for the why though




    Viewed: 13,379 Times | Reply to This | To top
  This user is offline  badgett
  Subject: "re: sessions" Posted: @ 8:46 am on May 24 2007    
Member #: 330
Rank: User - (7)
Since: 05/23/07
Posts: 7

Well apparently I fixed it using


Code:

setcookie(&qu ot;PHPSESSID&q uot;, session_id(), 0, "/" , ".name.co m;name.com&quo t;);

< br /> in my header.php file.
wrong?
correct?




    Viewed: 13,374 Times | Reply to This | To top
  This user is offline  misterhaan
  Subject: "re: sessions" Posted: @ 5:57 pm on May 24 2007    

Member #: 5
Rank: User - (213)
Since: 02/11/05
Posts: 148
From: chair

i don't think you need the ;name.com part, but other than that it makes sense!




please note that the above post is likely made up in its entirety.

    Viewed: 13,360 Times | Reply to This | To top
  This user is offline  badgett
  Subject: "re: sessions" Posted: @ 1:47 am on May 27 2007    
Member #: 330
Rank: User - (7)
Since: 05/23/07
Posts: 7

if I take that out it doesn't work?
lol




    Viewed: 13,327 Times | Reply to This | To top
  This user is offline  gravy
  Subject: "re: sessions" Posted: @ 9:29 pm on Jun 09 2007    

Member #: 294
Rank: User - (63)
Since: 03/07/07
Posts: 66
From: MN

I had this problem too, and i took out the remember me feature all together, but then I thought couldn't you just make sure the URL stayed www.whatever.co m/ with htaccess?

So i tried it on a test site by adding this to my htaccess

Code:


RewriteEngine on
RewriteCond %{http_host} ^yoururl.com [nc]
RewriteRule (.*)$ http://www.your url.com/$1 [r=301,nc]


Worked for me.




Photo Hosting Scripts? It's what I do....

    Viewed: 13,180 Times | Reply to This | To top
Viewing Page: 1 of 1


1 |

You must be logged in to post on the forums. Login or Register








"AllSyntax.com" Copyright © 2002-2018; All rights lefted, all lefts righted.
Privacy Policy  |  Internet Rank