UserAuthorization

Discussion in 'Programming' started by theborg72, May 5, 2010.

  1. #1
    Hello.. have try find ware the problem is with no luck.
    when i try access the page i get following error

    Element MM_USERAUTHORIZATION is undefined in SESSION. 
    Code (markup):
    here is the code from page

    <cfif IsDefined("URL.MM_logout") AND URL.MM_logout EQ "1">
      <cflock scope="Session" type="Exclusive" timeout="30" throwontimeout="no">
        <cfset Session.MM_Username="">
        <cfset Session.MM_UserAuthorization="">
      </cflock>
      <cfset MM_logoutRedirectPage="funkar.cfm">
      <cfif MM_logoutRedirectPage EQ "">
        <cfset MM_logoutRedirectPage=CGI.SCRIPT_NAME>
      </cfif>
      <cfset MM_logoutQuery=ListDeleteAt(CGI.QUERY_STRING,ListContainsNoCase(CGI.QUERY_STRING,"MM_logout=","&"),"&")>
      <cfif MM_logoutQuery NEQ "">
        <cfif Find("?",MM_logoutRedirectPage) EQ 0>
          <cfset MM_logoutRedirectPage=MM_logoutRedirectPage & "?" & MM_logoutQuery>
          <cfelse>
          <cfset MM_logoutRedirectPage=MM_logoutRedirectPage & "&" & MM_logoutQuery>
        </cfif>
      </cfif>
      <cflocation url="#MM_logoutRedirectPage#" addtoken="no">
    </cfif>
    <cfset CurrentPage=GetFileFromPath(GetBaseTemplatePath())>
    <cfquery name="RecUser" datasource="FamLundDB2k">
    SELECT *
    FROM tblUserID 
    </cfquery>
    <cfif IsDefined("FORM.tabUsr")>
      <cfset MM_redirectLoginSuccess="##">
      <cfset MM_redirectLoginFailed="##">
      <cfquery  name="MM_rsUser" datasource="FamLundDB2k">
      SELECT TabLoginNamn,TabLoginPass,TabLoginAccess FROM tblUserID WHERE TabLoginNamn=<cfqueryparam value="#FORM.tabUsr#" cfsqltype="cf_sql_clob" maxlength="50"> AND TabLoginPass=<cfqueryparam value="#FORM.tabPass#" cfsqltype="cf_sql_clob" maxlength="50">
      </cfquery>
      <cfif MM_rsUser.RecordCount NEQ 0>
        <cftry>
          <cflock scope="Session" timeout="30" type="Exclusive">
            <cfset Session.MM_Username=FORM.tabUsr>
            <cfset Session.MM_UserAuthorization=MM_rsUser.TabLoginAccess[1]>
          </cflock>
          <cfif IsDefined("URL.accessdenied") AND false>
            <cfset MM_redirectLoginSuccess=URL.accessdenied>
          </cfif>
          <cflocation url="#MM_redirectLoginSuccess#" addtoken="no">
          <cfcatch type="Lock">
            <!--- code for handling timeout of cflock --->
          </cfcatch>
        </cftry>
      </cfif>
      <cflocation url="#MM_redirectLoginFailed#" addtoken="no">
      <cfelse>
      <cfset MM_LoginAction=CGI.SCRIPT_NAME>
      <cfif CGI.QUERY_STRING NEQ "">
        <cfset MM_LoginAction=MM_LoginAction & "?" & XMLFormat(CGI.QUERY_STRING)>
      </cfif>
    </cfif>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <title>Untitled Document</title>
    </head>
    
    <body>
    
    <p>
      <form id="frmUser" name="frmUser" method="POST" action="">
      <table width="200" border="1">
    <tr>
      <cfif ListContains("1", Session.MM_UserAuthorization)>
        Du har lyckas logga in med ADMIN mr: <cfoutput>#RecUser.TabUser#</cfoutput> med konto <br /><cfoutput>#RecUser.TabLoginNamn#</cfoutput>
      </cfif>
      <cfif Not ListContains("1", Session.MM_UserAuthorization)>
      <form id="form1" name="form1" method="POST" action="<cfoutput>#MM_loginAction#</cfoutput>">
      <table width="200" border="1">
        <tr>
          <td>anv</td>
          <td><label for="tabUsr"></label>
          <input type="text" name="tabUsr" id="tabUsr" /></td>
        </tr>
        <tr>
          <td>pass</td>
          <td><label for="tabPass"></label>
          <input type="text" name="tabPass" id="tabPass" /></td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td><input type="submit" name="butLogin" id="butLogin" value="LoggaIn" /></td>
        </tr>
      </table>
    
    </form>
    </tr>
    </table>
    </form>
    </cfif>
    
    </p>
    <p><a href="<cfoutput>#CurrentPage#?MM_logout=1</cfoutput>">Logga ut</a></p>
    <p></p>
    </body>
    </html>
    
    
    Code (markup):

    code from

    Application.cfm
    
    <CFAPPLICATION NAME="Famlund" 
    SESSIONMANAGEMENT="Yes"
    clientManagement="Yes">
    
    Code (markup):

    Can som one help me with what i have miss.
     
    theborg72, May 5, 2010 IP