Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Will this cold fusion code work to authenticate a user?

Posted on 2004-08-01
5
Medium Priority
?
230 Views
Last Modified: 2010-04-06
Not sure if the syntax is correct.  Please validate.

<cfif isdefined("FORM.userID")>
      <cfif Form.user_name EQ "hkbpics" and Form.user_password EQ "password1">
    <!--- Get user info, first name, last name and access level. --->
      <cfset SESSION.Auth = StructNew()>
      <cfset SESSION.Auth.IsLoggedIn = "Yes">
      <!--- Everything is ok. Send the user to menu template. --->
      <cflocation url="menu.cfm">
      </cfif>
</cfif>
0
Comment
Question by:gmahler5th
5 Comments
 
LVL 7

Expert Comment

by:vnvk
ID: 11694468
instead od isdefined, use parameterexists
0
 

Author Comment

by:gmahler5th
ID: 11698176
Okay, so what about my second cfif.  Will this work?

<cfif Form.user_name EQ "hkbpics" and Form.user_password EQ "password1">
    <!--- Get user info, first name, last name and access level. --->
      <cfset SESSION.Auth = StructNew()>
      <cfset SESSION.Auth.IsLoggedIn = "Yes">
      <!--- Everything is ok. Send the user to menu template. --->
      <cflocation url="menu.cfm">
     </cfif>
0
 
LVL 21

Assisted Solution

by:pinaldave
pinaldave earned 600 total points
ID: 11700791
Hi gmahler5th,

http://www.edgewebhosting.net/cfdocs/Developing_ColdFusion_Applications/appSecurity10.html
here is answer to your question.


Regards,
---Pinal
0
 
LVL 9

Accepted Solution

by:
Jerry_Pang earned 1400 total points
ID: 11713068
Okay, so what about my second cfif.  Will this work?

<cfif Form.user_name EQ "hkbpics" and Form.user_password EQ "password1">
    <!--- Get user info, first name, last name and access level. --->
      <cfset SESSION.Auth = StructNew()>
      <cfset SESSION.Auth.IsLoggedIn = "Yes">
      <!--- Everything is ok. Send the user to menu template. --->
      <cflocation url="menu.cfm">
</cfif>

little modification
<cfif not isdefined("SESSION.Auth ")>
 <cfif Form.user_name EQ "hkbpics" and Form.user_password EQ "password1">
    <!--- Get user info, first name, last name and access level. --->
      <cfset SESSION.Auth = StructNew()>
      <cfset SESSION.Auth.IsLoggedIn = "Yes">
      <!--- Everything is ok. Send the user to menu template. --->
      <cflocation url="menu.cfm">
 </cfif>
</cfif>

Yes, this would work, this is the simplest user authentication i guess.
0
 
LVL 21

Expert Comment

by:pinaldave
ID: 11716209
glad to help you.
Have a good day!
---Pinal
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question