Under Construction!

Click for Home

What you can do with cookies...

I use one cookie in the whole of my application.  It's role is to make sure the user has logged into the system and if not, make them go to the log in page.  This is how you can handle security in a cold fusion application.  The following code is on every page of my application.  The pitfall here is that if I forget to construct my page with this code at the top, then it will compromise the security of my system.  Login pages are useful, because you can set up all the variables for a user at a single point of entry and direct them to a particular path depending on their information.

 <CFIF IsDefined("Cookie.Login_cookie")>
    <CFIF #Cookie.Login_cookie# IS NOT "has_logged_in">
     <CFLOCATION URL="login.cfm">
     </CFIF>
    <CFELSE>
 <CFLOCATION URL="login.cfm">
</CFIF> 

The first line is very helpful.  It checks weather a variable exists or not.  Keep it in mind if you are having problems passing variables from a form where a user hasn't filled some information in or hasn't checked a checkbox.  Information on CFLOCATION is in the cfdocs.


UPDATE...

Thanks to D. LeGate who pointed out that if you are reusing code on every page that you should include it in your application.cfm page.  Therefore, the information is loaded eveytime you load a page in that directory or any directory within.  This saves the programmer from making any mistakes that my jeopardize the security of the application.  The only concern is that you have to put your login page in another directory or you will be put into a loop before your login is verified.


Style Sheets...

The other line I have at the top of my pages besides a brief description of each page is the following one:

<head>
<link rel="stylesheet" type="text/css" href="default.css">
</head>

I use cascading style sheets in my application to control the style of all my pages.  The only problem I find with this is that it limits what you can do to text within certain tags.  For instance you cannot change the color of text within a td tag if it is defined in the cascading style sheet.  If you can and I don't know about this, please tell me how.  Another problem using css is that the CFTABLE tags are formatted for Times New Roman font and any other font ruins the layout.

Information on Cascading Style Sheets can be found on the following links:

http://html.miningco.com/msubcss.htm

Continue to Next Page                                                    Previous Page


This page hosted by Get your own Free Homepage
 

 
1