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_PO ST_VARS['username'])) $entered_userna me =
$HTTP_POST_VARS['username'];
if (isset($HTTP_PO ST_VARS['password'])) $entered_passwo rd =
$HTTP_POST_VARS['password'];
// check if login is neccesary
if (!isset($entere d_username) && !isset($entered _password))
{
// use data from session
if (isset($_SESSIO N['username']))
{
$login = $_SESSION['username'];
$password = $_SESSION['password'];
}
else
{
// Display error cause we don't have a username
$_SESSION['message'] = $MsgErrAccessDe nied;
require("./error.php");
exit;
}
}
else
{
// use entered data
// encrypt entered password
$login = $entered_userna me;
$password = md5($entered_pa ssword);
$_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_ha ndler = files
session.save_pa th = /tmp
session.use_coo kies = 1
session.name = PHPSESSID
session.auto_st art = 1
session.cookie_ lifetime = 0
session.cookie_ path = /
session.cookie_ domain =
session.seriali ze_handler = php
session.gc_prob ability = 1
session.gc_maxl ifetime = 1440
session.referer _check =
session.entropy _length = 0
session.entropy _file =
session.cache_l imiter = nocache
session.cache_e xpire = 180
session.use_tra ns_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.
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_PO ST_VARS['username'])) $entered_userna me =
$HTTP_POST_VARS['username'];
if (isset($HTTP_PO ST_VARS['password'])) $entered_passwo rd =
$HTTP_POST_VARS['password'];
// check if login is neccesary
if (!isset($entere d_username) && !isset($entered _password))
{
// use data from session
if (isset($_SESSIO N['username']))
{
$login = $_SESSION['username'];
$password = $_SESSION['password'];
}
else
{
// Display error cause we don't have a username
$_SESSION['message'] = $MsgErrAccessDe nied;
require("./error.php");
exit;
}
}
else
{
// use entered data
// encrypt entered password
$login = $entered_userna me;
$password = md5($entered_pa ssword);
$_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_ha ndler = files
session.save_pa th = /tmp
session.use_coo kies = 1
session.name = PHPSESSID
session.auto_st art = 1
session.cookie_ lifetime = 0
session.cookie_ path = /
session.cookie_ domain =
session.seriali ze_handler = php
session.gc_prob ability = 1
session.gc_maxl ifetime = 1440
session.referer _check =
session.entropy _length = 0
session.entropy _file =
session.cache_l imiter = nocache
session.cache_e xpire = 180
session.use_tra ns_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.
Comment