I am trying to pass an entry into log file while authentication the user.
I am using <cflogin> tag for this
But only few times it records the entry. My code in application.cfm is like this,
<cfapplication name="appname" setclientcookies="yes">
<cflock scope="application" timeout=10 type="exclusive">
<cfset application.physicalPath = "C:\CFusionMX\wwwroot\test\">
<cfset application.url = "">
</cflock>
<cfif IsDefined("action") and action EQ "logout">
<cflogout>
<cfset message = "You have logged out">
</cfif>
<cflogin>
<cfif NOT IsDefined("cflogin")>
<cfinclude template="login.cfm">
<cfabort>
<cfelse>
<cfif cflogin.name IS "" OR cflogin.password IS "">
<cfset message = "There was a problem with either your Login Name or Password.<br>Please try again">
<cfinclude template="login.cfm">
<cfabort>
<cfelse>
<cfquery name="getlogin" datasource="test">
SELECT login, admin , sor
FROM members
WHERE
login = '#cflogin.name#'
AND password = '#cflogin.password#'
</cfquery>
<cfif #getlogin.RecordCount# GT 0>
<CFQUERY NAME="putlog" DATASOURCE="test">
INSERT INTO log (login,
tdate,
ttime,
type, referrer,
ip,
partno)
VALUES ('#getlogin.login#',
'#dateformat(now())#',
'#timeformat(now())#',
'L',
'#HTTP_REFERER#',
'#REMOTE_ADDR#',
' ')
</CFQUERY>
<cfif getlogin.admin EQ "Y">
<cfset userRoles = "user,admin">
<cfelse>
<cfset userRoles = "user">
</cfif>
<cfloginuser name="#cflogin.name#" password="#cflogin.password#" roles="#userRoles#"/>
<cfelse>
<cfinclude template="login.cfm">
<cfabort>
</cfif>
</cfif>
</cfif>
</cflogin>
Thanks in advance
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]