Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

PHP session problems

session

  • Please log in to reply
2 replies to this topic

#1 JakeWelton

JakeWelton

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 152 posts
  • Programming Language:Java, C++, C#, PHP, JavaScript, PL/SQL
  • Learning:Objective-C, Python, Perl, Ruby, Visual Basic .NET, Haskell

Posted 08 October 2010 - 11:29 AM

hi all,

ok i have created a site (Jake Welton) which uses PHP sessions to login and out. My problem is that everything works fine but when people try to connect to the site (and login) they seem to swap accounts (this is because the session contains a unique number which corresponds to the data which is returned to the user e.g. the user name next to he logout button), i am unsure how sessions can get mixed between browsers like this?????

Now heres the part which gets really strange, if two people both use explorer or Firefox then it messes up but if one person uses explorer and the other Firefox then it works fine. Is it possible that the browsers are getting their cookies (session cookies that is) from the server?????? if so how can i change this to make it work??

Basically i need a way of fixing this as it is a big problem at the moment.

Many Thanks,
J
  • 0

#2 Alexander

Alexander

    YOL9

  • Moderator
  • 3963 posts
  • Location:Vancouver, Eh! Cleverness: 200
  • Programming Language:C, C++, PHP, Assembly

Posted 08 October 2010 - 11:57 AM

I would begin to think your problems relate to a poor host configuration (erroneous php.ini or apache host config with session_save_path), can you replicate the problem again but adding this to your script?
echo 'My Session ID: ' . session_id() . '<br/>';
If session IDs are the same on separate clients (i.e. different computer) then it is a huge problem in itself as the server is confusing clients. It can be fixable but it is best to find what exactly is the problem first.
  • 0

All new problems require investigation, and so if errors are problems, try to learn as much as you can and report back.


#3 JakeWelton

JakeWelton

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 152 posts
  • Programming Language:Java, C++, C#, PHP, JavaScript, PL/SQL
  • Learning:Objective-C, Python, Perl, Ruby, Visual Basic .NET, Haskell

Posted 16 October 2010 - 02:37 PM

Thanks the problem was with my server
  • 0





Also tagged with one or more of these keywords: session

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download