Ask a Question related to Coldfusion - Getting Started, Design and Development.
-
AdonaiEchad #1
How to place a Name in a index page after login page
Hello everyone. I just started to learning ColdFusion and I was wondering when
someone registers and they place their first and last name and e-mail and
password and so forth. Then they are brought to a login page and are asked to
place their username and password. Once logged in, in the index page or main
page I wanted to have something stand out and say Good morning or good
afternoon with their first name. How do I do that. I've been trying over and
over but I can't get it to function. I also have made an Application.cfm with
the login information. Can someone help me where someone enters a site after
when they have placed their e-mail and password that in the main menu they
first name shows up and welcomes them? Here is my code for login_form.cfm,
index.cfm and application. Thank you, AdonaiEchad
---------------------------------------
login_form.cfm
------------------
<cfinclude template="semheader.cfm"/>
<div id="divTitle">Seminary Students Login</div>
<div id="divContent">
<div id="divLoginTable4">
<div class="logintext">Not <a
href="/lomm/seminary/register/user_register.cfm">register?</a></div>
<cfform action="/lomm/seminary/index.cfm" method="post">
<table width="200" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="qDetails">Username:</td>
<td><cfinput type="text" name="email" class="field" required="yes"
message="You must enter your username as your e-mail address." /></td>
</tr>
<tr>
<td class="qDetails">Password:</td>
<td><cfinput type="password" name="password" class="field" required="yes"
message="You must enter your password." /></td>
</tr>
<tr>
<td colspan="2">
<cfinput type="image" name="login_button"
src="/lomm/images/buttons/login_btn.gif" class="login_btn" />
</td>
</tr>
</table><br><br>
<div class="logintext">Want to go back to LOMM website <a
href="/lomm/index.cfm">Click Here</a></div>
</div>
</div>
</cfform>
<cfinclude template="semfooter.cfm"/>
--------------------------------------------------------------------------------
---------------------------------------------------------------------------
index.cfm
-------------
<cfinclude template="semheader.cfm"/>
<div id="divTitle">Welcome to LOMM Seminary</div>
<div id="divContent">
<br>
<img src="../images/contentimages/logo9.jpg" name="seminarylogog"
width="350" height="272" class="seminarylogo" id="eminarylogo">
<br>
</div>
<cfinclude template="semfooter.cfm"/>
</div>
--------------------------------------------------------------------------------
--------------------------------------------------------------------------
Application.cfm
--------------------
<cfset sLOMM = "lommseminary" />
<cflogin>
<cfif isDefined ('FORM.login_button.y')>
<cfquery datasource="#sLOMM#" name="qLogin">
SELECT users.user_id, user_type.type
FROM users, user_type
WHERE user_type.user_type_id = users.user_type_id
AND users.email = '#FORM.email#'
AND users.password = '#FORM.password#'
</cfquery>
<cfif qLogin.RecordCount GT 0>
<cfloginuser name="#qLogin.user_id#" password="#FORM.password#"
roles="#qLogin.type#"/>
<cfelse>
<cfset sHeaderMessage = "The e-mail and password combination you tried is
incorrect." />
<cfinclude template="login_form.cfm" />
<cfabort />
</cfif>
<cfelse>
<cfinclude template="login_form.cfm" />
<cfabort />
</cfif>
</cflogin>
--------------------------------------------------------------------------------
---------------------------------------------------------------
AdonaiEchad Guest
-
Trouble loading administrator/index.cfm page--i am askedto save the page
Please help....i've been stuck for days on this problem... Basically, I installed coldfusion and at the end of the installation, it told me that... -
making a login page which shud lead to a https page ?
(Type your message here) making a login page which shud lead to a https page ? ne suggestions -------------------------------- From: sneha... -
my user login page is always the default page
:brokenheart; my coldfusion application has an login page, some users logged in and saved some page to favorites, then close the browser without... -
index page vs home page
When I publish my web pages (Publisher 2002) to the hosting site and then access them, it always opens to a file listing rather than to the home... -
pflynn02 #2
Re: How to place a Name in a index page after loginpage
In your CFIF code to determine if they are a valid user or not, you need to set
their name if successful. So after you log them in, put <cfset
session.firstnamefield = #qlogin.firstnamefield#>. Once you do that you can
simply pull up their name from anywhere in your app just by typing
#session.firstnamefield#.
pflynn02 Guest
-
AdonaiEchad #3
Re: How to place a Name in a index page after loginpage
I am a bit confused, where do I place the <cfset session.firstnamefield =
#qlogin.firstnamefield#> which I assume will be in the Application.cfm file.
This is where I placed <cfset session.firstnamefield = #qlogin.firstnamefield#>
as <cfset session.name_first = #qlogin.name_first#> <!---New Code---> , in the
Application.cfm, is this correct? ------------------------------ <cfset sLOMM =
'lommseminary' /> <cflogin> <cfif isDefined ('FORM.login_button.y')>
<cfset session.name_first = #qlogin.name_first#> <!---New Code---> <cfquery
datasource='#sLOMM#' name='qLogin'> SELECT users.user_id, user_type.type
FROM users, user_type WHERE user_type.user_type_id = users.user_type_id
AND users.email = '#FORM.email#' AND users.password = '#FORM.password#'
</cfquery> <cfif qLogin.RecordCount GT 0> <cfloginuser
name='#qLogin.user_id#' password='#FORM.password#' roles='#qLogin.type#'/>
<cfelse> <cfset sHeaderMessage = 'The e-mail and password combination you
tried is incorrect.' /> <cfinclude template='login_form.cfm' /> <cfabort
/> </cfif> <cfelse> <cfinclude template='login_form.cfm' /> <cfabort />
</cfif> </cflogin> ----------------------------- For the
#session.firstnamefield# I placed it as #session.name_first#, is this correct?
----------------- <cfinclude template='semheader.cfm'/> <div
id='divTitle'>Welcome to LOMM Seminary</div> <div id='divContent'> <cfoutput>
<!---New Code---> #session.name_first# <!---New Code---> </cfoutput> <!---New
Code---> <br> <img src='../images/contentimages/logo9.jpg'
name='seminarylogog' width='350' height='272' class='seminarylogo'
id='eminarylogo'> <br> </div> <cfinclude template='semfooter.cfm'/>
</div> When I tried this I am getting an error that says... ----- Error
Occurred While Processing Request Element NAME_FIRST is undefined in QLOGIN.
The error occurred in
C:\CFusionMX7\wwwroot\lomm\seminary\Application.cf m: line 7 5 : 6 : <cfif
isDefined ('FORM.login_button.y')> 7 : <cfset session.name_first =
#qlogin.name_first#> <!---New Code---> 8 : <cfquery datasource='#sLOMM#'
name='qLogin'> 9 : SELECT users.user_id, user_type.type
--------------------------- What am I missing? Thank you, AdonaiEchad
AdonaiEchad Guest
-
pflynn02 #4
Re: How to place a Name in a index page after loginpage
You placed it wrong, it goes after this line of your application file: <cfset
session.name_first = #qlogin.name_first#> <cfloginuser name='#qLogin.user_id#'
password='#FORM.password#' roles='#qLogin.type#'/> Also, in your query you
need select the name_first field.
pflynn02 Guest
-
AdonaiEchad #5
Re: How to place a Name in a index page after loginpage
Thank you so much, you've been most helpful. I really appreciate your patience with me on this.
AdonaiEchad Guest
-



Reply With Quote

