This is what I typically do:

I have login.cfm that is a recursive page.
I have session.cfm that has 1 if statement in it:
         <cfif NOT IsDefined('session.whatever')>
                <cflocation url="login.cfm">
        </cfif>

I usually include this in my header.cfm or on the pages that I wish to
protect. I know that there maybe(are) 'better' ways to do this. But this has
worked for me every time.

----- Original Message -----
From: "Mike Miessen" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Tuesday, January 07, 2003 4:44 PM
Subject: stupid newbie tricks


> I am still trying to figure out the problem I have with my login
> scripts.
> I wrote this (copied actually) based on a tutorial located at
>
> http://tutorial8.easycfm.com/
>
> The author says these files all go in the same directory.  The file
> names are.
> - Application.cfm
> - login.cfm
> - login_process.cfm
> - members_only.cfm
>
> When I call Login.cfm the first thing that happens is application.cfm is
> processed and since I do not yet have session.allowin defined and the
> default is false it gives the "You must login" alert and sends me back
> to login.cfm which repeats the same result.  Oh goodie an endless error
> loop.
>
> In application.cfm I find the following code.
>
> <cfif session.allowin neq "true">
>       <cfif CGI.SCRIPT_NAME EQ "login.cfm">
>       <cfelseif CGI.SCRIPT_NAME EQ "login_process.cfm">
>       <cfelse>
>       <!--- this user is not logged in, alert user and redirect to the
> login.cfm page --->
>       <script>
>               alert("You must login to access this area!");
>               self.location="login.cfm";
>       </script>
>       </cfif>
> </cfif>
>
> As someone pointed out yesterday there are two else statements that
> don't seem to have an action associated with them.
>
>       <cfif CGI.SCRIPT_NAME EQ "login.cfm">
>       <cfelseif CGI.SCRIPT_NAME EQ "login_process.cfm">
>
> In the first else I want processing to stop (I believe) the second else
> (actually elseif) I don't think is needed but there it is.  I could get
> rid of the second else but what do I do to make the first else stop
> processing the error condition?
>
> I don't think I'm ready for certification unless it's to the funny farm.
>
>
>
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

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

Reply via email to