We help IT Professionals succeed at work.

From login page... Welcome #username#.. problems..

jasocke2
jasocke2 asked
on
Medium Priority
227 Views
Last Modified: 2013-12-24
Hi..
I wonder of any of you can help...

I have 3 files... login.cfm, login5.cfm, and checklogin cfm..

The login.cfm is a screen where you put your username and password, press ok and it goes to login5.cfm>>

<cfquery name="check" datasource="jasvasquez-access">
  select * from Users where user_ID = '#form.username#' and password = '#form.password#'
</cfquery>

<cfif check.recordcount is "1">
  <cfoutput query="check">
    <cfset session.loggedin = "true">
  </cfoutput>
  <script language="JavaScript">
     alert( 'You sucessfully logged in ... Please press ok!.');
     self.location="/students/jasocke2/checklogin1.cfm";
  </script>
<cfelse>
  <script language="JavaScript">
    alert( 'Please check your username and password, then try again.');
    self.location="/students/jasocke2/login.cfm";
  </script>
</cfif>

Then you press ok and it directs you to checklogin.cfm>>

<CFIF Session.LoggedIn NEQ "True">
  <CFLOCATION URL="/students/jasocke2/checklogin1.cfm">
</CFIF>
<html>
<head><title>Login</title></head>
<body bgcolor="#FFFFFF" text="#000000">
<div align="center"></div>
<div align="center">
  <p align="left"><a href="allgigs.cfm">View all Gigs</a></p>
  <p align="left"><a href="addgig.cfm">Add Gig</a></p>
  <p align="left"><a href="update1.cfm">Update Gig</a></p>
  <p align="left"><a href="newsupdate.cfm">Change News</a></p>
    <p align="left"><a href="delete.cfm">Delete a played Gig</a></p>
  <div align="left">
    <p>&nbsp;</p>
    <p><i>.</i> </p>
  </div>
</div>
<div align="left">

</body>
</html>

what I want is pretty simple (I think) although I've tried alsorts and it wont work!!
I want it so when you login it says Welcome (and then the username that you put in on the first screen)...

and ideas?
All I have been getting is username not defied in form!
Thanks in advance...
Comment
Watch Question

CERTIFIED EXPERT

Commented:
OK - Try putting (on your first form action page - where you have the query where user_ID = '#form.username#' and password = '#form.password#')
<cfcookie name="Username" value="#form.Username#">
Then where ever you want put
<cfif isDefined("cookie.Username")>
Welcome #cookie.Username#
</cfif>

Author

Commented:
it's coming up...

Welcome #cookie.Username# ...

where abouts do I put it in the text?

(sorry for sounding stupid!!)
CERTIFIED EXPERT
Commented:
Hi
I guess I don't know what you mean exactly
Are you saying this is exactly how you see it "Welcome #cookie.Username# ..."
If so - you need <cfoutput> tags around it "Welcome <cfoutput>#cookie.Username#</cfoutput> ..."
Let me know if thats not it ...

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
Your a star!
Works a treat!
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.