![]() |
| application.cfc problem ... evolving question.... |
|
EricBourland
|
(This question has been evolving as I do research and try different solutions. If you are reading this -- thanks for your patience.)
Hello friends. I built a page called registration.cfm that allows users to register login information (name, username, password, email) which they can then use to log in to a session: http://www.guardianhelp.org/registration.cfm However when I point my browser to this page, the browser shows instead the content of another page, LoginForm.cfm: http://www.guardianhelp.org/LoginForm.cfm I believe this is b/c my application.cfc file tells registration.cfm to display the content of LoginForm.cfm rather than the registration.cfm content. In fact, any cfml file I put into the same directory as this application.cfc file shows the content of LoginForm.cfm! Frustrating. I am following code examples in the O'Reilly Programming ColdFusion MX book by Brooks-Bilson, and from MacroMedia MX7 by Forta and Camden. Any idea what's going on? I paste application.cfc below. I want registration.cfm to display the registration form fields ... not the login form fields. I don't want LoginForm.cfm to displace all of my other pages. I have a feeling I am missing a fundamental concept here. Very grateful for any ideas. Best from Eric <!--- Filename: Application.cfc Created by: Raymond Camden (ray@camdenfamily.com) Please Note: Executes for every page request ---> <cfcomponent output="false"> <!--- Name the application. ---> <cfset this.name="GuardianHelp"> <!--- Turn on session management. ---> <cfset this.sessionManagement=true> <cffunction name="onApplicationStart" output="false" returnType="void"> <!--- Any variables set here can be used by all our pages ---> <cfset APPLICATION.dataSource = "uva"> <cfset APPLICATION.companyName = "Guardian Help"> </cffunction> <cffunction name="onRequestStart" output="false" returnType="void"> <!--- If user is not logged in, force them to now ---> <cfif not isDefined("SESSION.auth.isLoggedIn")> <!--- If the user is now submitting "Login" form, ---> <!--- Include "Login Check" code to validate user ---> <cfif isDefined("FORM.UserLogin")> <cfinclude template="loginCheck.cfm"> </cfif> <cfinclude template="loginForm.cfm"> <cfabort> </cfif> <!--- Display our Site Header at top of every page ---> <cfinclude template="SiteHeader.cfm"> <cfreturn true> <!--- Display our Site Footer at top of every page ---> <cfinclude template="SiteFooter.cfm"> <cfreturn true> </cffunction> </cfcomponent> |
||||||||||||
|
|
|||||||||||||
|
EricBourland
|
Update: I understand that application.cfc includes an isDefined() test to check whether the isLoggedIn value is present. If isLoggedIn is not present, then the template LoginForm.cfm is called.
<cfif isDefined("FORM.UserLogin")> <cfinclude template="loginCheck.cfm"> </cfif> .. that is why, every time I try to view registration.cfm or any other CFM page, I get presented with LoginForm.cfm. But ... this is not useful, and I don't know how to circumvent it without ruining my own security measures. I want application.cfc to check for isLoggedIn. If the user is not logged in, I want him to be directed to LoginForm.cfm. If the user does not have a login username and password then I want her to be able to enter a username and password ... currently she cannot! Any ideas how I can fix this? I have been at this for about 12 hours straight. Very grateful for any help. Eric |
||||||||||||
|
|
|||||||||||||
| Sorry |
|
comprug
Forum Regular
|
Eric,
sorry I didn't post earlier. I was quite busy, and didn't have an immediate solution to this problem. First of all, I was just wondering about application.cfc. In your previous post you mentioned "application.cfm". Did you change it in order to combat the problem? I may be wrong, but could you advise what your directory structure is? ideally, you should have an application.cfc in the site root without the <cfif not isDefined("SESSION.auth.isLoggedIn")> stuff, as it will be applied to the whole application, and an application.cfc with it included in a subdirectory that will have the loginForm.cfm file. Hope this addresses your concerns. If you have any questions or concerns, feel free to email me at (my username) + gmail. |
||||||||||||
|
|
|||||||||||||
|
EricBourland
|
Dear Ben,
Thanks very much for your help. No worries about getting back to me ... I really appreciate your support. The solution you suggested did indeed work. In application.cfc I commented out the problematic markup:
I am concerned that this will allow users to simply bypass my login page, but I will cross that bridge when I come to it. To answer your other questions: 1. I did change from application.cfm to application.cfc, only b/c that's the new, modern way to do it in CFMX7. Also I like distinction between the cfm and cfc nomenclature.\ 2. All of my working CFM and CFC files are in a single directory that I call /uva/. I have subdirectories /temp/, /images/, and /docs/. I'm learning a lot about ColdFusion, and have found a very supportive environment at HostMySite. Have a great evening, Best from Eric |
||||||||||||||
|
|
|||||||||||||||
| Your Welcome |
|
comprug
Forum Regular
|
Eric, glad to hear everything's working fine for you. If you have any other questions or concerns, please post back, and I'd be glad to continue to help you with this issue. |
|||||||||||||
|
|
||||||||||||||
| application.cfc problem ... evolving question.... |
|
||
|


