We have our first admin tool, but we don’t want the general public to see it!
Here are the topics that we’re going to cover in this article:
The Absence of ‘State’
Website Application Framework
Adding Logins to your Database
- Application.cfm
- OnRequestEnd.cfm
- Securing Your Application with <cflogin> <cfloginuser>
- Logging Out with <cflogout>
- Personalization with GetAuthUser()
- Security Roles with IsUserInRole()
By the end of this article you’ll have a secured portion of your website requiring a login & password combination and you will have established security roles based management system. Don’t forget to grab the source code too – it’s all included just for you!
If this is the first article you’re reading, you may want to check out all my previous ColdFusion articles because each one from the very first article helps build the website along the way that we will be using in this article. Each one builds upon the existing website from the previous article. If you see some code in this website that you are unfamiliar with, there is an article there to help you.
When you download the source-code for this article the zip file contains a ‘base’ code you can use to build what we discuss in the article as you read it and it also includes a ‘solution’ code which is a complete code solution from the article. You’ll need to create a ColdFusion Dreamweaver MX 2004 site for one or both of the code bases. I also use a MySQL 4.1 database which I always include a mysqldump file in the /db directory. You may want to restore the db and create a datasource named okctravel to make full use of this article. For more help, take a look at my second article about setting up the MySQL 4.1 database for use with ColdFusion.