<% ' Edit these variables strRedirect = "http://www.mikegoulian.com/eventorganizer/event_organizers.html" strRealm = "mikegoulian.com" ' Enter in username that allows access Dim strUsername strUsername = "mikegoulian" ' Enter in password that allows access Dim strPassword strPassword = "cap232" ' do not edit below this ------------------------------------ ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Dim UID, PWD GetUser UID, PWD If UID = "" Then Response.Status = "401 Unauthorized" Response.AddHeader "WWW-Authenticate","BASIC Realm=" & strRealm End If If UID = strUsername And PWD = strPassword Then Response.Redirect(strRedirect) Else Response.Write "If you are an Event Organizer, please contact mike@mikegoulian.com for password." End If Sub GetUser(LOGON_USER, LOGON_PASSWORD) Dim UP, Pos, Auth Auth = Request.ServerVariables("HTTP_AUTHORIZATION") LOGON_USER = "" LOGON_PASSWORD = "" If LCase(Left(Auth, 5)) = "basic" Then UP = Base64Decode(Mid(Auth, 7)) Pos = Instr(UP, ":") If Pos > 1 Then LOGON_USER = Left(UP, Pos - 1) LOGON_PASSWORD = Mid(UP, Pos + 1) End If End If End Sub ' Decodes a base-64 encoded string. Function Base64Decode(Byval base64String) 'rfc1521 Const Base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" Dim dataLength, sOut, groupBegin 'remove white spaces, if any base64String = Replace(base64String, vbCrLf, "") base64String = Replace(base64String, vbTab, "") base64String = Replace(base64String, " ", "") 'The source must consists from groups with len of 4 chars dataLength = Len(base64String) If dataLength Mod 4 <> 0 Then Err.Raise 1, "Base64Decode", "Bad Base64 string." Exit Function End If ' Now decode each group: For groupBegin = 1 To dataLength Step 4 Dim numDataBytes, CharCounter, thisChar, thisData, nGroup, pOut ' Each data group encodes up To 3 actual bytes. numDataBytes = 3 nGroup = 0 For CharCounter = 0 To 3 ' Convert each character into 6 bits of data, And add it To ' an integer For temporary storage. If a character is a '=', there ' is one fewer data byte. (There can only be a maximum of 2 '=' In ' the whole string.) thisChar = Mid(base64String, groupBegin + CharCounter, 1) If thisChar = "=" Then numDataBytes = numDataBytes - 1 thisData = 0 Else thisData = Instr(Base64, thisChar) - 1 End If If thisData = -1 Then Err.Raise 2, "Base64Decode", "Bad character In Base64 string." Exit Function End If nGroup = 64 * nGroup + thisData Next 'Hex splits the long to 6 groups with 4 bits nGroup = Hex(nGroup) 'Add leading zeros nGroup = String(6 - Len(nGroup), "0") & nGroup 'Convert the 3 byte hex integer (6 chars) to 3 characters pOut = Chr(CByte("&H" & Mid(nGroup, 1, 2))) + _ Chr(CByte("&H" & Mid(nGroup, 3, 2))) + _ Chr(CByte("&H" & Mid(nGroup, 5, 2))) 'add numDataBytes characters to out string sOut = sOut & Left(pOut, numDataBytes) Next Base64Decode = sOut End Function %>