redirection/user authentication
Hey, folks. Having a bit of trouble setting up a basic application based user authentication on my site. I keep getting an error in mozilla-based browers, redirection limit for this URL exceeded, that sort of thing. In IE, it just won't load at all - eventually gives me a server unavailable error. I've been browsing through forum posts on this sort of problem, and it seems it's sometimes related to cflocation, though I haven't been able to find any sort of clear explanation. Anyway, here's my application.cfm code: cfsetting showdebugoutput=no cfapplication name=02133 sessionmanagement=Yes setclientcookies=Yes applicationtimeout=#CreateTimeSpan(0,0,3,0)# cfparam Name=Application.DSN Default=MassInc2 cfparam name=Request.Debug default= cfparam Name=Application.SearchCollectionName Default=02133 !--- check if user has logged out --- cfif IsDefined(Form.logout) cflogout cflocation url=/index.cfm /cfif !--- check if user is logged in --- cfset referrer = GetFileFromPath(CGI.Path_info) cfif referrer neq login.cfm cfif NOT IsDefined(cflogin) cflocation url=login.cfm cfabort /cfif /cfif What I'm looking for this to do is, if a user hasn't been logged in, send them along to login.cfm - unless, of course, they're already there. Any idea why I'm getting this redirection limit error when I try to call up any of the pages in this application? Thanks! ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:200223 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: redirection/user authentication
So I've now taken out the cflocation tag, and replaced it with this: cfsetting showdebugoutput=no cfapplication name=02133 sessionmanagement=Yes setclientcookies=Yes applicationtimeout=#CreateTimeSpan(0,0,3,0)# cfparam Name=Application.DSN Default=MassInc2 !--// set this equal to your IP address if yyou want to enter live debugging mode //--- cfparam name=Request.Debug default= cfparam Name=Application.SearchCollectionName Default=02133 !--- check if user has logged out --- cfif IsDefined(Form.logout) cflogout cflocation url=/index.cfm /cfif !--- check if user is logged in --- cfset referrer = GetFileFromPath(CGI.Path_info) cfif referrer neq login.cfm cfif NOT IsDefined(cflogin) cfinclude template=login.cfm cfabort /cfif /cfif I'm still getting the redirection limit exceeded problem even when I'm trying to load the login.cfm file - which ostensibly should mean that that last bit of code doesn't even run. This does seem like some sort of infite loop, but I can't figure out where it's located, now that I've taken out the cflocate tag. ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:200236 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: redirection/user authentication
I've tried a few more of the changes you guys suggested here: !--- check if user is logged in --- cfset currentlocation = GetFileFromPath(getBaseTemplatePath()) cfif currentlocation neq login.cfm cfif GetAuthUser() eq cfinclude template=login.cfm cfabort /cfif /cfif I've got the variable renamed (you're right, it is more clear this way). Instead of relying on a cflogin variable, I'm checking to see whether a user has been logged in with the GetAuthUser() function. I'm using the alternate method you suggested to get the file info. And I've got the cfinclude instead of cflocation. But I'm still getting the redirection limit exceeded error. ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:200240 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: redirection/user authentication
Ben - tried that as well. Login.cfm doesn't have any cflocation tags in it, and I've now removed all of them from the application.cfm file - but I'm still getting that URL redirection exceeded problem. Here's the whole file again, as altered: cfsetting showdebugoutput=no cfapplication name=02133 sessionmanagement=Yes setclientcookies=Yes applicationtimeout=#CreateTimeSpan(0,0,3,0)# cfparam Name=Application.DSN Default=MassInc2 !--// set this equal to your IP address if yyou want to enter live debugging mode //--- cfparam name=Request.Debug default= cfparam Name=Application.SearchCollectionName Default=02133 !--- check if user has logged out --- cfif IsDefined(Form.logout) cflogout /cfif !--- check if user is logged in --- cfset currentlocation = GetFileFromPath(getBaseTemplatePath()) cfif currentlocation neq login.cfm cfif GetAuthUser() eq cfinclude template=login.cfm cfabort /cfif /cfif Login.cfm is just a simple form, which on submission goes to a login2.cfm page with the cflogin code. But I'm getting stopped before I can start to load login.cfm. My knowledge gets more than fuzzy when you start getting into sessions and cookies and such - is there a problem with the code I've got at the top of my application.cfm file? There's a parent directory above the one where I'm locating this application, and that also has an application.cfm file - but it's just session activation, no cflocation tags or any other funny business. Would that be causing any problems? ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:200253 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: redirection/user authentication
Mike - it would be great if you could show me a form-based login that actually works! I usually do make my forms self-submitting but decided to keep everything seperate here, because I thought it would make it easier to figure out where I was going wrong. In my original version of this code, I did also have the actual login taking place in the application file - but moved it to a seperate file, again, so that I could get a clearer idea of what was causing the redirection problem. Since I know now that it's NOT the cflogin block, I can probably put it back into the application file - once I know what IS causing the error! ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:200258 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: redirection/user authentication
FYI, I've got it working!! Thanks very much for all your help, everyone! ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:200269 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Making form results XML-compatible
I'm trying to make sure that the data for an RSS feed I'm running is XML-legal, but I'm getting errors because XMLFormat only replaces a handful of special characters, and because my data is mostly blocks of text, I get a lot of funky Word special quotation marks and apostrophes. How can I make sure that these characters are either filtered out when a user submits text through a form or when I'm generating my XML? Jack ~| Special thanks to the CF Community Suite Silver Sponsor - RUWebby http://www.ruwebby.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185956 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Making form results XML-compatible
If you want to get rid of all Word's weird chars you could try this UDF: http://www.cflib.org/udf.cfm?ID=725 Ok, so I tried out the UDF - basically, in my form submission template, I inserted the script and then used cfset Variable = #DeMoronize(FORM.Variable)# to try to clean up the text. But when I submit it, and then view the submitted text on my site, all my annoying word special characters have been replaced with a single annoying special character: รข#128; (don't know if that's going to show up or not, but you get the idea). I've tested the script when it's not going through the form - just using it to run through data from a query - and it worked fine. What am I screwing up here? cfset EditTitle = #DeMoronize(FORM.EditChronTitle)# cfset EditText = #DeMoronize(FORM.EditChronText)# !--- Format date for database compatability --- CFSET EditDate = #CREATEODBCDATETIME(EditChronDate)# CFQUERY name=EditRecordSet dataSource=#Application.DSN# Update Chronology_Table SET Title = '#EditTitle#', ChronDate = #EditDate#, Fulltext = '#EditText#' WHERE Chronology_Table.ID = #FORM.ChronID# /CFQUERY ~| Special thanks to the CF Community Suite Silver Sponsor - CFDynamics http://www.cfdynamics.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185976 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54