473,324 Members | 2,196 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,324 software developers and data experts.

session variables 'disappear'

Hi all,

I have a strange problem. I have a login procedure that uses a mysql
database in which the users are stored.
The login procedure is pretty straightforward. In every page I unclude
my session.php.

session.php:

=============

session_start();

// if username and password were specified, fetch them
if (isset($HTTP_POST_VARS['username'])) $entered_username =
$HTTP_POST_VARS['username'];
if (isset($HTTP_POST_VARS['password'])) $entered_password =
$HTTP_POST_VARS['password'];

// check if login is neccesary
if (!isset($entered_username) && !isset($entered_password))
{
// use data from session
if (isset($_SESSION['username']))
{
$login = $_SESSION['username'];
$password = $_SESSION['password'];
}
else
{
// Display error cause we don't have a username
$_SESSION['message'] = $MsgErrAccessDenied;
require("./error.php");
exit;
}
}
else
{
// use entered data

// encrypt entered password
$login = $entered_username;
$password = md5($entered_password);

$_SESSION['username'] = $login;
$_SESSION['password'] = $password;
}

<More code>
============

On one server this works fine. On another one though the session
variables $_SESSION['username'] and $_SESSION['password'] aren't being
stored. I can tell by looking at the session_.... file in /tmp.
On the server where it works it contains the username and password
session vars, on the server where it doesn't work the file is being
created but it's empty. I checked php.ini, comparing the php.ini files
from both servers, especially the settings that have to do with
sessions. Both have the same session settings, but the problem still exists:

session.save_handler = files

session.save_path = /tmp

session.use_cookies = 1

session.name = PHPSESSID

session.auto_start = 1

session.cookie_lifetime = 0

session.cookie_path = /

session.cookie_domain =

session.serialize_handler = php

session.gc_probability = 1

session.gc_maxlifetime = 1440

session.referer_check =

session.entropy_length = 0

session.entropy_file =

session.cache_limiter = nocache

session.cache_expire = 180

session.use_trans_sid = 1

System specs:
=============

Server that works : Solaris 8 intel, Apache 1.3.26, PHP 4.2.2

Server that doesn't work : Linux 2.4.16 (Sun Cobalt), Apache 1.3.20, PHP
4.0.6

Any ideas are welcome.

Kind regards,
Ruben.

Jul 16 '05 #1
6 6543
[snip original posting]

Never mind, I resolved it by upgrading to PHP 4.3.3. I still don't know
the reason of the original problem, but it works anyways now.

Ruben.

Jul 16 '05 #2
Ruben van Engelenburg <ru***@NOSPAMtextinfo.nl> schrieb:
On one server this works fine. On another one though the session
variables $_SESSION['username'] and $_SESSION['password'] aren't being
stored.
[...]
Server that doesn't work : Linux 2.4.16 (Sun Cobalt), Apache 1.3.20, PHP
4.0.6


The superglobal $_SESSION does not exist in 4.0.6.

http://www.php.net/manual/en/languag...predefined.php will give
you more information.

Regards,
Matthias
Jul 16 '05 #3
Matthias Esken wrote:
The superglobal $_SESSION does not exist in 4.0.6.

http://www.php.net/manual/en/languag...predefined.php will give
you more information.


Makes sense indeed. It worked after I upgraded to 4.3.3. Thanks for the
info.

Regards,
Ruben.

Jul 16 '05 #4
On Thu, 11 Sep 2003 01:53:23 +0200, Ruben van Engelenburg
<ru***@NOSPAMtextinfo.nl> wrote:
Matthias Esken wrote:
The superglobal $_SESSION does not exist in 4.0.6.

http://www.php.net/manual/en/languag...predefined.php will give
you more information.


Makes sense indeed. It worked after I upgraded to 4.3.3. Thanks for the
info.

Regards,
Ruben.


Slight change of subject, but only slight - does anyone know when the
PHP developers are going to stop screwing around with variables? I've
had to rewrite the same [expletive deleted] application 3 times now
because they can't leave anything alone! Once more and I recode it in
perl and burn my php manuals.

Mike-

Mornings: Evolution in action. Only the grumpy will survive.
-----------------------------------------------------

Please note - Due to the intense volume of spam, we have
installed site-wide spam filters at catherders.com. If
email from you bounces, try non-HTML, non-encoded,
non-attachments.
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Jul 16 '05 #5
Michael W. Cocke <co***@catherders.com> schrieb:
Slight change of subject, but only slight - does anyone know when the
PHP developers are going to stop screwing around with variables? I've
had to rewrite the same [expletive deleted] application 3 times now
because they can't leave anything alone!


What was the problem? If your code relies on register_globals, then you
can reactivate them.

Regards,
Matthias
Jul 16 '05 #6
On Thu, 11 Sep 2003 18:33:04 +0200, Matthias Esken
<mu************@usenetverwaltung.org> wrote:
Michael W. Cocke <co***@catherders.com> schrieb:
Slight change of subject, but only slight - does anyone know when the
PHP developers are going to stop screwing around with variables? I've
had to rewrite the same [expletive deleted] application 3 times now
because they can't leave anything alone!


What was the problem? If your code relies on register_globals, then you
can reactivate them.

Regards,
Matthias


Register globals was the second rewrite, and I couldn't just turn it
on because that busted another app I use. I honestly don't know what
the current problem is, but re-writing everything to use method=post
solved it. Every time the php module is updated, I have to go
recode... it's getting really old.

Mike-

Mornings: Evolution in action. Only the grumpy will survive.
-----------------------------------------------------

Please note - Due to the intense volume of spam, we have
installed site-wide spam filters at catherders.com. If
email from you bounces, try non-HTML, non-encoded,
non-attachments.
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Jul 16 '05 #7

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

Similar topics

5
by: Ben | last post by:
Hello, My $_SESSION variables disappear and reappear. It's not just a matter of not caching the page. I usually have to press the Refresh button about 3 times to get the page to remember the...
9
by: Pack Fan | last post by:
I've noticed that session variables will persist on Mac IE even after all browser windows have been closed. One must quit the program to clear the session variables. This presents a security risk...
5
by: Larry Woods | last post by:
I am losing Session variables, but only those that are set in the page previous to a redirect to a secure page. Anyone seen ANY situation where Session variables just "disappear?" Note that...
9
by: William LaMartin | last post by:
I have a problem, mentioned here before, of Session and Application variables disappearing at one site but not at others or on my development computer. The problem is illustrated by an example...
4
by: PJ | last post by:
A particular page seems to be having issues with correctly setting Session variables. I am setting a couple of session variables on the Page_Unload event. While stepping through code, the...
1
by: Wiktor Zychla | last post by:
Hello there, I've just encountered a strange problem with Session. In one particular scenario it is cleared between pages but the scenario is so specific that I am really, really startled. I've...
6
by: Jon | last post by:
If a session times out, but the forms auth is still logged in it's possible for users to go to pages on the site that need those session variables. I was under the impression that using forms auth...
7
by: Frank Schumacher | last post by:
Hi NG, I have a weird problem, that's starting to get my sanity. My webapplication stores several values in Session. After a server roundtrip, no Session variables exist anymore (Session.Count...
13
by: Alexander Widera | last post by:
hi, who has seen the follow problem or could help please? i visit a page .... i read a sesssion-var . ... everythink works...... i visit the page again..... error ... the sessionvar is null .... i...
5
by: Simon | last post by:
Hi all, We have a small problem. We are running an ASP.NET1.1 application, using IIS6 on server2003, no web farm, on a single server, using in-proc session state, only using one worker...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.