I have an index.cfm where I have a login  box displayed for a member to
login to the secure area of the website.

 

So far in testing I have been able to login but when I go to display a
personalized welcome message to the person its falling over.  Basically I
set session variables and was planning on using these so as to be able to
display the personalized greeting.

 

In the Application.cfm program I have set sessionmanagement="yes"

 

Then I have gone to use: <cfoutput> Session.LoggedUserLName</cfoutput>

 

But keep getting the message - Element LOGGEDUSERFNAME is undefined in
SESSION.

 

Wondering if anyone has any thoughts on what the issue might me.

 

Thanks in advance

 

 

 

On the login page I have the following code:

 

<cfsilent>

<cfif IsDefined("FORM.username")>

  <!--- Query the database to see if the member is registered --->

  

  <cfquery name="getLogOn" datasource="#request.db_dsn#"
username="#request.db_login#" password="#request.db_pwd#">

  SELECT * FROM tbl_customers WHERE cst_username = '#FORM.username#' AND
cst_password

  = '#FORM.password#'

  </cfquery>

      <cfparam name="LastLogin" default="#getLogOn.cst_LoginDate#">

      

      <cfif (LastLogin IS "") OR (NOT IsDate(LastLogin))>

            <cfset LastLogin=CreateODBCDateTime("2002-01-01 01:00:00")>

      <cfelse>

            <cfset LastLogin=CreateODBCDateTime(LastLogin)>

      </cfif>

 

  <!--- Record found, login  --->

  <cfif getLogOn.RecordCount NEQ 0>

    <cflock timeout="5" throwontimeout="no" type="exclusive">

      <!--- Set the session vars --->

      <cfset Session.LoggedIn = 1>

      <!--- This session store the username --->

      <cfset Session.LoggedUser ="#getLogOn.cst_MedRegoNo#">

        <cfset Session.LoggedUserFName ="#getLogOn.cst_FirstName#">

        <cfset Session.LoggedUserLName ="#getLogOn.cst_LastName#">

        

            <cfset Session.LastLogin = LastLogin>

    </cflock>

    <!--- Store username inside a cookie if required --->

    <cfif isDefined("FORM.remember_me")>

      <cfcookie name="LYMbrname" value="#FORM.username#" expires="never">

      <!--- Else, clean any existing cookie --->

      <cfelse>

      <cfcookie name="LYMbrname" value="" expires="now">

    </cfif>

            <!--- Update user logon date --->

              <cfquery datasource="#request.db_dsn#"
username="#request.db_login#" password="#request.db_pwd#">

            UPDATE tbl_customers SET cst_LastLogin = #LastLogin#,
cst_LoginDate = #CreateODBCDateTime(Now())#

            </cfquery>

    <!--- If the user requested a specific page, redirect there --->

    <cfif IsDefined("FORM.redirect_to")>

      <cflocation addtoken="no" url="#URLDecode(FORM.redirect_to)#">

      <cfelse>

      <cflocation addtoken="no" url="members/mbr_home.cfm">

    </cfif>

    <!--- Login failed --->

    <cfelse>

    <!--- Store the application's name in a local var to reduce locking --->

    <cflock timeout="5" throwontimeout="No" type="readonly"
scope="application">

      <cfset appname=application.applicationname>

    </cflock>

    <!--- Display an error message --->

    <cfset LogOnError="Log on unsuccesful. No match was found. Please try
again or contact administrator.">

  </cfif>

</cfif>

<cfif not isdefined("cookie.SMbrname")>

  <cfcookie name="SMbrname" value="">

</cfif>

</cfsilent>




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:263404
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to