- see footer for list info -<
Paul

I'm not sure that you need the isDefined for form.entered_username. If
this is a form text field then it should be defined by virtue of
submitting the form.. so the len(trim() test should suffice?

Also... the cflocation to password.cfm on the first page... could this
be put as an else condition to go with the len(trim()) test... i.e. if
value for entered_username then do the stored proc... else take them
to the password page?

the isdefined for session logged in variable should suffice i think
unless anyone has any better ideas for this?

On 10/18/06, Paul Swingewood <[EMAIL PROTECTED]> wrote:
>- see footer for list info -<
So just to recap on this IsDefined thing .....

I do this ...

<cfset sp = "cfpages_Authenticate">
<!--- Has the user entered a username and is it not equal to "" --->
<cfif isDefined("form.entered_username") AND
Len(Trim(form.entered_username))>
       <cfstoredproc procedure="#sp#" datasource="#Application.BackendDSN#">
   <!--- Apllication ID --->
               <cfprocparam
     cfsqltype="cf_sql_varchar"
     value="#Application.ID#">
               <!--- LoginName --->
               <cfprocparam
     cfsqltype="cf_sql_varchar"
     value="#form.entered_username#">
               <!--- Password --->
               <cfprocparam
     cfsqltype="cf_sql_varchar"
     value="#form.entered_password#">
   <cfprocresult
     name="SP_Results">
       </cfstoredproc>

 <cfoutput>
               <cfif SP_Results.RecordCount LT 1>
                       <cffile action="Append"
               file="#application.AdminLog#"
               output="#DateFormat("#Now()#")#, #TimeFormat("#Now()#")# ACCESS
DENIED!  username = #trim(form.entered_username)#">
                       <!--- Kill the login --->
                       <cfset tmp2 = StructDelete(session, "loggedin")>
                       <cflocation url="password.cfm">
               <cfelse>
                       <cffile action="Append"
                               file="#application.AccessLog#"
                               output="#DateFormat("#Now()#")#, 
#TimeFormat("#Now()#")#,  LOGIN (SP)-
#SP_Results.usersname#">
                       <cfset session.loggedin="1">
                       <cfset session.user = "#SP_Results.UsersName#">
                       <cfset session.ID = "#SP_Results.UserIDPK#">
                       <cfset session.Role = "#SP_Results.FKRoleID#">
                       <!--- Is this a school? --->
                       <CFQUERY NAME= "GetSchoolInfo" 
DATASOURCE="#Application.SchoolsDSN#">
                               SELECT DFESNoFK
                               FROM tblSchools
                               WHERE SchoolName = '#Session.User#'
                       </CFQUERY>
                       <cfif GetSchoolInfo.RecordCount gt 0 >
                               <!--- Record match so this must be a school --->
                               <cfset session.DFESNo = GetSchoolInfo.DFESNoFK>
                       </cfif>

                       <cflocation url="../default.cfm?ID=1">
               </cfif>
       </cfoutput>
</cfif>

<!--- If you are here then a blank form was submitted --->
<!--- take the user back to the login page --->
<cflocation url="password.cfm">




I then use

<!--- Is user logged in ? --->
<cfif not isdefined("session.loggedin")>
<cflocation url="login/password.cfm">
</cfif>

On every page to check for login...

IS this OK or should I use the structKey thing ...?


Regards - Paul


>From: "Stephen Moretti" <[EMAIL PROTECTED]>
>Reply-To: Coldfusion Development <[email protected]>
>To: "Coldfusion Development" <[email protected]>
>Subject: Re: [CF-Dev] Grouping and formatting ...?
>Date: Mon, 16 Oct 2006 15:51:54 +0100
>
>>- see footer for list info -<
>On 16/10/06, Mark Smyth <[EMAIL PROTECTED]> wrote:
>>
>> >- see footer for list info -<
>>
>>Cheers for that Stephen
>>
>>I'll shut up then :)
>>
>
>heh heh - a mine of useless information thats me.... ;)
>_______________________________________________
>
>For details on ALL mailing lists and for joining or leaving lists, go to
>http://list.cfdeveloper.co.uk/mailman/listinfo
>
>--
>CFDeveloper Sponsors:-
>>- cfdeveloper Hosting provided by www.cfmxhosting.co.uk -<
>>- Lists hosted by www.Gradwell.com -<
>>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<


_______________________________________________

For details on ALL mailing lists and for joining or leaving lists, go to 
http://list.cfdeveloper.co.uk/mailman/listinfo

--
CFDeveloper Sponsors:-
>- cfdeveloper Hosting provided by www.cfmxhosting.co.uk -<
>- Lists hosted by www.Gradwell.com -<
>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<



--
Rich
_______________________________________________

For details on ALL mailing lists and for joining or leaving lists, go to 
http://list.cfdeveloper.co.uk/mailman/listinfo

--
CFDeveloper Sponsors:-
- cfdeveloper Hosting provided by www.cfmxhosting.co.uk -<
- Lists hosted by www.Gradwell.com -<
- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<

Reply via email to