?
Solved

Session get destroyed randomly

Posted on 2010-11-21
5
Medium Priority
?
272 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
  • 2
4 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

These days socially coordinated efforts have turned into a critical requirement for enterprises.
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses
Course of the Month15 days, 20 hours left to enroll

850 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