79696094

Date: 2025-07-09 18:33:55
Score: 0.5
Natty:
Report link

It’s because you're redeclaring loginSuccess inside the If, so VBScript treats it like a new local variable there, exactly like what @Shrotter said

You could try moving the Dim loginSuccess outside the If block

It should look something like this:

Dim username
Dim loginSuccess

username = InputBox("Enter your name:")

If username = "admin" Then
    loginSuccess = True
    MsgBox "Welcome, admin!"
Else
    loginSuccess = False
    MsgBox "Access Denied"
End If

If loginSuccess Then
    MsgBox "You're logged in"
Else
    MsgBox "Login failed"
End If
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @Shrotter
  • Low reputation (0.5):
Posted by: Altxxr0