Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    May 2010
    Location
    Sweden
    Posts
    15
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question session UserAuthorization

    Hello. i try go get this funktion to start

    i have try create somfing that hide and show funktion on page with MM_UserAuthorization.

    to make it i use EQ
    Code:
      <cfif Session.MM_UserAuthorization EQ 1>
        show funktion only fore user with level 1
      </cfif>
    
      <cfif not Session.MM_UserAuthorization EQ 1>
        hide funktion
      </cfif>
    then a login and logout..
    i add structKeyExists to logout funktion to make session work (allmost)

    Code:
    <cfif IsDefined("URL.MM_logout") AND URL.MM_logout EQ "1" or (NOT structKeyExists(SESSION,'MM_USERAUTHORIZATION'))>
    but when i close browser i get follow error

    Invalid list index 0.
    In function ListDeleteAt(list, index [, delimiters]), the value of index, 0, is not a valid as the first argument (this list has 0 elements). Valid indexes are in the range 1 through the number of elements in the list.


    iff i reload page it working.

    so i get negative valute in ListDeleteAt with is from the Structkeyexists..

    am stuck to find out how to make this work

  • #2
    Regular Coder
    Join Date
    Feb 2009
    Location
    NJ, USA
    Posts
    476
    Thanks
    2
    Thanked 70 Times in 69 Posts
    In ColdFusion, lists and arrays start at index 1, not 0. That's why you can't do listDeleteAt( myList, 0 ). You can test to see if the list has elements with something like:
    Code:
    <cfif listLen( myList ) gt 0>
      (do list delete here)
    </cfif>
    But otherwise, are you possibly not creating the list before that listDeleteAt() runs? Sounds like this might be the case. Post the relevant code in whichever files that would relate to your problem, and I'll take a look. What you provided is not enough to understand what's going on.

    -Greg

  • #3
    New Coder
    Join Date
    May 2010
    Location
    Sweden
    Posts
    15
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Cool

    tru..
    find out whats worong by read to mutch and find out how to wright the code to make it work

    Code:
    <cfif IsDefined("Session.MM_UserAuthorization") AND
    Session.MM_UserAuthorization EQ 1>
    <cfinclude template="/testlogin/include/logout.cfm">
    <cfelse>
    <cfinclude template="/testlogin/include/login.cfm">
    </cfif>
    to use this is have working login form in page..
    by use this in all page now i can hide and show content for member.

    hope this can help som other one.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •