Solved

Will this cold fusion code work to authenticate a user?

Posted on 2004-08-01
5
212 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 150 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 350 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

Why You Need a DevOps Toolchain

IT needs to deliver services with more agility and velocity. IT must roll out application features and innovations faster to keep up with customer demands, which is where a DevOps toolchain steps in. View the infographic to see why you need a DevOps toolchain.

Question has a verified solution.

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

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

751 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