Solved

Session get destroyed randomly

Posted on 2010-11-21
5
247 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

726 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