This topic is locked

Help with session variable

10/4/2013 5:22:27 PM
PHPRunner General questions
A
Andrew S author

I would be grateful if someone could point me in the right direction regarding setting session variable 'After successful login'.
I have a user table (Users) with the following fields:
userid

UserName

Password

Security

UserCompanyID

ToEmail

CopyEmail
The instructions state:

Parameters

$username - user-entered login name.

$password - user-entered password.

$data - an array with the contents of the user record. Access fields by

$data["FieldName"].
I have tried adding the following code to After successful login event:
$_SESSION["ToEmail"] = $data["ToEmail"];

$_SESSION["CopyEmail"] = $data["CopyEmail"];
//to debug
print_r ($_SESSION);

exit();
The output shows both ToEmail and CopyEmails fields blank!!
Array ( [login_count_captcha] => 1 [UserID] => Andrew [UserName] => Andrew [GroupID] => [AccessLevel] => User [OwnerID] => 2 [_EPMUsers_OwnerID] => 2 [userid] => 2 [Password] => Andrew [ToEmail] => [CopyEmail] => )
Thanks in anticipation

G
gdmacdo 10/5/2013

Could it be the missing bracket and semicolon
$_SESSION["ToEmail"] = $data["ToEmail"];

$_SESSION["CopyEmail";



I would be grateful if someone could point me in the right direction regarding setting session variable 'After successful login'.
I have a user table (Users) with the following fields:
userid

UserName

Password

Security

UserCompanyID

ToEmail

CopyEmail
The instructions state:

Parameters

$username - user-entered login name.

$password - user-entered password.

$data - an array with the contents of the user record. Access fields by

$data["FieldName"].
I have tried adding the following code to After successful login event:
$_SESSION["ToEmail"] = $data["ToEmail"];

$_SESSION["CopyEmail" = $data["CopyEmail"]
//to debug
print_r ($_SESSION);

exit();
The output shows both ToEmail and CopyEmails fields blank!!
Array ( [login_count_captcha] => 1 [UserID] => Andrew [UserName] => Andrew [GroupID] => [AccessLevel] => User [OwnerID] => 2 [_EPMUsers_OwnerID] => 2 [userid] => 2 [Password] => Andrew [ToEmail] => [CopyEmail] => )
Thanks in anticipation


A
Andrew S author 10/5/2013

Thanks Greg - The error you pointed out was my error in posting. The actual code is correct but still blank where I would expect to see values.
Andrew

G
gdmacdo 10/5/2013

I had a weird problem if the fields were defined as varchar(max) returning blanks. How are the fields defined in the DB?



Thanks Greg - The error you pointed out was my error in posting. The actual code is correct but still blank where I would expect to see values.
Andrew


Sergey Kornilov admin 10/5/2013

Besides printing the whole session content print variables like $data["ToEmail"] and $data["CopyEmail"]. Another thing - field names are case-sensitive, make sure you got them right.