Jump to content


more session problems


5 replies to this topic

#1 pirateXcore

    Young Padawan

  • Members
  • Pip
  • 281 posts
  • Gender:Male

Posted 19 July 2007 - 03:17 AM

Okay, first off, I'd say I'm pretty lucky to have friends testing everything for me haha.
Anyway, I got my login page working w/ sessions, so I thought. It works just fine for me, I can go to other pages and they act how I want according to my login status. But my friend went on there, and is testing it, but his session doesn't seem to carry on throughout the site. :\
I don't understand why at all and would love any recommendations on what I should do here. :(
Thanks!!!!!!

#2 Braunson

    Young Padawan

  • Members
  • Pip
  • 237 posts
  • Gender:Male
  • Location:Ontario, Canada

Posted 19 July 2007 - 03:11 PM

Do you have session_start(); at the top of each page you want to use it on? :)

#3 Demonslay

    P2L Jedi

  • Members
  • PipPipPip
  • 970 posts
  • Gender:Male
  • Location:A strange world where water falls out of the sky... for no reason.
  • Interests:Graphic Design, Coding, Splinter Cell, Cats

Posted 19 July 2007 - 03:55 PM

Check your PHP build's .ini file settings (php_info()). If session.use_only_cookies is set to 'On', and your friend's browser doesn't accept cookies, that would be your problem.

More information here.

#4 pirateXcore

    Young Padawan

  • Members
  • Pip
  • 281 posts
  • Gender:Male

Posted 19 July 2007 - 11:50 PM

@ Braunson - session_start(); is at the very top of every page that I have.

@ Demonslay - It's off.


Edit: I got some one else to look at it today. They registered, logged in, went back to the register page and it acted how it should when some one is logged in, then they went to the profile page and it acted how it should when some one is not logged in. :\

Edited by tgs, 20 July 2007 - 12:47 AM.


#5 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 21 July 2007 - 02:25 AM

I'm not sure of the finer details of this theory, but it's at least worth a shot.

I am guessing that since it works fine on most pages and not on some (such as the profile page), it could be a coding error. For instance, if you have the user's name stored in the session ($_SESSION['username']), and at some point in the profile page you set a $username variable (where $username != $_SESSION['username']), you could be overwriting the $_SESSION value causing confusion in the login script and the eventual "logging out." No, this isn't merely by luck. I'm assuming register_globals would have to be on in order for a "bug" like this to happen.

But, as i/we have no code of yours to work with, that's the best i/we can do; guess.

#6 pirateXcore

    Young Padawan

  • Members
  • Pip
  • 281 posts
  • Gender:Male

Posted 21 July 2007 - 01:24 PM

I don't use that at any point.

I have another person who tried this, and it worked fine for them. 100%
Also, the original person who it did not work for, it now does.
All these people use FF 2.x and have cookies enabled.
So hopefully it was just something weird that happened, and has worked itself out somehow.

Thanks for the help attempts everyone, and if it happens in the future, then I will be back w/ code.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users