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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Login area for different users and send them to diferent pages

Status
Not open for further replies.

auriga69

Technical User
Feb 11, 2001
9
0
0
CL
Any one could help me about that. I have three tables that has the folling:
tb_users tb_level_user tb_url
user_id level_id url_id
user_username level_desc url_desc
user_pwd user_id
level_id

the matter is that tb_url; makes all the work.
I want to know how to make a login page that when check the fields of tb_url directs to the page (a field url_desc). I want to know how. Can anyone help me?
:)
 
Hi! How about something like this:

After you do your query to determine what level the user is,
is the <cfoutput> portion:

<script language = &quot;javascript&quot;>
<!--
location.href = &quot;#tb_url#&quot;;
//-->
</script>

Hope this helps.
 
I suppose you could also use the cflocation tag.
 
You can use cflocation tag as well, just don't try and set a cookie on that page.
Best of luck,
PT

ptmon_sm_ribbon.gif
 
I have the following, cause i rearmed the database tables for this purpose:
=======
application.cfm
<cfapplication name=&quot;login&quot; clientmanagement=&quot;yes&quot; sessionmanagement=&quot;yes&quot; setclientcookies=&quot;yes&quot; sessiontimeout=&quot;#Createtimespan(0,0,20,0)#&quot; applicationtimeout=&quot;#createtimespan(2,0,0,0)#&quot;><cfset application.addtoken=&quot;cfid=#client.cfid#&cftoken=#client.cftoken#&quot;><cfset session.loginstatus=&quot;yes&quot;>
=======
login.cfm
=======
<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;>

<CFPARAM NAME=&quot;Action&quot; DEFAULT=&quot;&quot;>
<script language=&quot;JavaScript&quot;>
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName==&quot;Netscape&quot;)&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->
</script>
</head>
<body bgcolor=&quot;#ffffff&quot;>
<CFIF ACTION IS &quot;Login&quot;>
<CFQUERY NAME=&quot;CheckLogin&quot; DATASOURCE=&quot;securitysat&quot;>
SELECT * FROM tb_users_company
WHERE user_user='#user_user#' AND user_password='#user_password#'
</CFQUERY>
<CFIF CheckLogin.user_nivel is 1>
<cflocation url=&quot;index_a.cfm&quot;>
<cfelseif Checklogin.user_nivel is 2>
<cflocation url=&quot;index_b.cfm&quot;>
<cfelseif Checklogin.user_nivel is 3>
<cflocation url=&quot;index_b.cfm&quot;>
<cfelseif Checklogin.user_nivel is 4>
<cflocation url=&quot;index_c.cfm&quot;>
<cfelseif Checklogin.user_nivel is 5>
<cflocation url=&quot;index_c.cfm&quot;>
<cfelseif Checklogin.user_nivel is 6>
<cflocation url=&quot;index_d.cfm&quot;>
<CFELSE>
<cflocation url=&quot;login.cfm&quot;>
</CFIF>
</cfif>

<CFOUTPUT>
<FORM NAME=&quot;Login&quot; ACTION=&quot;login.cfm?CFID=#CFID#&CFTOKEN=#CFTOKEN#&quot; METHOD=&quot;post&quot;></CFOUTPUT>
<TABLE WIDTH=&quot;100%&quot;>
<TR>
<TH colspan=&quot;2&quot; height=&quot;49&quot; class=&quot;etiqueta&quot;>Ingreso al Sistema</TH>
</TR>
<TR>
<TH WIDTH=&quot;254&quot;> <span class=&quot;campos&quot;>Nombre de usuario</span></TH>
<TD WIDTH=&quot;222&quot;>
<INPUT TYPE=&quot;text&quot; NAME=&quot;user_user&quot;>
</TD>
</TR>
<TR>
<TH WIDTH=&quot;254&quot;> <span class=&quot;campos&quot;>Contraseña</span></TH>
<TD WIDTH=&quot;222&quot;>
<INPUT TYPE=&quot;password&quot; NAME=&quot;user_password&quot;>
</TD>
</TR>
<TR>
<TD colspan=&quot;2&quot; height=&quot;54&quot;>
<div align=&quot;center&quot;>
<INPUT TYPE=&quot;hidden&quot; NAME=&quot;action&quot; VALUE=&quot;Login&quot;>
<INPUT TYPE=&quot;submit&quot; VALUE=&quot; L o g i n &quot; STYLE=&quot;background-color:#999999&quot;>
</div>
</TD>
</TR>
</TABLE>
<SCRIPT LANGUAGE=&quot;JAVASCRIPT&quot;>
document.Login.user_nivel.focus();
</SCRIPT>
</FORM>
</td>
</tr>
</table>
</body>
</html>
========
on the head of every protected page i put the following:
========
<cfif not isdefined(&quot;checklogin.user_user&quot;)>
<cflocation url=&quot;error.cfm&quot;>
</cfif>

=====0000000===

The problem is that when i put the right pair of keys they take me to the error.cfm page everytime.

How do I fix the problem or is another reazoable way to do what I want.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top