Re: session problems

From: Date: Thu, 14 Mar 2002 19:30:20 +0000
Subject: Re: session problems
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-88559@lists.php.net to get a copy of this message
On Thursday, March 14, 2002, at 02:15 PM, Daniel Ferreira Castro wrote:
If it validates the user, then he creates a session called login_session and open another file called s_proj.htm throug the line header("location:http://pinguim/pb/s_proj.php"); The problem is on my login.php I have the block
    session_name("login_session");
    session_start();
    session_register(login);
    session_register(pass);
    $HTTP_SESSION_VARS["login"]= '$user';
    $HTTP_SESSION_VARS["pass"]='$pass';
    mysql_close($link);
    header("location:http://pinguim/pb/s_proj.php");
and I wish to retrieve at s_proj.php the values of the session variables login and pass registered for my "login_session" session. How can I do it?
Two things: (1) at the top you say "s_proj.htm" but I am assuming this is a typo and you mean "s_proj.php" (2) you have variables in single quotes, which will prevent them from expanding. You can drop the single quotes if you want. (3) If you are using PHP 4.1.0 or greater, then there is a much easier way to write this script: session_start(); $_SESSION['login'] = $_POST['user']; // use $_GET if that is the method you're using $_SESSION['pass'] = $_POST['pass']; // use $_GET if you are using that method mysql_close($link); header("location: http://pinguim/pb/s_proj.php"); HTH, Erik ---- Erik Price Web Developer Temp Media Lab, H.H. Brown pricee@hhbrown.com

« previous php.general (#88559) next »