Here's what I do.  I have a root page, usually index.cfm.  Inside there 
I have a variable called action which I default to "start". 

After that I include an event handler. 
After that I include a header with just HTML header info.

After that I have a switch statement evaluating the variable action. 
If action eq "start" then I include the login page.
If action eq something else, I include a page associated with that 
action.  So, a successful login would include the main page the user 
would see immediately after logging in. 
After the switch I include a footer page with just ending HTML tags and 
any display information that's at the bottom of all pages.

In the login page you have a form, usually username/password and a 
submit button.

In the event handler I do if isdefined('form.submitButtonName').  If 
that is true then I query the database to check credentials and assuming 
everything checks out, I reset the action variable to something else 
like "loggedIn".  That way, the natural progression of code takes over 
and sends the correct page to the client.  In the first page visit, 
action is start so the login form is displayed.  The 
form.submitButtonName is not in the form scope so that event handler 
stuff never runs.  After they enter their username/password and hit 
submit, then the submit button is there and that event handler stuff 
runs.  If the event handler checks everything out then the next page is 
displayed.  If the login fails then action can be set to yet another 
value like "loginError" and a different page can be displayed.

Of course, you will need to manage session or cookie variables for 
logging in and out. 

Hope this somewhat answers your question.

-Jake

Jason T. Slack wrote:
> So
>
> How does one Login and out? I mean how does one execute Cold Fusion  
> code without a page attached?
>
> If I wanted to Login, I would check a db table for the right  
> credentials and if successful redirect them to a page and if not  
> successful, re-direct them to a login page.
>
> How does this get done?
>
> -Jason
>
> On Nov 10, 2006, at 6:43 PM, Matt Quackenbush wrote:
>
>
>   
>> "What I am looking for is an all coldfusion method, not a page with  
>> code
>> embedded into it"
>>
>> No.
>>
>> "Also, can I call Coldfusion procedures from onBlur() events?"
>>
>> Kinda.  You can do this with AJAX, but not directly, as CF is  
>> server-side,
>> and the onBlur() event is client side.
>>
>>
>>
>> -----Original Message-----
>> From: Jason T. Slack [mailto:[EMAIL PROTECTED]
>> Sent: Friday, November 10, 2006 5:37 PM
>> To: CF-Talk
>> Subject: Calling Cold Fusion "Procedures"
>>
>> Hello All,
>>
>> I am moving from ASP to ColdFusion.
>>
>> Are there ColdFusion "Procedures" That I can run on a form post?
>>
>> like: <form name="logout" action=" call cold fusion code to be run on
>> logout" method="get">
>>
>> What I am looking for is an all coldfusion method, not a page with  
>> code
>> embedded into it
>>
>> Also, can I call Coldfusion procedures from onBlur() events?
>>
>> Thanks,
>>
>> -Jason
>>
>>
>>
>>
>>     
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

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

Reply via email to