473,406 Members | 2,208 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Trouble with retrieving session variables

Hi Guys,

I am using sessions to store the login name and then retrieve it on
every page. Here are the details of the php settings.

1) I have PHP 4.2.2 installed on a Apache 1.3.27 server.
2) I have register_globals off.
3) I use $_session['loginname']= $loginname to store the loginname
into the session and then retrieve it on other pages using a
$HTTP_SESSION_VARS['loginname'].

My problem is that sometimes, I am able to retrieve the loginname from
the session and sometimes I am not. When I am not able to get the
loginname, I refresh the page 3-4 times and the loginname shows up.
This happens on every page. Am I screwing up somewhere? Does this
depened on the speed of the server?

Thanks for your help.
Jul 17 '05 #1
1 4600
Avinash Korwarkar wrote:
Hi Guys,

I am using sessions to store the login name and then retrieve it on
every page. Here are the details of the php settings.

1) I have PHP 4.2.2 installed on a Apache 1.3.27 server.
2) I have register_globals off.
3) I use $_session['loginname']= $loginname to store the loginname
into the session and then retrieve it on other pages using a
$HTTP_SESSION_VARS['loginname'].

My problem is that sometimes, I am able to retrieve the loginname from
the session and sometimes I am not. When I am not able to get the
loginname, I refresh the page 3-4 times and the loginname shows up.
This happens on every page. Am I screwing up somewhere? Does this
depened on the speed of the server?


Hi Avinash,

No, not the speed of the server.

Check the following:
1) Do you ALWAYS start your php-scripts with session_start() ??
Or
Alternatively: did you put session.auto_start = 1 in your php.ini file?\

2) Be sure you did not produce any output before the first session-calls.

3) To debug, check the coockies in your webbrowser. Delete them, log in
again, check what is set, etc.etc. You can also check the real content of a
session by finding the right one in the temp-directory as set in php.ini
(On my system: session.save_path = /tmp)

4) Last but not least: I had trouble with PHP-sessions too under 4.2 that
was soo darn vague and difficult to replicate, I got a real headage of it.
I upgraded to php4.3, problems gone....
(I could only find some scattered remarks on this, not a lot.)

Good luck,
Regrads,
Erwin Moller
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Penn Markham | last post by:
Hello all, I am writing a script where I need to use the system() function to call htpasswd. I can do this just fine on the command line...works great (see attached file, test.php). When my...
2
by: Alex Hopson | last post by:
Hi, I'm trying to modify a shopping cart script from Mastering PHP/MySQL and am having trouble setting up some arrays for it. The original code, below, stores the cart items in a session...
1
by: Sean Pinto | last post by:
Ok, you all are going to have to bear with me on this one as it is kinda complicated to explain. I am implementing a company management suite that requires Role-Based authentiations (ie. users are...
9
by: Greg Linwood | last post by:
I'm having difficulty understanding Session state in ASP.Net. It's almost embarrassing asking this as I've been using ASP since it was first released & it really shouldn't be this hard to use -...
2
by: Boban Dragojlovic | last post by:
I'm building a complex web-based reservations system. Gathering the user's data requires between 8 and 15 pages (depending on which options they are interested in). I use the "Session" object to...
2
by: Glenn Venzke | last post by:
I'm trying to put together a web form that lists all current session information. The session info is stored in SQL server database (ASPState) and I'm trying to retreive and display using a...
1
by: tperri | last post by:
Hi everyone, I have an .aspx file that is used by an external program to perform a function. There is no code behind, all code and HTML is contained in one file. the structure is like this: ...
14
by: aroraamit81 | last post by:
Hi, I am facing a trouble. I have some Session variables in my code and somehow my session variables are getting mixed up with other users. For example User A has access to 10 companies and...
0
by: Laurahn | last post by:
Hi: i'm using modal window (showmodelessdialog) on asp. when the object is created i used session variables. After the object is closed the data is remaining on the modal window when is open...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.