I have the following, cause i rearmed the database tables for this purpose:
=======
application.cfm
<cfapplication name="login" clientmanagement="yes" sessionmanagement="yes" setclientcookies="yes" sessiontimeout="#Createtimespan(0,0,20,0)#" applicationtimeout="#createtimespan(2,0,0,0)#"><cfset application.addtoken="cfid=#client.cfid#&cftoken=#client.cftoken#"><cfset session.loginstatus="yes">
=======
login.cfm
=======
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<CFPARAM NAME="Action" DEFAULT="">
<script language="JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape"

&&(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="#ffffff">
<CFIF ACTION IS "Login">
<CFQUERY NAME="CheckLogin" DATASOURCE="securitysat">
SELECT * FROM tb_users_company
WHERE user_user='#user_user#' AND user_password='#user_password#'
</CFQUERY>
<CFIF CheckLogin.user_nivel is 1>
<cflocation url="index_a.cfm">
<cfelseif Checklogin.user_nivel is 2>
<cflocation url="index_b.cfm">
<cfelseif Checklogin.user_nivel is 3>
<cflocation url="index_b.cfm">
<cfelseif Checklogin.user_nivel is 4>
<cflocation url="index_c.cfm">
<cfelseif Checklogin.user_nivel is 5>
<cflocation url="index_c.cfm">
<cfelseif Checklogin.user_nivel is 6>
<cflocation url="index_d.cfm">
<CFELSE>
<cflocation url="login.cfm">
</CFIF>
</cfif>
<CFOUTPUT>
<FORM NAME="Login" ACTION="login.cfm?CFID=#CFID#&CFTOKEN=#CFTOKEN#" METHOD="post"></CFOUTPUT>
<TABLE WIDTH="100%">
<TR>
<TH colspan="2" height="49" class="etiqueta">Ingreso al Sistema</TH>
</TR>
<TR>
<TH WIDTH="254"> <span class="campos">Nombre de usuario</span></TH>
<TD WIDTH="222">
<INPUT TYPE="text" NAME="user_user">
</TD>
</TR>
<TR>
<TH WIDTH="254"> <span class="campos">Contraseña</span></TH>
<TD WIDTH="222">
<INPUT TYPE="password" NAME="user_password">
</TD>
</TR>
<TR>
<TD colspan="2" height="54">
<div align="center">
<INPUT TYPE="hidden" NAME="action" VALUE="Login">
<INPUT TYPE="submit" VALUE=" L o g i n " STYLE="background-color:#999999">
</div>
</TD>
</TR>
</TABLE>
<SCRIPT LANGUAGE="JAVASCRIPT">
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("checklogin.user_user"

>
<cflocation url="error.cfm">
</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.