Guest_imported
New member
- Jan 1, 1970
- 0
Hello, I have tried to exercise due diligence before bothering anybody. I have read all of the threads that seem to deal with session or client management but I am still a bit unclear. I want to create a basic login system where a user needs to login before accessing a set of pages. I understand that I need to have something like the following in application.cfm:
<CFAPPLICATION NAME="MyApp"
SESSIONMANAGEMENT="YES"
CLIENTMANAGEMENT="YES"
SETCLIENTCOOKIES="YES"
SESSIONTIMEOUT="#CreateTimeSpan(0,0,20,0)#"
APPLICATIONTIMEOUT="#CreateTimeSpan(2,0,0,0)#">
<CFSET APPLICATION.ADDTOKEN = "CFID=#client.cfid#&CFTOKEN=#client.cftoken#">
I also am fine with initially validating a login from the actual login page (ie. checking the provided username/password against these in my database. My question is what do I put at the top of all "protected" pages to ensure that the user is indeed logged in and has not timed out. If I merely check that CFID, for example, IsDefined it would be easy for anyone to append the variable CFID (set to anything) to the URL and access the page. I know that I am missing something basic here. Please Help! Also, is my application.cfm code appropriate? Thanks so much!
<CFAPPLICATION NAME="MyApp"
SESSIONMANAGEMENT="YES"
CLIENTMANAGEMENT="YES"
SETCLIENTCOOKIES="YES"
SESSIONTIMEOUT="#CreateTimeSpan(0,0,20,0)#"
APPLICATIONTIMEOUT="#CreateTimeSpan(2,0,0,0)#">
<CFSET APPLICATION.ADDTOKEN = "CFID=#client.cfid#&CFTOKEN=#client.cftoken#">
I also am fine with initially validating a login from the actual login page (ie. checking the provided username/password against these in my database. My question is what do I put at the top of all "protected" pages to ensure that the user is indeed logged in and has not timed out. If I merely check that CFID, for example, IsDefined it would be easy for anyone to append the variable CFID (set to anything) to the URL and access the page. I know that I am missing something basic here. Please Help! Also, is my application.cfm code appropriate? Thanks so much!