Re: 1 last error to fix before the application is done!
| From: | Alan Boudreault | Date: | Tue, 14 Oct 2008 12:29:06 +0000 |
| Subject: | Re: 1 last error to fix before the application is done! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-281853@lists.php.net to get a copy of this message | ||
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@raoset.com
--
Alan Boudreault
Mapgears
http://www.mapgears.com