Rather straight forward function to set the userid and information based on
login. I call it once per user.

 <CFFUNCTION NAME="Login" RETURNTYPE="boolean">
  <CFARGUMENT NAME="Username" TYPE="string" REQUIRED="yes">
  <CFARGUMENT NAME="Password" TYPE="string" REQUIRED="yes">
  <cfquery name="verify_login" datasource="#This.DSN#">
   SELECT user_id, nickname, name, password
    FROM users
    WHERE Username = #Username# AND
     password = '#password#'
  </cfquery>
  <cfif verify_login.recordCount>
   <cfset session.userid = verify_login.userid>
   <cfset session.name = verify_login.name>
   <CFreturn 1>
  <CFELSE>
   <CFreturn 0>
  </cfif>
 </CFFUNCTION>



> Micheal, can you show the login method? Also, is the code that calls
> login being run every hit?
>
> ========================================================================
> ===
> Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc
> (www.mindseye.com)
> Member of Team Macromedia (http://www.macromedia.com/go/teammacromedia)
>
> Email    : [EMAIL PROTECTED]
> Blog     : www.camdenfamily.com/morpheus/blog
> Yahoo IM : morpheus
>
> "My ally is the Force, and a powerful ally it is." - Yoda
>
> > -----Original Message-----
> > From: Michael Dinowitz [mailto:[EMAIL PROTECTED]
> > Sent: Monday, August 11, 2003 3:18 AM
> > To: CF-Talk
> > Subject: Re: Sessions and CFCs
> >
> >
> > I've tested it out a few ways to Sunday and the results are
> > always the same. As long as the CFC is cached, only the first
> > 'use' of the CFC will result in any session information being
> > written for the user. Every additional attempt results in no
> > session being written. This is the code.
> > caching:
> > <CFIF not IsDefined('Application.CFC.User')>
> >  <cfparam name="Application.cfc" default="#structNew()#">
> > <CFOBJECT NAME="Application.CFC.User" COMPONENT="components.user">
> >   <cfinvoke component ="#Application.CFC.User#" method = "Init">
> >   <CFINVOKEARGUMENT NAME="dsn" VALUE="#DSN#">
> >  </CFINVOKE>
> > </CFIF>
> > call:
> >  <CFINVOKE COMPONENT="#Application.CFC.User#" METHOD="Login"
> > RETURNVARIABLE="IsLoggedIn">
> >   <CFINVOKEARGUMENT NAME="Username" VALUE="#Username#">
> >   <CFINVOKEARGUMENT NAME="Password" VALUE="#Password#">
> > </CFINVOKE> Is it possible that when I upgraded to 6.1 from
> > the last beta something went wrong? I'm seeing  6,1,0,60662
> > as the build.
> >
> > > On Sunday, Aug 10, 2003, at 21:43 US/Pacific, Michael
> > Dinowitz wrote:
> > > > Running full release of 6.1 on a machine that was running
> > the beta.
> > >
> > > Hmm, weird. The page context bug is *definitely* fixed in Red Sky,
> > > even in the beta versions!
> > >
> > > > What is this page context bug, where can I read more
> > about it and is
> > > > there a fix
> > >
> > > http://www.google.com/search?q=page+context+bug&ie=UTF-8&oe=UTF-8
> > >
> > > The fix should be CFMX 6.1!
> > >
> > > Since that *does* fix the bug, let's see your code... maybe
> > you've got
> > > a bug in your code?
> > >
> > > Sean A Corfield -- http://www.corfield.org/blog/
> > >
> > > "If you're not annoying somebody, you're not really alive."
> > > -- Margaret Atwood
> > >
> > >
> >
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. 
http://www.fusionauthority.com/signup.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to