Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple Login's

Status
Not open for further replies.

emms

Programmer
Jan 11, 2001
55
GB
I'm writing an application which needs to take the users username and password and log them on to a number of applications is there any way this can be done?

so the front page will take name + password then take the user to a page with links to a number of applications (each with its own variables) into which the user has already been logged on

i'd appreciate any help with this as i'm really not sure how it will work

thankyou
 
The easiest way is to put a cfapplication tag in your "application.cfm" file and set it to enable session management. With this in place, just create a session.variable for their username and password when they login. At the top of any protected page, check for the existence of the session.username and session.password and then verify they are valid. If not, re-direct to a login page. Here's a quick example.

In the application.cfm file:
<cfapplication name=&quot;myApp&quot; sessionmanagement=&quot;yes&quot;>

In the login page after verifying the username and password are valid:
<cfset session.username = form.username>
<cfset session.password = form.password>

At the top of a protected page:
<cfif isdefined(&quot;session.username&quot;) and isdefined(&quot;session.password&quot;)>
<cfquery name=&quot;q1&quot; ....>
select * from userTable where username = '#session.username#'
and password = '#session.password#'
</cfquery>
<cfif q1.recordcount neq 1>
<cflocation url=&quot;Login.cfm&quot;>
</cfif>
<cfelse>
<cflocation url=&quot;Login.cfm&quot;>
</cfif>

Let me know if you have any trouble with this.
GJ
 
Thanks for the help -

i managed to sort my problem by using one application and using a different database depending on which area the user is in
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top