Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Will this cold fusion code work to authenticate a user?

Posted on 2004-08-01
5
Medium Priority
?
225 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 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
The viewer will learn how to count occurrences of each item in an array.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

688 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