Go Back   CodingForums.com > :: Server side development > Other server side languages/ issues > ColdFusion

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average.
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-20-2010, 12:27 PM   PM User | #1
theborg72
New Coder

 
Join Date: May 2010
Location: Sweden
Posts: 15
Thanks: 1
Thanked 0 Times in 0 Posts
theborg72 is an unknown quantity at this point
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
theborg72 is offline   Reply With Quote
Old 05-21-2010, 08:08 PM   PM User | #2
Gjslick
Regular Coder

 
Join Date: Feb 2009
Location: NJ, USA
Posts: 476
Thanks: 2
Thanked 70 Times in 69 Posts
Gjslick will become famous soon enough
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
Gjslick is offline   Reply With Quote
Old 05-22-2010, 06:50 PM   PM User | #3
theborg72
New Coder

 
Join Date: May 2010
Location: Sweden
Posts: 15
Thanks: 1
Thanked 0 Times in 0 Posts
theborg72 is an unknown quantity at this point
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.
theborg72 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:33 PM.


Advertisement
Log in to turn off these ads.