Exporting data to Word with Cold Fusion
How to update/edit data using Cold Fusion
You are here: irt.org | Articles | Database | My First Forum - a bulletin board application [ previous next ]
Published on: Thursday 8th April 1999 By: Andrew Shatwell
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.
<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 |
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
Exporting data to Word with Cold Fusion
How to update/edit data using Cold Fusion