> > I'm not *sure* why I want to do cflogin inside the CFC. For
> > one, I was wanting to create something that, with minimal
> > effort, could be used with Flash Remoting. I'm creating an
> > application that's going to require some basic security (IE,
> > you gotta be logged in to use it) and eventually I was
> > wanting to springboard into creating it as a Flash Remoting
> > Application down the road. In fact, I was hoping to learn
> > Flash Remoting using this as a starting point, but first
> > wanted to get it up and running as a CF solution.
>
> [deletia]
>
> I believe - and someone could correct me - that you could still count on
> Application.cfm when using Flash Remoting. I haven't done any FR in a
while
> though.

Really? Okay then.

So what you're saying is, in the following example:

<cflogin>
<!--- Then, you're not logged in, so we check for the cookie --->
<cfif NOT isDefined("COOKIE.LoginUN")>
<!--- If the cookie isn't defined, then check for the form variables --->
<cfif IsDefined("FORM.LoginPassWord") AND IsDefined("FORM.LoginUserName")>
  <!--- If form variables are found, step into here
  and start looking for the logging in user --->
  <cfquery name="FormLogin" datasource="#Application.Dsn#">
  SELECT *
  FROM tblLogin
  WHERE (tblLogin.UserName = '#FORM.LoginUserName#') AND (tblLogin.PassWord
= #FORM.LoginPassWord#)
  </cfquery>

  <!--- If the RecordCount is 1, log in the user --->
  <cfif FormLogin.RecordCount EQ 1>
   <!--- Log Them In --->
   <cfloginuser name="#FormLogin.OwnerFirstName# #FormLogin.OwnerLastName#"
password="#FormLogin.PassWord#" roles="#FormLogin.Role#">

   <!--- Check to see if they checked the SaveInfo checkbox and if so, set
it to their Primary UserID ID --->
   <cfif isDefined("FORM.SaveInfo")>
    <cfcookie name="LoginUN" value="#FormLogin.UserName#" expires="never">
    <cfcookie name="LogInPW" value="#FormLogin.PassWord#" expires="never">
   </cfif>

   <!--- Setting that Redirect Flag since I stepped in here and got logged
in --->
   <cfset RedirectFlag = 1>
   <!--- Then redirect to protected index page --->
  <cfelseif FormLogin.RecordCount EQ 0>
   <cfset ErrorMessage = 1>
  </cfif>
</cfif>
<!--- The form variables weren't found nor was a cookie found, so you're
not logged in and nothing happens --->

<cfelseif isDefined("COOKIE.LoginUN")>
<!--- Else the cookie WAS found, so we'll step in here and take the
cookie's CPRLogInID value to log in --->
<cfquery name="CookieLogin" datasource="#Application.dsn#">
  SELECT *
  FROM tblLogin
  WHERE (tblLogin.UserName = '#COOKIE.LoginUN#') AND (tblLogin.PassWord =
#COOKIE.LogInPW#)
</cfquery>
<!--- If the RecordCount is 1, log in the user --->
<cfif CookieLogin.RecordCount EQ 1>
  <cfloginuser name="#CookieLogin.OwnerFirstName#
#CookieLogin.OwnerLastName#" password="#CookieLogin.PassWord#"
roles="#CookieLogin.Role#">
  <!--- Setting that Redirect Flag since I stepped in here and got logged
in --->
  <cfset RedirectFlag = 1>
<cfelseif CookieLogin.RecordCount EQ "0">
  <cfset ErrorMessage = 1>
</cfif>
</cfif>
</cflogin>

Which portions would I want to use CFCs for? This is what I'm most fuzzy on.
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to