?
Solved

Session get destroyed randomly

Posted on 2010-11-21
5
Medium Priority
?
255 Views
Last Modified: 2012-05-10
Hello,

I have a web app that uses session for user authenticating, I store the logged in user's username and a specific level. I use the session_start() in every page before any content starts. Upon first login  user get redirected to a page which has some links to specific categories and user can go to each categories by clicking on link. So the issue is sometimes user get redirected again to the login screen because the session is destroyed. I used print_r($_SESSION); through out the site to see if the session is getting removed and some sometimes it return array() no session data at all.

I'm on a shared hosting environment.

Any idea what is happening ?

Thanks in advance.
0
Comment
Question by:sahanz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 6

Expert Comment

by:CyberGhost
ID: 34184344
if you have AJAX calls and use cookies to store your session, it is possible that your cookies get timed out

AJAX calls - to the best of my knowledge - do not work with cookies, so once the session is regenerated, it won't be updated in the browser (cookie) and so the session will be invalidated
0
 
LVL 1

Author Comment

by:sahanz
ID: 34193304
uhmm no ajax stuff.
0
 
LVL 1

Accepted Solution

by:
sahanz earned 0 total points
ID: 34342798
It was a domain issue, the website had links with www. and without. Its fixed now and didnt get the issue after that.

Thanks
0
 
LVL 16

Expert Comment

by:CWS (haripriya)
ID: 36110497
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Video: Liquid Web Managed WordPress Comparisons

If you run run a WordPress, you understand the potential headaches you may face when updating your plugins and themes. Do you choose to update on the fly and risk taking down your site; or do you set up a staging, keep it in sync with your live site and use that to test updates?

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
This article discusses how to implement server side field validation and display customized error messages to the client.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question