hahahaha
EGGS FOR EVERYONE :P
anyway, never one to back down from a challenge.........
Now, CF doesnt let you set a PATH value for the cookie using the rest of
the attributes, so it has been omitted. Also, you cant use CFLOCATION
cause the cookies wont get stored, hence the JavaScript redirect
///////////////////////////////////////////////////////////////////
<cffunction name="bake_cookie" output="No">
<cfcookie name="CC_#VERSION#" value="#arguments[1]#"
expires="#dateadd('yyyy', COOKIE_EXPIRES, NOW())#">
</cffunction>
<cfscript>
// Configuration Settings
VERSION = "2.0";
WEBSITE_ID = "1234";
AT_SERVER = "www.mysite.com";
COOKIE_EXPIRES = 3;
HTTP_PROTOCOL = "http";
if ( CGI.HTTPS EQ "ON" ) {
HTTP_PROTOCOL = "https";
}
//SUBROUTINES
// Create a CC from scratch
function new_cc () {
var CC = arrayNew(2);
CC[1][1] = "QUERY_STRING";
CC[2][1] = "COOKIE_EXPIRES";
CC[3][1] = "HTTP_REFERER";
CC[4][1] = "SCRIPT_NAME";
CC[5][1] = "SERVER_NAME";
CC[6][1] = "PATH_INFO";
CC[1][2] = QUERY_STRING;
CC[2][2] = COOKIE_EXPIRES;
for (i = 3; i LTE 6; i = i + 1) {
CC[i][2] = CGI[CC[i][1]];
}
return hash_to_string(CC);
}
// receives a multi-dim array
// returns the CC string
function hash_to_string(CC) {
var CC_string = "";
var i = 1;
for (i=1; i LTE 5; i = i + 1) {
if ( CC[i][1] NEQ "") {
CC_string = listAppend(CC_string,
"#CC[i][1]#=#URLEncodedFormat(CC[i][2])#", "&");
}
}
return CC_string;
}
// Create a new client cookie
CC = new_cc();
// Store the cookie on client's machine
bake_cookie(CC);
</cfscript>
<cfoutput>
<script>
location.href =
"#HTTP_PROTOCOL#://#AT_SERVER#/#WEBSITE_ID#/track/visit/?CC_#VERSION#=#URLEncodedFormat(CC)#";
</script>
</cfoutput>
///////////////////////////////////////////////////////////////////
The things i do...*sigh
Regards
Steve Onnis
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Barry
Beattie
Sent: Wednesday, June 29, 2005 4:40 PM
To: CFAussie Mailing List
Subject: [cfaussie] RE: convert from asp
>> I got plenty of egg left over from my face it you want some:P
thanx, Steve, but I've usually got enough to put SunnyQueen out of
production...
and here was I thinking all that vbscript skill was redundant - pity you
can't delete useless memory like Johnny Mnemonic
Carl, I've got tons of ASP apps you could have a go at converting by
yourself to brush up your translation skills...ah, but I see you have your
own to do - Have fun!
cheers
barry.b
Steve Onnis
---
You are currently subscribed to cfaussie as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/