Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map

The check.cfm file

Check.cfm is a file that is included at the start of most of the Cold Fusion scripts. It checks whether the user has logged on and sets the variable log accordingly. Other scripts check the value of log and amend their output to follow suit. The query also retrieves other information about the user, such as their name and email address.

irt.org logo

My First Forum - a bulletin board application

You are here: irt.org | Articles | Database | My First Forum - a bulletin board application

Published on: Thursday 8th April 1999 By: Andrew Shatwell

<CFSET log = 0>

<CFIF #isDefined("Fwho")#>
  <CFQUERY NAME="login" DATASOURCE="#MyDatabase#">
    SELECT * FROM Users WHERE Username = '#Fwho#'
  </CFQUERY>
  <CFIF #login.recordcount# eq 1>
    <CFSET log = 1>
  </CFIF>
</CFIF>

Fwho is the user's ID and is stored in a cookie when they first log on.

If the cookie doesn't exist then the user has not logged on. log = 0
If the ID stored in the cookie matches one in the database then the user has logged on. log = 1
If the ID stored in the cookie doesn't match the database then the user has not logged on. log = 0

Application.cfm

Each time Cold Fusion runs a script it searches the current directory and those above it for a file called application.cfm. If found, then this file is run first. It's beyond the scope of this document to go into great details about application.cfm, however some of its uses are:

<!-- Set the value of MyDatabase to be the name you published the database under -->
<CFSET MyDatabase="ForumDatabase">

Our application.cfm only has one entry. This sets a global variable, MyDatabase, to be the name that the database is published under. The value of this variable is used in all CFQUERY tags.

Back to Displaying the forums, or forward to Opening a group

Feedback on 'My First Forum - a bulletin board application'

View the author profiles.

What's New

How to do the impossible with Google Gears

Out and About


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 21st December 2007. Maintained by: Martin Webb
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.