Application Variable

Results 1 to 3 of 3

Thread: Application Variable

  1. #1
    Join Date
    Dec 1969

    Default Application Variable

    Does anyone know how I would go about storing the users that are logged into my site in the application varible. It&#039;s for a use on a forum site <BR>This has been done on the site<BR>Any ideas?

  2. #2
    Join Date
    Dec 1969

    Default RE: Application Variable

    You could do something like this:<BR><BR>if ( len(request.form("username")) &#062; 0 ) then<BR> Application("username") = request.form("username")<BR>else<BR>response.write "You must enter your Username"<BR>end if <BR><BR>if ( len(request.form("password")) &#062; 0 ) then<BR> Application("password") = request.form("password")<BR>else<BR>response.write "You must enter your Password"<BR><BR>end if

  3. #3
    Join Date
    Dec 1969

    Default Huh? That only stores *one* user...

    He wants to store *ALL* the users.<BR><BR>The best way to do this is use an *ARRAY* and store all the usernames in a single array. When a session ends (Session_onEnd), then you remove the user from the array.<BR><BR>To see how to use an array in an Application variable value, look in the ASPFAQs, topic "Arrays", for a Q&A on Session and Application arrays. This shows you how to make the size of the array dynamic, growing as needed.<BR><BR>One hint, though: When you remove a person from the array, you don&#039;t *really* want to "close up" the array (move all entries above down one). If you don&#039;t care about the ordering in the array, the easiest rule to follow is to simply always move the *last* name into the just-vacated slot and then mark the array size as one smaller.<BR><BR>Oh, and another *VERY* vital thing is missing from Irish&#039;s answer: Remember to surround any work you do with an Application variable value with Application.Lock and Application.Unlock!!!<BR><BR>

Posting Permissions

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