Jump to content

Check out our Community Blogs


Member Since 01 Jul 2012
Offline Last Active Jul 01 2012 01:45 PM

Topics I've Started

Session Variable Syntax

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>



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