ColdFusion Tips and Tutorials

ColdFusion Tips and Tutorials. Tips on ColdFusion, AJAX, CSS, JavaScript, HTML, Design, and more.

CFUnited Developer Conference 2010
Use this code TIPSCUST to get $100 off your registration @ CFUnited! We'll see you There!


ColdFusion Tips
Page 1 2 3
148 ColdFusion, Ajax, FuseBox, Tips, and Tut
147 Included Point of View
146 Javascript - OnFocus
145 Nathan's Rules of Professional Web Desig
144 Universal Server-Side Check | Bandwidth
143 Meeting Schedule | Identification Sessio
142 Breaking Frames Without Javascript
141 Unreal Forms
140 Screen Resolution
139 Human Help
138 Better Server-Side Validation
137 Automatic Server-Side Validation
136 Regular Expression Laboratory,ColdFusion
135 Rank-Ordered Site Search
134 Building Cryptograms
133 Well-Formed Includes
132 Grouping Families for Visits
131 Display Families on a Map Grid
130 Slide Shows
129 Determine Your Database Engine
128 ColdFusion in Context: Maxlength Lies
127 Something Extra
126 Parsing Database Structure from Data Def
125 Valid Values Maintenance
124 Print 1
123 Hide Session Id
122 Downsizing Data to Access
121 Time to Load a Page, FuseBox 4
120 Order and Rank by Subset
119 Warn through E-mail & Update on Paste Sp
118 Paste Spreadsheets, ColdFusion Component
117 Review Files Having Fixed-Length Fields
116 Organized Help
115 Sequence Slider
114 Bad Bits
113 Logical Deduction
112 Whiteout
111 Forced Navigation
110 Managing Permissions
109 Time Travel
108 Test First
107 Get Distance Between Map Coordinates
106 Validating Checkboxes
105 Matrix Manipulation
104 Field Help
103 Fake Object Not Found
102 Rank Order Correlation Coefficient
101 From Calling Pairs to Calling Tree
100 Posting Notice
99 Logout Persuasion
98 Release Session Memory
97 Use Identically Named Fields
96 Web Bug
95 Password Generation
94 Core Queries
93 Use CFFTP
92 Insert, Update, and Delete
91 Stack
90 T-Value
89 Bulk Data Entry and E-mail Validation
88 Quick Reset
87 Design 1
86 Use CFFTP
85 Support Login with AutoPost
84 Login and Site Protection
83 XY Graphs in a Graphing Calculator
82 Read Encrypted Files
81 Showing Progress
80 Frugal Cross-Browser Javascript
79 Tabbed Folders
Page 1 2 3



Custom Search
ColdFusion TIPS PLUS


Issue 00096 http://www.cftipsplus.com

I. My Comments

II. ColdFusion In Context: Web Bug
By R. Martin Ladner
martin.ladner@knology.net



See our sponsors at the bottom of this e-mail.

I. Comments:


Keep Coding,
Nathan Stanford
http://www.cftipsplus.com

If you have suggestions for articles send them to us.
If you would like to write for cftipsplus.com
send us an email to:

admin@cftipsplus.com

IF YOU WANT TO BE AN AUTHOR SEND IN YOUR COLDFUSION TIPS.

Remember this is a great way to get your name known in the
ColdFusion Community.



Advanced, Intensive ColdFusion Training!

Visit this site. If you have plans to get training here is a company that provides Advanced, Intensive ColdFusion Training. Check them out.

http://www.coldfusiontraining.com/index.cfm?ref=cftipsplus




II. ColdFusion in Context: Web Bug
By R. Martin Ladner
martin.ladner@knology.net



Suppose you want to provide browser statistics for someone who uses a "dumb" Web host, but you don't want to be deeply involved in writing pages for or managing that site. A Web bug can help.
First, let's clarify things. This tip will not tell you how to retrieve the content of someone's E-mail (through an exploit of the same name). This tip explores possibilities of a technique for limited communication with a page or document from possibly another domain.

Overview
The overall technique presented here is to designate a ColdFusion page as the source for an image or sound, have that page do something useful in the background, and then have that page send content that it has marked as an image or sound as appropriate. You'll turn off all output except ColdFusion output, do your business, use the cfcontent tag to pass this non-text content, and enable normal output again. Everything useful must be accomplished prior to the cfcontent tag; because, the browser stops caring after the image has been received. Its job is done.

Log
Here's some simple code - call it log.cfm - that can be used to track the progress of sessions from the time an individual enters a site unthe profile of sessions an individual's progress through a site. Because no expiration date is given to the cookie, it will vanish when the user closes the browser, but a logical session can be inferred from the data, nevertheless. (Commercial applications typically set a "permanent" cookie which they eventually associate with a userid if a user actually logs into your site.)
It performs the functions named in the overview. First, it enables ColdFusion output only. Then, it checks to see if the cookie identifying a session exists. If not, it sets it to a unique value using the createUUID function. It then gathers information for the log: this ID, the IP address, the full name by which this link was called, any more information following a question mark in that URL (if anything), and the current date and time. In determining the current date/time, it sets a variable to the current date and time first so that the time won't be seconds behind the date. It spits all this information into a log, displays an image, and turns normal output back on. Note that the content type must be appropriate for the content: gif for gif, jpeg for jpg, and so forth.


<cfsetting enablecfoutputonly="yes">
<cfif not isDefined("cookie.webbug")>
<cfcookie name="webbug" value="#createUUID()#">
</cfif>
<cfset id="#cookie.webbug#">
<cfset ip="#cgi.remote_addr#">
<cfset link="#cgi.script_name#">
<cfset more="#cgi.query_string#">
<cfset dt=now()>
<cfset when="#dateformat(dt)# #timeformat(dt)#">
<cfset doline="#id#:#ip#:#link#:#more#:#when#">
<cffile action="append" file="d:\mysite\webbug\log.txt" output="#doline#" addnewline attributes="normal">
<cfcontent type="image/jpeg" file="d:\mysite\webbug\world3.jpg">
<cfsetting enablecfoutputonly="no">

Embed
Now embed calls to this log as "image" requests in normal pages. Each call will look something like this. It looks quite ordinary except that the URL ends in .cfm instead of .gif or .jpg.

<img src="http://mysite.com/webbug/log.cfm">

Mysteries
The idea behind logging the URL (with extra path information) and the query string (everything after the question mark) is to let the calling site provide more information if desired. For example, the query string or extra path information (or both) could be deliberately varied by the maintainer when adding the call. (A call to log.cfm?page=home would work just as well as a plain call to log.cfm.)

When you run this code, it works. However, it winds up creating a cookie that is only noticed by log.cfm, and then only in the context of the call. If you try to see the cookie from the page that called log.cfm, it won't be there. If you try to see the cookie from the site that hosts log.cfm, it won't be there, either. It is as if this cookie can only be seen in the cross-domain context in which it was set. If a user browses multiple sites containing this call to log.cfm, log.cfm will give each site a separate cookie. This quirk makes it hard to envision more useful roles for this Web bug. It can track sessions for a single site, but it doesn't lend itself yet to tracking the same user across different sites.

Determine workarounds for its apparent limitations, and then let us know what you've done.

=Marty=



SPONSOR ADS:
This e-mail is sponsored by the following ads.

Sponsored Ad



IT'S A WEB DEVELOPER'S DREAM COME TRUE

The book on Aestiva's web-based development engine
is here. Build web-based text editiors in ten lines
or less. Build shopping carts with a couple dozen
lines of code. Build database-driven apps in about
the time it takes you to do your laundry! Get the
book ADVANCED WEB SITES MADE EASY. For more info
please visit:

http://dev.aestiva.com/amazon/htmlostips.html


Sponsored Ad


Looking for other development resources?
Visit http://www.htmlostips.com, a site dedicated
to HTML/OS, a the next generation development
environment that many are saying is the next
generation to Java.

Sponsored Ad


Publisher and Creator:
Nathan Stanford,
admin@cftipsplus.com
http://www.cftipsplus.com

Macromedia and ColdFusion are U.S. registered trademarks.


Copyright (c) 2000 - 2001 CFTIPSPLUS.COM and NSND.COM
Permission is granted to circulate this publication via
MANUAL forwarding by email to friends provided that the text is
forwarded in its entirety and no fee is charged.

Photo of Nathan Stanford
Nathan Stanford
LinkedIn

R. Marty Ladner's
Site