head	1.5;
access;
symbols;
locks
	root:1.5; strict;
comment	@# @;


1.5
date	2004.02.11.16.15.28;	author root;	state Exp;
branches;
next	1.4;

1.4
date	2003.11.06.01.44.06;	author root;	state Exp;
branches;
next	1.3;

1.3
date	2003.11.06.01.05.11;	author root;	state Exp;
branches;
next	1.2;

1.2
date	2003.11.05.22.50.50;	author root;	state Exp;
branches;
next	1.1;

1.1
date	2003.11.05.01.03.27;	author root;	state Exp;
branches;
next	;


desc
@Cookie parser OF DOOM
,
@


1.5
log
@prior to wind->M2 change
@
text
@<TITLE>COOKIE PARSER/VERIFIER of DOOM</TITLE
><trimlines>Verbosity <RANDOM separator=$>is high in vitamin C!$is so good for you!$makes you go blind!$keeps the terrorists away$is better than rotten cheese!$is a virtue unlike any other.$strengthens your teeth.$cleans the hard-to-get corners behind your sink.</RANDOM><BR>
Browser is <echo HTTP_USER_AGENT><BR>
<COMMENT><md5 quiet>testuser@@WI_01/1075635045_01012004123045:testuser@@WI_02/1070702613_06112003102333</md5><md5 quiet>MilkaKuhFleckenMitSpiegelEier</md5><md5digest></COMMENT>
<set variable=secret value=MilkaKuhFleckenMitSpiegelEier>

euro.real.com (and real.com) cookies right now: <insert cookies><BR>

<if  cookie=R1EuropeAuth_wind>
<COMMENT> *** Do not do all the work if cookie n'existent pas *** </comment>

R1EuropeAuth_wind cookie: <insert cookie=R1EuropeAuth_wind><BR>
<cset variable=fullcookie preparse><insert cookie=R1EuropeAuth_wind></cset>
<arraycadd preparse name=ray delim="|"><insert variable=fullcookie></arraycadd>
<cset variable=field0 preparse><arrayfetch name=ray index=0 encode=none></cset>
<cset variable=md5input preparse><arrayfetch name=ray index=1 encode=none></cset>
Username/entitlement fields: <insert variable=field0><BR>
MD5 verification string in cookie: <insert variable=md5input><BR>
<formoutput encode=none><md5 quiet>#field0#</md5>
<md5 quiet>#secret#</md5></formoutput>
<cset preparse variable=mymd5><md5digest></cset>
My calculated MD5 code: <insert variable=mymd5><BR>

<B><FONT size=+2><formoutput><if variable="mymd5 is #md5input#">
The MD5 signature is Good!   Wooooo Hoooo</if>
<else> The cookie MD5 hash sucks!  Back to the oven!</else></formoutput></font></b><BR>
<COMMENT>HAKHAK<set variable=field0 value="glomph#pig.quack.snot@@PHUCK_THE_BEAVER/1070702613_20031105102333"></COMMENT>
<arraycset preparse name=ray delim=":"><insert variable=field0 encode=none></arraycset>
<arraysize name=ray set=numprods>
<B><FONT size=+2>There are <insert variable=numprods> Product Entitlement Items in this damn cookie.</font></b><BR>
<COMMENT> The FOR loop of DOOM
<set variable=numprods value=1> </COMMENT>
<formoutput quote=$$$><for variable=loopcounter from=1 to=$$$numprods$$$>
<HR>
<formoutput><set variable=arrayptr expr="#loopcounter#-1"</formoutput><if not variable=arrayptr><set variable=arrayptr value="0"></if>
arrayptr variable is <insert variable=arrayptr><BR>
<formoutput><cset variable=firstentitle preparse><arrayfetch name=ray index=#arrayptr# encode=none></cset></formoutput>
entitlement string <insert variable=loopcounter> is <insert variable=firstentitle></BR>

<arrayclear name=entitle><arraycadd preparse name=entitle delim="@@"><insert variable=firstentitle></arraycadd>
<cset variable=username preparse><arrayfetch name=entitle index=0 encode=none></cset>

username for velocity-checking purposes is: <insert variable=username><BR>

<cset variable=proddate preparse><arrayfetch name=entitle index=1 encode=none></cset>
Product/datecode: <insert variable=proddate><BR>

<arraycset preparse name=entitle2 delim="/"><insert variable=proddate></arraycset>
<cset variable=prodcode preparse><arrayfetch name=entitle2 index=0 encode=none></cset>

Product code: <insert variable=prodcode><BR>
<cset variable=datecodes preparse><arrayfetch name=entitle2 index=1 encode=none></cset>

Date codes: <insert variable=datecodes><BR>

<arraycset preparse name=entitle3 delim="_"><insert variable=datecodes></arraycset>
<cset variable=cookieepoch preparse><arrayfetch name=entitle3 index=0 encode=none></cset>
Epoch time in cookie:  <insert variable=cookieepoch><BR>

Expressed in semi-normal terms: <formoutput><date unix_time=#cookieepoch#></formoutput><BR>

Epoch time now:  <rndate GMT></rndate><BR>
Expressed in semi-normal terms: <date><BR>

Difference between cookie-time and current time: <formoutput><rndate GMT add=-#cookieepoch#></formoutput><BR>
If the above number is negative, then we are good!<BR>
<cset preparse variable=diff><formoutput><rndate GMT add=-#cookieepoch#></formoutput></cset>
<COMMENT>diff is <insert variable=diff> <BR></COMMENT>
RXML evaluation:  <B><FONT size=+2><formoutput><if match="#diff# is -*"> cookie still valid! Luser "#username#" is entitled to see "#prodcode#" crap! (assuming MD5 eval is ok)</if>
<else>Your cookie is stale, throw it away!</else></formoutput></font></b><BR>

</for>
</formoutput>

</if><COMMENT> *** Cookie exists *** </COMMENT>
<else> <CENTER><H2>No cookie!   No cookie!</H2><BR>
<IMG SRC="http://www.blackjackinc.com/images/products/ihb_suckbigtime_b_ltblu.gif"></CENTER></ELSE>
</trimlines>
@


1.4
log
@some dumb test code, no worries
@
text
@d2 2
a3 1
><trimlines>Verbosity is high in vitamin C!<BR>
@


1.3
log
@works
..
@
text
@d26 1
a26 1

@


1.2
log
@prior to multivariable fun
@
text
@d1 2
a2 2
<trimlines><TITLE>COOKIE PARSER/VERIFIER of DOOM</TITLE>
Please excuse the verbosity!<BR>
d5 1
a5 1
<BR>
d7 4
a11 1
</trimlines>
a13 1
<HR>
d28 10
a37 2
<cset variable=firstentitle preparse><arrayfetch name=ray index=0 encode=none></cset>
first entitlement string is <insert variable=firstentitle></BR>
d39 1
a39 1
<arraycadd preparse name=entitle delim="@@"><insert variable=firstentitle></arraycadd>
d47 2
a48 2
<arraycset preparse name=entitle delim="/"><insert variable=proddate></arraycset>
<cset variable=prodcode preparse><arrayfetch name=entitle index=0 encode=none></cset>
d51 1
a51 1
<cset variable=datecodes preparse><arrayfetch name=entitle index=1 encode=none></cset>
d55 2
a56 2
<arraycset preparse name=entitle delim="_"><insert variable=datecodes></arraycset>
<cset variable=cookieepoch preparse><arrayfetch name=entitle index=0 encode=none></cset>
d71 2
d74 4
@


1.1
log
@Initial revision
@
text
@d21 1
a21 1
<formoutput><if variable="mymd5 is #md5input#">
d23 1
a23 1
<else> The cookie sucks!  Back to the oven!</else></formoutput><BR>
d58 2
a59 2
RXML evaluation:  <formoutput><if match="#diff# is -*"> cookie still valid! Luser is entitled to see #prodcode# crap!</if>
<else>Your cookie is stale, throw it away!</else></formoutput><BR>
@