You should have a test like this:
if ( ($_SESSION['userInfo']) && ($_SESSION['userInfo']['loggedin'] ==
TRUE)) {
I'm not sure about your script, i just see a small part.
Alan
Jason Pruim wrote:
Good morning everyone!
I think I might be having a "to early in the morning/not enough
caffeine" moment... But I am down to 1 error on my timecard
application that I would like to clean up. It's a small undefined
index error, and the program works jsut fine the way it is, but why
leave an error if you don't need to? :)
Here is the error:
[Tue Oct 14 08:19:47 2008] [error] PHP Notice: Undefined index:
userInfo in
/Volumes/RAIDer/webserver/Documents/dev/stimecard/inc/function/authentication.func.php
on line 22
and here is the relevant code:
======> Line 22 if($_SESSION['userInfo']['loggedin'] == TRUE) {
return TRUE;
}else{
if(is_array($row1)){
$_SESSION['userInfo'] = array( "authname" =>
$row1['username'], "loggedin" => TRUE, "fullname" => $row1['Name'],
"empID" => $row1['empID'], "authLevel" => $row1['authLevel']);
}
else
{
//$_SESSION['userInfo'] =array("loggedin" => FALSE);
die('authentication failed');
}
}
What I'm trying to do, is if the person already has a valid session, I
want to skip over resetting all the variables, and just log them in.
BUT if they have no session, and the auth returned an array, then have
it set the variables. Or if they type in the wrong password it just
dies... I may change that if I decide to release the code to the
public so that it is handled more gracefully, but it works fine for my
purposes right now :)
So... With all that said, anyone have any idea how to get rid of my
error other then setting error reporting to none?
Thanks for taking the time to read this!
--
Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
japruim@xxxxxxxxxx
--
Alan Boudreault
Mapgears
http://www.mapgears.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php