Jump to content

Check out our Community Blogs

Register and join over 40,000 other developers!

Recent Status Updates

View All Updates

- - - - -

Session Variable Syntax

Help Counter Syntax syntax session session variable

  • Please log in to reply
1 reply to this topic

#1 crankshaft


    CC Lurker

  • Just Joined
  • Pip
  • 1 posts
  • Programming Language:C, PHP, Perl
  • Learning:PHP, Perl, Others

Posted 01 July 2012 - 01:46 PM

Im trying to put together a counter that pulls image files and is using ASP Session Variables in VB SCript

I cant for life of me get syntax or loop structure to make this pop up counter that is padded with zeros

Anyone have any ideas ?


<%@ LANGUAGE = VBScript %>
<% Option Explicit %>
'Ensure that this page is not cached.
Response.Expires = 0
<TITLE>Using Session Variables</TITLE>
<!-- Display header. -->
<B>Using Session Variables</B></FONT><BR>
<HR SIZE="1" COLOR="#000000">

'If this is the first time a user has visited
'the page, initialize Session Value.
If (Session("SessionCountVB") = "") Then
Session("SessionCountVB") = 0
End If
'Increment the SessionCountVB by one.
'Note that this SessionCountVB value is only
'for this user's individual session.

Session("SessionCountVB") = Session("SessionCountVB") + 1
<!-- Output the Session Page Counter Value. -->
'Note that this only works for a counter up to two digits
Dim digit6, digit5, digit4, digit3, digit2, digit1, counter
counter = Session("SessionCountVB")
digit1 = counter MOD 10
counter = counter \ 10
digit2 = counter MOD 10
digit3 = counter MOD 10
digit4 = counter MOD 10
digit5 = counter MOD 10
digit6 = counter MOD 10 %>
You have personally visited this page
<img src="digits/<%=digit6%>.gif">
<img src="digits/<%=digit5%>.gif">
<img src="digits/<%=digit4%>.gif">
<img src="digits/<%=digit3%>.gif">
<img src="digits/<%=digit2%>.gif">
<img src="digits/<%=digit1%>.gif">
<!-- Provide a link to revisit the page. -->
<br><P><A HREF="yourfilenameonserverhere.asp">Click here to visit it again</A>


  • 0

#2 WingedPanther73


    A spammer's worst nightmare

  • Moderator
  • 17757 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others

Posted 06 July 2012 - 12:18 PM

What is it doing? Alway printing 0 or 1 visits?
  • 0

Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

My MineCraft server site: http://banishedwings.enjin.com/

Also tagged with one or more of these keywords: Help Counter Syntax, syntax, session, session variable

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download