Advertisement

07.15.2008 at 02:35PM PDT, ID: 23567744
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.9

Error: Element AUTH.ISLOGGEDIN.FIRSTNAME is undefined in SESSION.

Asked by EricBourland in Cold Fusion Markup Language

Tags:

Platform: ColdFusion 8, MS SQL Server 2005

Web site URL: http://www.guardianhelp.org/

OK, I've been staring at this one for a while. The site is http://www.guardianhelp.org/. I'm getting an element undefined error in my login application. This time, the error occurs when I attempt to log in. I am able to view the login form. When I use the login form I get:

Element AUTH.ISLOGGEDIN.FIRSTNAME is undefined in SESSION.
 
The error occurred in C:\websites\guardianhelp.org\SiteHeader.cfm: line 52

50 :
51 :  <cfif SESSION.auth.isLoggedIn>
52 : Welcome, <cfoutput>#session.auth.isLoggedIn.FirstName#</cfoutput> | <a href="/logout.cfm">Log Out</a>
53 :  <cfelse>
54 :      <a href="/LoginForm.cfm">Please Log In</a>

However, in application.cfc I have clearly defined session.auth.isLoggedIn.FirstName in Method OnSessionStart:

        <!--- METHOD: onSessionStart --->
       <cffunction name="onSessionStart" returntype="void">
     
      <!--- defined all session variables, so they will always exist ---->
      <cfset session.auth.isLoggedIn  = false>
        <cfset session.auth.isLoggedIn.ContactID  = "">
      <cfset session.auth.isLoggedIn.FirstName   = "">
      <cfset session.auth.isLoggedIn.LastName    = "">
      <cfset session.auth.isLoggedIn.Address    = "">
      <cfset session.auth.isLoggedIn.City    = "">
      <cfset session.auth.isLoggedIn.State    = "">
      <cfset session.auth.isLoggedIn.ZIP    = "">
      <cfset session.auth.isLoggedIn.Email    = "">
      <cfset session.auth.isLoggedIn.UserLogin    = "">
      <cfset session.auth.isLoggedIn.UserPassword    = "">
      <cfset session.auth.isLoggedIn.UserRoleID  = "">
 
 </cffunction>
 <!--- END METHOD: onSessionStart --->
 
 So I am not sure why I cannot log in to my application.

I append several files: application.cfc, siteheader.cfm, LoginForm.cfm, LoginCheck.cfm, ForceUserLogin.cfm. I'm following the Forta / Camden CF8 book. Many thanks for any help.

Peace,

EricStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
289:
290:
291:
292:
293:
294:
295:
296:
297:
298:
299:
300:
301:
302:
303:
304:
305:
306:
307:
308:
309:
310:
311:
312:
313:
314:
315:
316:
317:
318:
319:
320:
321:
322:
323:
324:
325:
326:
327:
328:
329:
330:
331:
332:
333:
334:
335:
336:
337:
338:
339:
340:
341:
342:
343:
344:
application.cfc:
<!--- 
 Filename: Application.cfc
 Created by: Raymond Camden (ray@camdenfamily.com)
 Please Note: Executes for every page request
--->
 
 
<cfcomponent output="false">
 
  <!--- Name the application. --->
  <cfset this.name="GuardianHelpSite">
  <!--- Turn on session management. --->
  <cfset this.sessionManagement=true>
  
  <cffunction name="onApplicationStart" output="false" returnType="void">
 
    <!--- Any variables set here can be used by all of the application's pages --->
    <cfset APPLICATION.dataSource = "ebwebwork">
    <cfset APPLICATION.companyName = "Guardian Help">
  
  </cffunction>
  
  
  <cffunction name="onRequestStart" output="false" returnType="void">
  
	  
      <!--- Set up request variables here. --->
      <cfset var secureDirectories = "stories,client,admin,board">
      <cfset var loginRequired = false>
 
	    
 </cffunction>
  
  
  	<!--- METHOD: onSessionStart --->
	 <cffunction name="onSessionStart" returntype="void">
      
      <!--- defined all session variables, so they will always exist ---->
      <cfset session.auth.isLoggedIn  = false>
	  <cfset session.auth.isLoggedIn.ContactID  = "">
      <cfset session.auth.isLoggedIn.FirstName   = "">
      <cfset session.auth.isLoggedIn.LastName    = "">
      <cfset session.auth.isLoggedIn.Address    = "">
      <cfset session.auth.isLoggedIn.City    = "">
      <cfset session.auth.isLoggedIn.State    = "">
      <cfset session.auth.isLoggedIn.ZIP    = "">
      <cfset session.auth.isLoggedIn.Email    = "">
      <cfset session.auth.isLoggedIn.UserLogin    = "">
      <cfset session.auth.isLoggedIn.UserPassword    = "">
      <cfset session.auth.isLoggedIn.UserRoleID  = "">
 
 </cffunction>
 <!--- END METHOD: onSessionStart --->
 
</cfcomponent>
 
 
 
siteheader.cfm:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Guardian Help: The Uxoricide Research Project
University of Virginia School of Nursing
Charlottesville, Virginia</title>
 
<meta http-equiv="developer" content="Eric Bourland, ebwebwork.com" />	
 
<META http-equiv="ROBOTS" CONTENT="NONE">
 
<link rel="stylesheet" type="text/css" href="/uva.css">
 
<script src="/rotateimages.js" type="text/javascript"></script>
</head>
 
<body OnLoad="rotateImage('rImage')">
 
<!-- begin page -->
<div id="page">
 
<!-- header section - invisible spacer used for logo link -->
<div id="header">
 
 
<div id="logo">
<a href="/"><img src="/images/spacer.gif" width="300" height="100"/></a>
 
<!-- /logo -->
</div>
 
<!--search box -->
<div id="search">
 
 
 
<form action="http://www.google.com/cse" id="cse-search-box">
    <input type="hidden" name="cx" value="001382591411870128679:y4fzoklwmtk" />
    <input type="hidden" name="ie" value="UTF-8" />
    <input type="text" name="q" size="20" />
    <input type="submit" name="sa" value="Go" />
 
</form>
<script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en"></script>
 
 
<div class="subsearch">
	
 
 <cfif SESSION.auth.isLoggedIn>
Welcome, <cfoutput>#session.auth.isLoggedIn.FirstName#</cfoutput> | <a href="/logout.cfm">Log Out</a>
 <cfelse>
     <a href="/LoginForm.cfm">Please Log In</a>
 </cfif>
	
	
	</div>
 
<!-- /search box -->
</div>
 
 
<!--end header section -->
</div>
 
<div class="clear"></div>
 
 
<div id="container">
 
<div id="nav">
<ul>
    <li><a href="/"><span>Home</span></a></li>
    <li><a href="/stories/"><span>Client Stories</span></a></li>
    <li><a href="/client/"><span>Client Resources</span></a></li>
	<CFIF IsDefined('SESSION.auth.userRoleID') and SESSION.auth.UserRoleID LT 6>
    <li><a href="/board/"><span>Discussion Board</span></a></li>
</CFIF>
<CFIF IsDefined('SESSION.auth.userRoleID') and SESSION.auth.UserRoleID IS 1>
    <li><a href="/admin/"><span>Admin</span></a></li>
</CFIF> 
 
<li><a href="/contact.cfm"><span>Contact</span></a></li>
</ul>
</div>
 
 
<!--- left content --->
 
<div id="content-left">
 
<div style="text-align:center; margin:20px 0;"><img src="/images/Nursing.sm.su.png" alt="UVA School of Nursing" class="border0" /></div>
 
<img name="rImage" src="/images/apuva0.jpg">
	
	</div>
 
<!--- end left content --->
 
 
 
 
LoginForm.cfm:
<!--- 
 Filename: LoginForm.cfm
 Created by: Nate Weiss (NMW)
 Purpose: Presented whenever a user has not logged in yet
 Please Note Included by Application.cfc
--->
 
<!--- If the user is now submitting Login form, --->
<!--- Include Login Check code to validate user --->
<cfif isDefined("FORM.UserLogin")> 
 <cfinclude template="LoginCheck.cfm">
</cfif>
 
 
<cfinclude template="SiteHeader.cfm">
 
 
<cfif isDefined("FORM.UserLogin")> 
 <cfinclude template="LoginCheck.cfm">
</cfif>
    
<div id="content-right">
 
 
  <div class="pageTitle">Please Log In</div>
           
  
<!--- Place cursor in "User Name" field when page loads--->
<body onLoad="document.LoginForm.userLogin.focus();">
 
<!--- Start our Login Form --->
<cfform action="#CGI.script_name#?#CGI.query_string#" name="LoginForm" method="post">
 <!--- Make the UserLogin and UserPassword fields required --->
 <input type="hidden" name="userLogin_required">
 <input type="hidden" name="UserPassword_required">
 <!--- Use an HTML table for simple formatting --->
 <table border="0">
 <tr><th colspan="2" bgcolor="silver">Please Log In</th></tr>
 <tr>
 <th>UserLogin:</th>
 <td>
 
 <!--- Text field for "User Name" ---> 
 <cfinput 
 type="text"
 name="userLogin"
 size="20"
 value=""
 maxlength="100"
 required="Yes"
 message="Please type your UserLogin first.">
 
 </td>
 </tr><tr>
 <th>UserPassword:</th>
 <td>
 
 <!--- Text field for UserPassword ---> 
 <cfinput 
 type="Password"
 name="UserPassword"
 size="12"
 value=""
 maxlength="100"
 required="Yes"
 message="Please type your UserPassword first.">
 
 <!--- Submit Button that reads "Enter" ---> 
 <input type="Submit" value="Enter">
 
 </td>
 </tr>
 </table>
 
</cfform>
 
 
 
 
 
 <!-- end right content -->
 </div>
 
<cfinclude template="SiteFooter.cfm">
 
 
LoginCheck.cfm:
<!--- 
 Filename: LoginCheck.cfm
 Created by: Nate Weiss (NMW)
 Purpose: Validates a user's UserPassword entries
 Please Note Included by LoginForm.cfm
--->
 
<!--- Make sure we have Login name and UserPassword --->
<cfparam name="FORM.userLogin" type="string">
<cfparam name="FORM.UserPassword" type="string">
 
<!--- Find record with this UserLogin/UserPassword --->
<!--- If no rows returned, UserPassword not valid --->
<cfquery name="getUser" datasource="#APPLICATION.dataSource#">
 SELECT ContactID, FirstName
 FROM GuardianHelpContacts
 WHERE UserLogin = '#FORM.UserLogin#'
 AND UserPassword = '#FORM.UserPassword#'
</cfquery>
 
<!--- If the UserLogin and UserPassword are correct --->
<cfif getUser.recordCount eq 1>
 <!--- Remember user's logged-in status, plus --->
 <!--- ContactID and First Name, in structure --->
 <cfset SESSION.auth = structNew()>
 <cfset SESSION.auth.isLoggedIn = "Yes">
 <cfset SESSION.auth.contactID = getUser.contactID>
 <cfset SESSION.auth.firstName = getUser.firstName>
 
 <!--- Now that user is logged in, send them --->
 <!--- to whatever page makes sense to start --->
 <cflocation url="#CGI.script_name#?#CGI.query_string#">
</cfif>
 
 
 
ForceUserLogin.cfm:
<!--- 
 Filename: ForceUserLogin.cfm
 Created by: Nate Weiss (NMW)
 Purpose: Requires each user to log in
 Please Note Included by Application.cfc
--->
 
 
<!--- Force the user to log in --->
<!--- *** This code only executes if the user has not logged in yet! *** --->
<!--- Once the user is logged in via <cfloginuser>, this code is skipped --->
<cflogin>
 
 <!--- If the user hasn't gotten the login form yet, display it ---> 
 <cfif not (isDefined("FORM.userLogin") and isDefined("FORM.UserPassword"))>
    <cfinclude template="LoginForm.cfm">
    <cfabort> 
 
 <!--- Otherwise, the user is submitting the login form ---> 
 <!--- This code decides whether the UserLogin and UserPassword are valid --->
 <cfelse> 
 
   <!--- Find record with this UserLogin/UserPassword --->
   <!--- If no rows returned, UserPassword not valid --->
 
   <cfquery name="getUser" datasource="#APPLICATION.dataSource#">
   SELECT ContactID, FirstName, rTrim(UserRoleName) as UserRoleName
   FROM GuardianHelpContacts LEFT OUTER JOIN UserRoles
   ON GuardianHelpContacts.UserRoleID = UserRoles.UserRoleID
   WHERE UserLogin = '#FORM.UserLogin#'
   AND UserPassword = '#FORM.UserPassword#'
   </cfquery>
 
   <!--- If the UserLogin and UserPassword are correct... --->
   <cfif getUser.recordCount eq 1>
     <!--- Tell ColdFusion to consider the user "logged in" --->
     <!--- For the NAME attribute, we will provide the user's --->
     <!--- ContactID number and first name, separated by commas --->
     <!--- Later, we can access the NAME value via GetAuthUser() --->
     <cfloginuser
     name="#getUser.ContactID#,#getUser.FirstName#"
     UserPassword="#FORM.UserPassword#"
     roles="#getUser.userRoleName#"> 
   
   <!--- Otherwise, re-prompt for a valid UserLogin and UserPassword --->
   <cfelse> 
     Sorry, that UserLogin and UserPassword are not recognized.
     Please try again.
     <cfinclude template="LoginForm.cfm">
     <cfabort>
   </cfif>
 
 
 </cfif> 
 
</cflogin>
[+][-]07.15.2008 at 04:40PM PDT, ID: 22012107

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.15.2008 at 08:25PM PDT, ID: 22013097

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.15.2008 at 08:47PM PDT, ID: 22013171

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Cold Fusion Markup Language
Tags: ColdFusion 8
Sign Up Now!
Solution Provided By: gdemaria
Participating Experts: 2
Solution Grade: A
 
 
[+][-]07.15.2008 at 08:51PM PDT, ID: 22013178

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.15.2008 at 10:31PM PDT, ID: 22013428

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628