php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13808 Session vars not saved
Submitted: 2001-10-24 04:35 UTC Modified: 2001-10-24 05:13 UTC
From: fabien dot dehopre at itn dot skynet dot be Assigned:
Status: Not a bug Package: Session related
PHP Version: 4.0.6 OS: Windows 2000 Pro
Private report: No CVE-ID: None
 [2001-10-24 04:35 UTC] fabien dot dehopre at itn dot skynet dot be
I use a class to manage member on my site (login, logout, register, ...).
When a user login, I want to save a unique id to identify the user. But the token is never save in the session.
When I use a cookie to remember user, the session works.

The token is set in a class function and just after, I redirect the user with a header("Location: $HTTP_REFERER");

There is the script I use for login user:

session_start();
...
$res = $user->login("$nickname","$passwd",$rem);
if ($res) {
  header("Location: index.php?module=home&content=default"."&".session_name()."=".session_id());
  exit;
}

The class function login:
function login($username,$passwd,$remember=false) {
...
if ($remember) setcookie("token_cook",$token,time()+(365*24*60*60));
session_register('token_sess');
$token_sess = $token_cook = $token;
$this->errno = 0;
return true;
}

I would like to know what is wrong in my script.

Thanks.
Fab

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-10-24 05:13 UTC] sniper@php.net
This is not a support forum. Ask support questions on
the mailing lists: http://www.php.net/support.php

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 03 23:01:30 2024 UTC