Application.cfc question
Here's the background... We have all of our requests going through the index.cfm in the root and depending on variable values, they get directed, via cfincludes, to subfolders. My question is how do I get the application.cfc in the subfolder to run? The application.cfc in the root is getting run, but it appears that the one in the subfolder is not. Each sub-folder contains a separate application with a unique name and the application.cfc has application specific variables in it. The application.cfc in the subfolder is set to extend the one in the root. Eric ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357129 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Application.cfc question
to get the application.cfc in the subfolder to run, then your original request would have to be to the subfolder. CF bases which application.cfc to fire upon the originating request, then travels up the tree til it finds one (not down, as you are trying to do) Steve 'Cutter' Blades Adobe Community Professional Adobe Certified Expert Advanced Macromedia ColdFusion MX 7 Developer http://cutterscrossing.com Co-Author Learning Ext JS 3.2 Packt Publishing 2010 https://www.packtpub.com/learning-ext-js-3-2-for-building-dynamic-desktop-style-user-interfaces/book The best way to predict the future is to help create it On 11/25/2013 12:30 PM, Eric Roberts wrote: Here's the background... We have all of our requests going through the index.cfm in the root and depending on variable values, they get directed, via cfincludes, to subfolders. My question is how do I get the application.cfc in the subfolder to run? The application.cfc in the root is getting run, but it appears that the one in the subfolder is not. Each sub-folder contains a separate application with a unique name and the application.cfc has application specific variables in it. The application.cfc in the subfolder is set to extend the one in the root. Eric ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357130 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: Application.cfc question
I would tend to agree that you cannot do it this way because the application.cfc fires on first request. If you can use IIS (or Apache) to do your redirect before the application.cfc fires you should be able to get the ones in the subfolders to fire first, then do an include at the top of each to include the original application.cfc file to add the missing data... but I'd probably not call the one in the root application.cfc then... probably something like global_var_include.cfm or something. Robert Harrison Director of Interactive Services Austin Williams Advertising I Branding I Digital I Direct 125 Kennedy Drive, Suite 100 I Hauppauge, NY 11788 T 631.231.6600 X 119 F 631.434.7022 http://www.austin-williams.com Blog: http://www.austin-williams.com/blog Twitter: http://www.twitter.com/austin_ ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357131 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
RE: Application.cfc question
That is what I was afraid of ;-) Thanks Steve! -Original Message- From: Steve 'Cutter' Blades [mailto:cold.fus...@cutterscrossing.com] Sent: Monday, November 25, 2013 12:34 PM To: cf-talk Subject: Re: Application.cfc question to get the application.cfc in the subfolder to run, then your original request would have to be to the subfolder. CF bases which application.cfc to fire upon the originating request, then travels up the tree til it finds one (not down, as you are trying to do) Steve 'Cutter' Blades Adobe Community Professional Adobe Certified Expert Advanced Macromedia ColdFusion MX 7 Developer http://cutterscrossing.com Co-Author Learning Ext JS 3.2 Packt Publishing 2010 https://www.packtpub.com/learning-ext-js-3-2-for-building-dynamic-desktop-st yle-user-interfaces/book The best way to predict the future is to help create it On 11/25/2013 12:30 PM, Eric Roberts wrote: Here's the background... We have all of our requests going through the index.cfm in the root and depending on variable values, they get directed, via cfincludes, to subfolders. My question is how do I get the application.cfc in the subfolder to run? The application.cfc in the root is getting run, but it appears that the one in the subfolder is not. Each sub-folder contains a separate application with a unique name and the application.cfc has application specific variables in it. The application.cfc in the subfolder is set to extend the one in the root. Eric ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357132 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Application.cfc question
Short answer is, its difficult if you want to inherit the methods of the root folder Application.cfc. Coldfusion allows for one Application.cfc to extend another, but only if the inherited Application.cfc isnt in the root directory of the site or has a mapping in the CF Admin ( i.e. -you cant use extends=Application.cfc) or it throws an error, thinking its calling itself. That said, you can either create a mapping, make your inherited Application.cfc part of a subdirectory so CF doesnt get confused or use inheritance from another component, along with the SUPER scope to do what you want to do. Ben Nadel has a nice tutorial on the subject: http://www.bennadel.com/blog/1179-Ask-Ben-Extending-Application-cfc-And-OnRequestStart-With-SUPER.htm HTH, Jon On Nov 25, 2013, at 1:30 PM, Eric Roberts ow...@threeravensconsulting.com wrote: Here's the background... We have all of our requests going through the index.cfm in the root and depending on variable values, they get directed, via cfincludes, to subfolders. My question is how do I get the application.cfc in the subfolder to run? The application.cfc in the root is getting run, but it appears that the one in the subfolder is not. Each sub-folder contains a separate application with a unique name and the application.cfc has application specific variables in it. The application.cfc in the subfolder is set to extend the one in the root. Eric ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357133 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Application.cfc question
could you not have 1 application.cfc which simply calls different methods/includes according to the path in the URL. I have never tried it, and it would be bad practice and only a temp solution (others will swear for my suggesting this), but perhaps a quick fix would be to have the root application.cfc include a child application.cfc. or in your OnRequestStart, you test the URL and include a settings file from required sub-dir in the URL path, if the path has changed, reload the application. On Mon, Nov 25, 2013 at 6:45 PM, Eric Roberts ow...@threeravensconsulting.com wrote: That is what I was afraid of ;-) Thanks Steve! -Original Message- From: Steve 'Cutter' Blades [mailto:cold.fus...@cutterscrossing.com] Sent: Monday, November 25, 2013 12:34 PM To: cf-talk Subject: Re: Application.cfc question to get the application.cfc in the subfolder to run, then your original request would have to be to the subfolder. CF bases which application.cfc to fire upon the originating request, then travels up the tree til it finds one (not down, as you are trying to do) Steve 'Cutter' Blades Adobe Community Professional Adobe Certified Expert Advanced Macromedia ColdFusion MX 7 Developer http://cutterscrossing.com Co-Author Learning Ext JS 3.2 Packt Publishing 2010 https://www.packtpub.com/learning-ext-js-3-2-for-building-dynamic-desktop-st yle-user-interfaces/book The best way to predict the future is to help create it On 11/25/2013 12:30 PM, Eric Roberts wrote: Here's the background... We have all of our requests going through the index.cfm in the root and depending on variable values, they get directed, via cfincludes, to subfolders. My question is how do I get the application.cfc in the subfolder to run? The application.cfc in the root is getting run, but it appears that the one in the subfolder is not. Each sub-folder contains a separate application with a unique name and the application.cfc has application specific variables in it. The application.cfc in the subfolder is set to extend the one in the root. Eric ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357134 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Application.cfc question
If the purpose is code reuse, another possibility might be putting all logic into templates or other cfc. Then have both application.cfc call the required functionality through includes or method calls. Somewhat like a shared library. Byron Mann Lead Engineer Architect HostMySite.com On Nov 25, 2013 1:31 PM, Eric Roberts ow...@threeravensconsulting.com wrote: Here's the background... We have all of our requests going through the index.cfm in the root and depending on variable values, they get directed, via cfincludes, to subfolders. My question is how do I get the application.cfc in the subfolder to run? The application.cfc in the root is getting run, but it appears that the one in the subfolder is not. Each sub-folder contains a separate application with a unique name and the application.cfc has application specific variables in it. The application.cfc in the subfolder is set to extend the one in the root. Eric ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:357135 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Application.cfc question
Just curious: can anyone tell a bit more on how exactly Application.cfc is executed? With normal cfc's I believe that the code above the first method runs only when a new instance of the cfc is created, or when the cfc is invoked as a static component. It seems a bit strange to me that the cfif isDefined(url.reloadConfig) AND (isBoolean(url.reloadConfig) AND url.reloadConfig) cfset onApplicationStart() /cfif cfif isDefined(url.reloadSession) AND (isBoolean(url.reloadSession) AND url.reloadSession) cfset onSessionStart() /cfif are even executed. Does this mean that a new instance of Application.cfc is created for every request, or that it is invoked statically? I would have expected that one instance is shared across requests within an application. Martijn van der Woud Move both cfif blocks to the onRequestStart() method so they run a little bit later. Jochem ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:315836 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Application.cfc question
I don't know the exact, internal details, but application.cfc is called on each request and knows ONLY about the current request. Other than putting data into scopes such as application, sesssion or server, nothing is kept from one request to another, within application.cfc. In this respect, application.cfc is the same as application.cfm. Mike _ From: Martijn van der Woud [mailto:[EMAIL PROTECTED] Sent: Mon 11/24/2008 1:31 PM To: cf-talk Subject: Re: Application.cfc question Just curious: can anyone tell a bit more on how exactly Application.cfc is executed? With normal cfc's I believe that the code above the first method runs only when a new instance of the cfc is created, or when the cfc is invoked as a static component. It seems a bit strange to me that the cfif isDefined(url.reloadConfig) AND (isBoolean(url.reloadConfig) AND url.reloadConfig) cfset onApplicationStart() /cfif cfif isDefined(url.reloadSession) AND (isBoolean(url.reloadSession) AND url.reloadSession) cfset onSessionStart() /cfif are even executed. Does this mean that a new instance of Application.cfc is created for every request, or that it is invoked statically? I would have expected that one instance is shared across requests within an application. Martijn van der Woud Move both cfif blocks to the onRequestStart() method so they run a little bit later. Jochem ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:315858 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Application.cfc question
A new instance of Application.cfc is created and used on each request, which is why the code above the first method runs each time. mxAjax / CFAjax docs and other useful articles: http://www.bifrost.com.au/blog/ 2008/11/25 Martijn van der Woud [EMAIL PROTECTED]: Just curious: can anyone tell a bit more on how exactly Application.cfc is executed? With normal cfc's I believe that the code above the first method runs only when a new instance of the cfc is created, or when the cfc is invoked as a static component. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:315864 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Application.cfc question
Hi - I'm trying to use application.cfc on a new app I'm building and I'm having a strange occurrence. I'm sure it's just because I'm not as familiar with it as application.cfm, but I am trying to 'avoid' just switching back to application.cfm. Here's the issue: I have the following code. When I try to execute my URL with the reloadConfig=yes parameter, The app fails on the first line of the onSessionStart() function with 'application.datasource does not exist.' Since onSessionStart is called AFTER onApplicationStart(), clearly, the cfsets that set application.datasource occur before that line of code. Any ideas? cfcomponent output=false cfset this.name = zarts_tag_prod cfset this.SessionManagement = true cfset this.sessionTimeout = createTimeSpan(7,0,0,0) cfset this.ApplicationTimeout = createTimeSpan(30,0,0,0) cfif isDefined(url.reloadConfig) AND (isBoolean(url.reloadConfig) AND url.reloadConfig) cfset onApplicationStart() /cfif cfif isDefined(url.reloadSession) AND (isBoolean(url.reloadSession) AND url.reloadSession) cfset onSessionStart() /cfif cffunction name=OnApplicationStart access=public returntype=boolean cfset application.datasource = zarts_tag cfset application.from_email = [EMAIL PROTECTED] cfset application.developer = [EMAIL PROTECTED] cfset application.baseURL = http://tag.zarts.com; cfset application.verify_page = verify.cfm cfset application.game_name = ZARTS TAG cfset application.authentication_cookie_name = cookie.authenticated cfset application.zarts_tag_from_email = [EMAIL PROTECTED] cfreturn true/ /cffunction cffunction name=onSessionStart cfset session.security = createObject(component,com.security).init(application.datasource) cfset session.user = createObject(component,com.user).init() cfset session.isAuthorized = false /cffunction /cfcomponent ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:315801 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Application.cfc question
On Sat, Nov 22, 2008 at 8:38 AM, Dave Phillips wrote: I have the following code. When I try to execute my URL with the reloadConfig=yes parameter, The app fails on the first line of the onSessionStart() function with 'application.datasource does not exist.' Since onSessionStart is called AFTER onApplicationStart(), clearly, the cfsets that set application.datasource occur before that line of code. Any ideas? cfcomponent output=false cfset this.name = zarts_tag_prod cfset this.SessionManagement = true cfset this.sessionTimeout = createTimeSpan(7,0,0,0) cfset this.ApplicationTimeout = createTimeSpan(30,0,0,0) cfif isDefined(url.reloadConfig) AND (isBoolean(url.reloadConfig) AND url.reloadConfig) cfset onApplicationStart() /cfif cfif isDefined(url.reloadSession) AND (isBoolean(url.reloadSession) AND url.reloadSession) cfset onSessionStart() /cfif Move both cfif blocks to the onRequestStart() method so they run a little bit later. Jochem ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:315802 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Application.cfc question
I ran into the same problem. I assign datasource in the application.cfm and then lose the connection string in the cfc. I believe the problem is that a cfc is intended to run in a different machine as thought it were a web service. As a result Cold Fusion does not carry the application state across the boundary even if it is on the same machine. It may be in a different process or a different thread. I do not know the cf internals well enough to know exactly why. That being said, I defined a datasource variable in the cfc and all went well. The other way to do it is to pass the application.datasource variable across as a function variable. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:315810 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Application.cfc question: Where would be the best place to put this code?
Losers are hammering my site with spam in the urls. The first line is what my url should look like. The second line is what I am getting from the spammers. http://www.mydomain.com/index.cfm?type=Specialtyspec=110 http://www.mydomain.com/index.cfm?type=Specialtyspec=http%3A%2F%2Fwww.north fans.ch%2Fforum%2Fadmin%2Fsettings%2Focoyo%2Fser%2F If I were to use the following code in Application.cfc, which function would be the best place to put it? Right now, I was thinking of placing it in onRequestStart. Any better ideas? The code would be simple an something like this: cfif cgi.query_string contains http://; cflocation url=http://www.mydomain.com; cfabort /cfif ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;192386516;25150098;k Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:306951 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Application.cfc question: Where would be the best place to put this code?
That would be the most logical place to put it. I'm not sure that a cfabort is the best bet though. Why not simply use a regex and just strip out the offending portion of the query string? Start with http and remove that, and everything after it. -Original Message- From: Che Vilnonis [mailto:[EMAIL PROTECTED] Sent: Friday, June 06, 2008 8:15 AM To: CF-Talk Subject: Application.cfc question: Where would be the best place to put this code? Losers are hammering my site with spam in the urls. The first line is what my url should look like. The second line is what I am getting from the spammers. http://www.mydomain.com/index.cfm?type=Specialtyspec=110 http://www.mydomain.com/index.cfm?type=Specialtyspec=http%3A%2F%2Fwww.north fans.ch%2Fforum%2Fadmin%2Fsettings%2Focoyo%2Fser%2F If I were to use the following code in Application.cfc, which function would be the best place to put it? Right now, I was thinking of placing it in onRequestStart. Any better ideas? The code would be simple an something like this: cfif cgi.query_string contains http://; cflocation url=http://www.mydomain.com; cfabort /cfif ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;192386516;25150098;k Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:306952 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Application.cfc question: Where would be the best place to put this code?
OnRequestStart would seem to be a good place for it. You might also override the Session timeout (if you're using sessions) so that these spam requests don't create a large number of dead sessions. You can set the timeout to 5 seconds or something before you do the redirect. Regards, Brian On Fri, Jun 6, 2008 at 9:14 AM, Che Vilnonis [EMAIL PROTECTED] wrote: Losers are hammering my site with spam in the urls. The first line is what my url should look like. The second line is what I am getting from the spammers. http://www.mydomain.com/index.cfm?type=Specialtyspec=110 http://www.mydomain.com/index.cfm?type=Specialtyspec=http%3A%2F%2Fwww.north fans.ch%2Fforum%2Fadmin%2Fsettings%2Focoyo%2Fser%2F If I were to use the following code in Application.cfc, which function would be the best place to put it? Right now, I was thinking of placing it in onRequestStart. Any better ideas? The code would be simple an something like this: cfif cgi.query_string contains http://; cflocation url=http://www.mydomain.com; cfabort /cfif ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;192386516;25150098;k Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:306953 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Application.cfc question: Where would be the best place to put this code?
Basically, I am trying to prevent auto generated 'error' emails from being sent to me 200+ times a day. What would the regex do? If I strip out the offending string, it will likely still be invalid and cause an error to be created. Good point on the cfabort though. Regards, Che -Original Message- From: Andy Matthews [mailto:[EMAIL PROTECTED] Sent: Friday, June 06, 2008 9:17 AM To: CF-Talk Subject: RE: Application.cfc question: Where would be the best place to put this code? That would be the most logical place to put it. I'm not sure that a cfabort is the best bet though. Why not simply use a regex and just strip out the offending portion of the query string? Start with http and remove that, and everything after it. -Original Message- From: Che Vilnonis [mailto:[EMAIL PROTECTED] Sent: Friday, June 06, 2008 8:15 AM To: CF-Talk Subject: Application.cfc question: Where would be the best place to put this code? Losers are hammering my site with spam in the urls. The first line is what my url should look like. The second line is what I am getting from the spammers. http://www.mydomain.com/index.cfm?type=Specialtyspec=110 http://www.mydomain.com/index.cfm?type=Specialtyspec=http%3A%2F%2Fwww.north fans.ch%2Fforum%2Fadmin%2Fsettings%2Focoyo%2Fser%2F If I were to use the following code in Application.cfc, which function would be the best place to put it? Right now, I was thinking of placing it in onRequestStart. Any better ideas? The code would be simple an something like this: cfif cgi.query_string contains http://; cflocation url=http://www.mydomain.com; cfabort /cfif ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;192386516;25150098;k Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:306955 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Application.cfc question: Where would be the best place to put this code?
Brian, w/regards to resetting the session timeout, would this work? cfif cgi.query_string contains http://; cfset session.urltoken = cflocation url=http://www.mydomain.com; /cfif Regards, Che -Original Message- From: Brian Kotek [mailto:[EMAIL PROTECTED] Sent: Friday, June 06, 2008 9:18 AM To: CF-Talk Subject: Re: Application.cfc question: Where would be the best place to put this code? OnRequestStart would seem to be a good place for it. You might also override the Session timeout (if you're using sessions) so that these spam requests don't create a large number of dead sessions. You can set the timeout to 5 seconds or something before you do the redirect. Regards, Brian On Fri, Jun 6, 2008 at 9:14 AM, Che Vilnonis [EMAIL PROTECTED] wrote: Losers are hammering my site with spam in the urls. The first line is what my url should look like. The second line is what I am getting from the spammers. http://www.mydomain.com/index.cfm?type=Specialtyspec=110 http://www.mydomain.com/index.cfm?type=Specialtyspec=http%3A%2F%2Fwww .north fans.ch%2Fforum%2Fadmin%2Fsettings%2Focoyo%2Fser%2F If I were to use the following code in Application.cfc, which function would be the best place to put it? Right now, I was thinking of placing it in onRequestStart. Any better ideas? The code would be simple an something like this: cfif cgi.query_string contains http://; cflocation url=http://www.mydomain.com; cfabort /cfif ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;192386516;25150098;k Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:306956 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Application.cfc question: Where would be the best place to put this code?
Well, the spammers had to get your page from somewhere...the page is likely only invalid because they're tacking on extra query params right? So removing the offending params might allow a valid request to get through. Remember that it's always possible that a legitimate person could have clicked a spammed link to get to your site. Why kill that legit request when you don't have to? -Original Message- From: Che Vilnonis [mailto:[EMAIL PROTECTED] Sent: Friday, June 06, 2008 8:24 AM To: CF-Talk Subject: RE: Application.cfc question: Where would be the best place to put this code? Basically, I am trying to prevent auto generated 'error' emails from being sent to me 200+ times a day. What would the regex do? If I strip out the offending string, it will likely still be invalid and cause an error to be created. Good point on the cfabort though. Regards, Che -Original Message- From: Andy Matthews [mailto:[EMAIL PROTECTED] Sent: Friday, June 06, 2008 9:17 AM To: CF-Talk Subject: RE: Application.cfc question: Where would be the best place to put this code? That would be the most logical place to put it. I'm not sure that a cfabort is the best bet though. Why not simply use a regex and just strip out the offending portion of the query string? Start with http and remove that, and everything after it. -Original Message- From: Che Vilnonis [mailto:[EMAIL PROTECTED] Sent: Friday, June 06, 2008 8:15 AM To: CF-Talk Subject: Application.cfc question: Where would be the best place to put this code? Losers are hammering my site with spam in the urls. The first line is what my url should look like. The second line is what I am getting from the spammers. http://www.mydomain.com/index.cfm?type=Specialtyspec=110 http://www.mydomain.com/index.cfm?type=Specialtyspec=http%3A%2F%2Fwww.north fans.ch%2Fforum%2Fadmin%2Fsettings%2Focoyo%2Fser%2F If I were to use the following code in Application.cfc, which function would be the best place to put it? Right now, I was thinking of placing it in onRequestStart. Any better ideas? The code would be simple an something like this: cfif cgi.query_string contains http://; cflocation url=http://www.mydomain.com; cfabort /cfif ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;192386516;25150098;k Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:306958 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Application.cfc question: Where would be the best place to put this code?
OK. If I were to use a regex, should I still place the code in onRequestStart and use a re-direct with cflocation? -Original Message- From: Andy Matthews [mailto:[EMAIL PROTECTED] Sent: Friday, June 06, 2008 9:44 AM To: CF-Talk Subject: RE: Application.cfc question: Where would be the best place to put this code? Well, the spammers had to get your page from somewhere...the page is likely only invalid because they're tacking on extra query params right? So removing the offending params might allow a valid request to get through. Remember that it's always possible that a legitimate person could have clicked a spammed link to get to your site. Why kill that legit request when you don't have to? -Original Message- From: Che Vilnonis [mailto:[EMAIL PROTECTED] Sent: Friday, June 06, 2008 8:24 AM To: CF-Talk Subject: RE: Application.cfc question: Where would be the best place to put this code? Basically, I am trying to prevent auto generated 'error' emails from being sent to me 200+ times a day. What would the regex do? If I strip out the offending string, it will likely still be invalid and cause an error to be created. Good point on the cfabort though. Regards, Che ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;192386516;25150098;k Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:306960 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Application.cfc question: Where would be the best place to put this code?
You could just set this.sessionTimeOut, but on further thought if you just redirect them to the home page then they'll just start a new session there. Maybe a better option (if you're sure these are spammers) is just to abort the request and be done with it? On Fri, Jun 6, 2008 at 9:30 AM, Che Vilnonis [EMAIL PROTECTED] wrote: Brian, w/regards to resetting the session timeout, would this work? cfif cgi.query_string contains http://; cfset session.urltoken = cflocation url=http://www.mydomain.com; /cfif Regards, Che -Original Message- From: Brian Kotek [mailto:[EMAIL PROTECTED] Sent: Friday, June 06, 2008 9:18 AM To: CF-Talk Subject: Re: Application.cfc question: Where would be the best place to put this code? OnRequestStart would seem to be a good place for it. You might also override the Session timeout (if you're using sessions) so that these spam requests don't create a large number of dead sessions. You can set the timeout to 5 seconds or something before you do the redirect. Regards, Brian On Fri, Jun 6, 2008 at 9:14 AM, Che Vilnonis [EMAIL PROTECTED] wrote: Losers are hammering my site with spam in the urls. The first line is what my url should look like. The second line is what I am getting from the spammers. http://www.mydomain.com/index.cfm?type=Specialtyspec=110 http://www.mydomain.com/index.cfm?type=Specialtyspec=http%3A%2F%2Fwww .north fans.ch%2Fforum%2Fadmin%2Fsettings%2Focoyo%2Fser%2F If I were to use the following code in Application.cfc, which function would be the best place to put it? Right now, I was thinking of placing it in onRequestStart. Any better ideas? The code would be simple an something like this: cfif cgi.query_string contains http://; cflocation url=http://www.mydomain.com; cfabort /cfif ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;192386516;25150098;k Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:306957 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Application.cfc question: Where would be the best place to put this code?
That makes sense to me. -Original Message- From: Che Vilnonis [mailto:[EMAIL PROTECTED] Sent: Friday, June 06, 2008 8:54 AM To: CF-Talk Subject: RE: Application.cfc question: Where would be the best place to put this code? OK. If I were to use a regex, should I still place the code in onRequestStart and use a re-direct with cflocation? -Original Message- From: Andy Matthews [mailto:[EMAIL PROTECTED] Sent: Friday, June 06, 2008 9:44 AM To: CF-Talk Subject: RE: Application.cfc question: Where would be the best place to put this code? Well, the spammers had to get your page from somewhere...the page is likely only invalid because they're tacking on extra query params right? So removing the offending params might allow a valid request to get through. Remember that it's always possible that a legitimate person could have clicked a spammed link to get to your site. Why kill that legit request when you don't have to? -Original Message- From: Che Vilnonis [mailto:[EMAIL PROTECTED] Sent: Friday, June 06, 2008 8:24 AM To: CF-Talk Subject: RE: Application.cfc question: Where would be the best place to put this code? Basically, I am trying to prevent auto generated 'error' emails from being sent to me 200+ times a day. What would the regex do? If I strip out the offending string, it will likely still be invalid and cause an error to be created. Good point on the cfabort though. Regards, Che ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;192386516;25150098;k Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:306962 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Application.cfc question: Where would be the best place to put this code?
OK. This is interesting. If I place the simple test code below in onRequestStart, I am *not* re-directed and I still get the error email and the error page displayed when a link like the one below is clicked. Why might this be happening? Is the error being processed first? onRequestStart always fires before onError, right? http://www.mydomain.com/index.cfm?type=selectModelmakeid=http%3A%2F%2Frabot nitsa.ru%2Fjoomla__%2Fadministrator%2Fbackups%2Farim%2Fzaf%2F cfif cgi.query_string contains http://; cflocation url=index.cfm /cfif -Original Message- From: Andy Matthews [mailto:[EMAIL PROTECTED] Sent: Friday, June 06, 2008 9:58 AM To: CF-Talk Subject: RE: Application.cfc question: Where would be the best place to put this code? That makes sense to me. -Original Message- From: Che Vilnonis [mailto:[EMAIL PROTECTED] Sent: Friday, June 06, 2008 8:54 AM To: CF-Talk Subject: RE: Application.cfc question: Where would be the best place to put this code? OK. If I were to use a regex, should I still place the code in onRequestStart and use a re-direct with cflocation? -Original Message- From: Andy Matthews [mailto:[EMAIL PROTECTED] Sent: Friday, June 06, 2008 9:44 AM To: CF-Talk Subject: RE: Application.cfc question: Where would be the best place to put this code? Well, the spammers had to get your page from somewhere...the page is likely only invalid because they're tacking on extra query params right? So removing the offending params might allow a valid request to get through. Remember that it's always possible that a legitimate person could have clicked a spammed link to get to your site. Why kill that legit request when you don't have to? ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;192386516;25150098;k Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:306963 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Application.cfc question: Where would be the best place to put this code?
Oops. Fixed it. Needed to add urldecode() to my conditional. -Original Message- From: Che Vilnonis [mailto:[EMAIL PROTECTED] Sent: Friday, June 06, 2008 10:12 AM To: CF-Talk Subject: RE: Application.cfc question: Where would be the best place to put this code? OK. This is interesting. If I place the simple test code below in onRequestStart, I am *not* re-directed and I still get the error email and the error page displayed when a link like the one below is clicked. Why might this be happening? Is the error being processed first? onRequestStart always fires before onError, right? http://www.mydomain.com/index.cfm?type=selectModelmakeid=http%3A%2F%2Frabot nitsa.ru%2Fjoomla__%2Fadministrator%2Fbackups%2Farim%2Fzaf%2F cfif cgi.query_string contains http://; cflocation url=index.cfm /cfif -Original Message- From: Andy Matthews [mailto:[EMAIL PROTECTED] Sent: Friday, June 06, 2008 9:58 AM To: CF-Talk Subject: RE: Application.cfc question: Where would be the best place to put this code? That makes sense to me. -Original Message- From: Che Vilnonis [mailto:[EMAIL PROTECTED] Sent: Friday, June 06, 2008 8:54 AM To: CF-Talk Subject: RE: Application.cfc question: Where would be the best place to put this code? OK. If I were to use a regex, should I still place the code in onRequestStart and use a re-direct with cflocation? -Original Message- From: Andy Matthews [mailto:[EMAIL PROTECTED] Sent: Friday, June 06, 2008 9:44 AM To: CF-Talk Subject: RE: Application.cfc question: Where would be the best place to put this code? Well, the spammers had to get your page from somewhere...the page is likely only invalid because they're tacking on extra query params right? So removing the offending params might allow a valid request to get through. Remember that it's always possible that a legitimate person could have clicked a spammed link to get to your site. Why kill that legit request when you don't have to? ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;192386516;25150098;k Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:306967 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
application.cfc question
I am switching an application.cfm to application.cfc. Im my application.cfm I defined a function that I used through out the web site. cfscript function replaceQuotes(arg) { return Replace(arg, '', ##34;, ALL); } /cfscript Now in the application.cfc I cannot place the function in onRequestStart I get an error. So now, to have this function available to the web site, I can just make a new function in application.cfc like this: cffunction name=replaceQuotes cfargument name=arg required=true cfreturn #Replace(arguments.arg, '', '##34;', 'ALL')# / /cffunction Right??? I just want to make sure I am doing this right and im not going to kill application.cfc. ~| Download the latest ColdFusion 8 utilities including Report Builder, plug-ins for Eclipse and Dreamweaver updates. http;//www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5adobecf8%5Fbeta Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:287204 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: application.cfc question
Plenty of ways to do this, but I'd probably create a utilities.cfc and then drop it into the application scope (in OnApplicationStart()). That way, anytime you want to use it on your site, you just call it that way. The added benefit is if you find you have more functions liek this that you may need, just drop them into utilities.cfc. On 8/27/07, Chad Gray [EMAIL PROTECTED] wrote: I am switching an application.cfm to application.cfc. Im my application.cfm I defined a function that I used through out the web site. cfscript function replaceQuotes(arg) { return Replace(arg, '', ##34;, ALL); } /cfscript Now in the application.cfc I cannot place the function in onRequestStart I get an error. So now, to have this function available to the web site, I can just make a new function in application.cfc like this: cffunction name=replaceQuotes cfargument name=arg required=true cfreturn #Replace(arguments.arg, '', '##34;', 'ALL')# / /cffunction Right??? I just want to make sure I am doing this right and im not going to kill application.cfc. ~| Check out the new features and enhancements in the latest product release - download the What's New PDF now http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:287207 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: application.cfc question
Plenty of ways to do this, but I'd probably create a utilities.cfc and then drop it into the application scope (in OnApplicationStart()). That way, anytime you want to use it on your site, you just call it that way. I concur with Crow - I was going to suggest exactly the same thing. You could add the function right in App.cfc, then use cfinvoke to call the method, but I feel for cleanliness App.cfc should just contain those native functions (onApplicationStart etc.). -- Josh ~| Create robust enterprise, web RIAs. Upgrade to ColdFusion 8 and integrate with Adobe Flex http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:287212 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
nested Application.cfc question
I am having a problem with nesting Application CFCs. I have an Application.cfc in the root directory with a call to onRequestStart, and in there I have a variety of variables set in the request scope. I have another Application.cfc in a sub directory that I built primarily to handle user authentication (the only files needing to be protected reside there, so I was going to set the authentication checks in that Application.cfc so it's only referenced when needed). I set it up so that this second Application.cfc extends the root Application.cfc by using the dot-notation mapping to the root Application - like extends=SharedSites.Site1.Application. In this file's onRequestStart function, I try and access the request scope variables set in the parent Application.cfc. I am getting errors saying these variables have not been set. This is a legacy application that I am converting over to Application.cfc, so I cannot unscope those variables, I have to use them in the request scope. Any guidelines or ideas? thanks -r _ Rob Barthle Contractor - Sr. Software Developer [EMAIL PROTECTED] 202-245-6484 ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:259526 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: nested Application.cfc question
I set it up so that this second Application.cfc extends the root Application.cfc by using the dot-notation mapping to the root Application - like extends=SharedSites.Site1.Application. In this file's onRequestStart function, I try and access the request scope variables set in the parent Application.cfc. I am getting errors saying these variables have not been set. That's not the way extension/inheritance works. When you created the new onRequestStart function in the child Application.cfc it replaced the one in the parent Application.cfc. To run the parents application.cfc you need to use CF's version of the super scope inside of the child. I think this would be super.onReqestStart() in side the child's onRequestStart, but I am not sure. -- Ian Skinner Web Programmer BloodSource www.BloodSource.org Sacramento, CA - | 1 | | - Binary Soduko | | | - C code. C code run. Run code run. Please! - Cynthia Dunning Confidentiality Notice: This message including any attachments is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender and delete any copies of this message. ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:259531 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: nested Application.cfc question
I found the super.onRequestStart() function not too long after I sent this. That fixed that problem, you were correct about it. Thanks, Ian. :) Now my problem is just making this work correctly! It seems to be ignoring some IF statements in the child onRequestStart function, and I'm noodling through that one now. Are there public examples of code around with this kind of setup that I could look at somewhere? I have to assume this is nowhere near rocket science, but I'm fairly new to CFC's. thanks -r _ Rob Barthle Contractor - Sr. Software Developer [EMAIL PROTECTED] 202-245-6484 -Original Message- From: CF-Talk [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 07, 2006 5:00 PM To: CF-Talk Subject: ColdFusion Talk (CF-Talk): Digest every hour ~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:259537 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4