Sign in..and then?
Hi, all. I'm trying to make use of the client name that's signed in. You will find the application.cfm and loginform.cfm files below. What I can't figure out is how to use the exact user that is logged in. The usernames are in a database, and each user has their own directory (to store their pictures in). I don't know how to call up the user name that's logged in. Specifically, I want the user to see only those images that exist in his folder (and are associated with them in the DB). How do I do this?
Thank you, and thank you for putting up with a noob.
application.cfm
<!---from http://www.adobe.com/livedocs/coldfusion/6.1/htmldocs/appsec27.htm--->
<cfapplication name="Orders" clientmanagement="yes" sessionmanagement="Yes" loginStorage="Session">
<cfif IsDefined("Form.logout")>
<cflogout>
</cfif>
<cflogin>
<cfif NOT IsDefined("cflogin")>
<cfinclude template="loginform.cfm">
<cfabort>
<cfelse>
<cfif cflogin.name IS "" OR cflogin.password IS "">
<cfoutput>
<H2>You must enter text in both the User Name and Password fields</H2>
</cfoutput>
<cfinclude template="loginform.cfm">
<cfabort>
<cfelse>
<cfquery name="loginQuery" dataSource="omfoto">
SELECT UserLogin, Role
FROM People
WHERE
UserLogin = '#cflogin.name#'
AND UserPassword = '#cflogin.password#'
</cfquery>
<cfif loginQuery.Role NEQ "">
<cfloginuser name="#cflogin.name#" Password = "#cflogin.password#"
roles="#loginQuery.Role#">
<cfelse>
<cfoutput>
<H2>Your login information is not valid.<br>
Please Try again</H2>
</cfoutput>
<cfinclude template="loginform.cfm">
<cfabort>
</cfif>
</cfif>
</cfif>
</cflogin>
<!---
<cfif GetAuthUser() NEQ "">
<cflocation url="securitytest.cfm">
</cfif>
--->
<cfif GetAuthUser() NEQ "">
<cfoutput>
<form action="../index.cfm" method="Post">
<input type="submit" Name="Logout" value="Logout">
</form>
</cfoutput>
</cfif>
loginform.cfm
<H2>Please Log In</H2>
<cfoutput>
<!--- CGI.script_name/CGI.query_string are used to recreate the URL used to call the requested page
takes you to loginform.cfm--->
<form action="#CGI.script_name#?#CGI.query_string#" method="Post">
<table>
<tr>
<td>username:</td>
<td><input type="text" name="j_username"></td>
</tr>
<tr>
<td>password:</td>
<td><input type="password" name="j_password"></td>
</tr>
</table>
<br>
<input type="submit" value="Log In">
</form>
</cfoutput>
