jharnisch
04-18-2004, 03:10 PM
Hello,
I am having a problem I think with session variables. On a page I have 4 buttons a user can click from and each of those buttons has a random number associated with it. When the timer reaches zero, one of the buttons is able to be clicked on and a user earns a credit. It works most of the time, However some times it does not store the correct random number for the button. Here is some of the code:
This picks which button will be allowed to click on:
Randomize Timer 'Randomize Function
rndNumber = Int((RND * 4)+1)
If rndNumber = 1 then
Session("KeyCheck") = rndKey1
End If
If rndNumber = 2 then
Session("KeyCheck") = rndKey2
End If
If rndNumber = 3 then
Session("KeyCheck") = rndKey3
End If
If rndNumber = 4 then
Session("KeyCheck") = rndKey4
End If
This next part then takes the random number associated with the button the user clicks and compares it to button that was chosen:
If Request("Encrypt") <> Session("KeyCheck") Then
If it does not match the user is taken back to the logon screen. I cannot figure out why it works most of the time and then there are a few times where the user gets redirected back to the login page even though they clicked on the correct button.
Any help would be appreciated,
Jeff Harnisch
I am having a problem I think with session variables. On a page I have 4 buttons a user can click from and each of those buttons has a random number associated with it. When the timer reaches zero, one of the buttons is able to be clicked on and a user earns a credit. It works most of the time, However some times it does not store the correct random number for the button. Here is some of the code:
This picks which button will be allowed to click on:
Randomize Timer 'Randomize Function
rndNumber = Int((RND * 4)+1)
If rndNumber = 1 then
Session("KeyCheck") = rndKey1
End If
If rndNumber = 2 then
Session("KeyCheck") = rndKey2
End If
If rndNumber = 3 then
Session("KeyCheck") = rndKey3
End If
If rndNumber = 4 then
Session("KeyCheck") = rndKey4
End If
This next part then takes the random number associated with the button the user clicks and compares it to button that was chosen:
If Request("Encrypt") <> Session("KeyCheck") Then
If it does not match the user is taken back to the logon screen. I cannot figure out why it works most of the time and then there are a few times where the user gets redirected back to the login page even though they clicked on the correct button.
Any help would be appreciated,
Jeff Harnisch