<!--- 
  Filename:     AdClick.cfm
  Created by:   Nate Weiss (NMW)
  Date Created: 2/18/2001
--->

<!--- Assuming we have shown an ad on the referring page --->
<CFIF StructKeyExists(SESSION.AdsOnPages, CGI.HTTP_REFERER)>
  <!--- What ad was last shown to this user on referring page? --->
  <CFSET AdFileName = SESSION.AdsOnPages[CGI.HTTP_REFERER]>
  
  <!--- 
    At this point, you might record the "click" in database 
    and then redirect the user to the appropriate site via
    the <CFLOCATION> tag.  Here, we will simply output the 
    ad that the user clicked on, just to prove the concept.
  --->
  <CFOUTPUT>
    You just came from: #CGI.HTTP_REFERER#<BR>
    You got here by clicking on the <B>#AdFileName#</B> ad.
  </CFOUTPUT>

<!--- If "KeyExists" fails, we don't know what ad was shown --->
<CFELSE>
  We don't have any ad on record for you.  Perhaps you didn't 
  come here after seeing an ad, or your session timed out. 
</CFIF>