Skip to content

Instantly share code, notes, and snippets.

@robertmorel-uk
Last active January 22, 2020 15:58
Show Gist options
  • Save robertmorel-uk/5e90ef76a08d57f159ca79da64a8ec34 to your computer and use it in GitHub Desktop.
Save robertmorel-uk/5e90ef76a08d57f159ca79da64a8ec34 to your computer and use it in GitHub Desktop.
Mura - prevents bots from starting long sessions in Mura /Coldfusion
<!---Place in application.cfc--->
<!--- This checks if a cookie is created, for bots this will return false and use the low session timeout --->
<cfif StructKeyExists(cookie, "cfid" ) or StructKeyExists(cookie, "jsessionid" )>
<cfset this.sessiontimeout=CreateTimeSpan(0,0,30,0) />
1111
<cfelse>
22222
<cfset this.sessiontimeout=CreateTimeSpan(0,0,0,2) />
</cfif>
<!---Script based--->
<cfscript>
if ( structKeyExists(cookie, "cfid") or structKeyExists(cookie, "jsessionid") ) {
this.sessiontimeout = CreateTimeSpan(0,0,30,0);
writeDump("333333");
} else {
this.sessiontimeout = CreateTimeSpan(0,0,0,2);
writeDump("444444");
}
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment