ColdFusion Tutorial

Case Sensitive passwords

How to create Case Sensitive passwords in ColdFusion?

This is done by using the Compare function.

The Compare function performs a case-sensitive comparison of two strings and returns:
-1 if string1 is less then string2
0 if string1 is equal to string2
1 if string is greater then string2


Let?s try this on a simple login form.

login.cfm

<form action="login_act.cfm" method="post">
   Username: <input type="text" name="username" value="" />
   <br />
   Password: <input type="password" name="password" value="" />
   <br />
   <input type="submit" name="login" value="Log In" />
   <br />
</form>


login_act.cfm

<!--- Here we hardtype the password. You can easy read it from a database instead. --->
<cfset sectret_password = "0AbcD">

<!--- We use the Compare function and check for case sensitive --->
<cfset comparing = Compare(FORM.password, sectret_password)>

<!--- Testing the returned value of comparing --->
<cfif comparing eq 0>
     If "0" (string1 is equal to string2), user OK. Can Log In.
<cfelse>
     <!---  String1 and string2 are NOT equal, NOT a valid Case Sensitive password. --->
     <!---  Send user back to Log IN form or something else. --->
</cfif>

Now you easy can create a better security in ur ColdFusion application.

ColdFusion Tutorial test

Case Sensitive passwords

No test is available or implemented for this ColdFusion Tutorial.

No User Comments.

No User Comments, be the first one to write your comments?

Add your comments

Your Name*:
Your Email:
Site URL:
Site Name:
Comemt Title*:
Your Comment*:
Key Phrase*:
0eW
Your IP Address: 38.103.63.62
 

ScandicWeb is own by Scandic Systems LTD [UK] Company No. 5984000. All other trademarks and copyrights are the property of their respective holders.

[Home [Site Map [Privacy Statement [Site Feedback] [About ScandicWeb]


[ColdFusion [Flash [Search Engine Optimization [Graphics [Cascading Style Sheets (CSS) [JavaScript (JS) [Software]

Partner sites: ScandicSoft


Server time: 19. November 2008 Wednesday