Losting values of _SESSION variable
Posted: Tue May 23, 2006 1:43 pm
hawleyjr | Please use
and in a pliegos.php:
I lost all the values I had post in the $_SESSION variable, when I'm using PHP 5. $_SESSION['usuario_rol'] is undefined.
Any help?
Thanks in advance.
Martha
hawleyjr | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I don't know why I lost the values of $_SESSION after use the PEAR Auth login.
I've a script called login.php for loggingCode: Select all
require_once 'DB.php';
require_once 'PEAR.php';
require_once 'Auth.php';
require_once 'HTML/QuickForm.php';
$auth_options = array(
'dsn' =>'sybase://sa:password@tcp+server8:5000/base',
'table' => 'website_auth',
'usernamecol' => 'login',
'passwordcol' => 'password');
$auth = new Auth('DB', $auth_options, 'login_function');
$auth->start();
print "<h1>User: ".$_SESSION['_authsession']['username']."</h1>\n";
$_SESSION['usuario_rol']='compras';
print "<a href=/licitaciones/pliegos.php>Pliegos de Compras</a>\n";
function login_function()
{
$form = new HTML_QuickForm('login', 'POST');
$form->addElement('text', 'username', 'User name:', 'size="10"');
$form->addRule('username', 'Please enter your user name!','required',null, 'client');
$form->addElement('password', 'password', 'Password:');
$form->addElement('submit', 'submit', 'Log In!');
$form->display();}and in a pliegos.php:
Code: Select all
<? echo session_save_path();
if(session_id() == "")
{
echo 'No hay sesion abierta';
}
else
{
// Anything you want
}
echo $_SESSION['usuario_rol'];Any help?
Thanks in advance.
Martha
hawleyjr | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: :arrow: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]