%
' Contact your provider for support, NOT flicks software
' http://www.flicks.com/support/
' http://www.flicks.com/authentix/intro.htm
' You may use this program freely so long as it is in conjuction with a product from Flicks Software
'======
'====== These values will ALWAYS need to be set for each customer
'======
DEFAULT_GROUP_NAME = "Group1" ' set this to the appropriate AuthentiX group, if not passed in via form
' set mailserver = "" to turn off email messages
mailserver = ""
'mailserver = "your.mailserver.com"
webmaster = "you@mailserver.com"
okToAddUserIfAlreadyThere = false
enableLogging = true
'======
'====== The above values will ALWAYS need to be set for each customer
'======
' change this value if you are using AuthentiX ISP
usingAuthentiXStandard = true
if (usingAuthentiXStandard) then
Set auth = Server.CreateObject("AUTHXOCX.AuthXOCXCtrl.1")
else
Set auth = Server.CreateObject("AUTHXISP.AuthXOCXCtrl.1")
' use this line to automatically set the domain to be the requesting IP
protectedDomain = Request.ServerVariables("LOCAL_ADDR")
' use this alternative if you are protecting by host header,
' set protectedDomain to be -your- host header
'protectedDomain = "hostheader.com"
auth.SetVirtualDomain protectedDomain, Request.ServerVariables("SCRIPT_NAME")
' check with your isp for your password, initially it is empty
auth.SetVirtualDomainPassword("")
end if
'--- These values set on a per provider basis
ADMINPWORD = "set password here"
ADD_ACTION_CODE = "A" ' input converted to uppercase
DELETE_ACTION_CODE = "R" ' input converted to uppercase
EXISTS_ACTION_CODE = "EXISTS"
LIST_ACTION_CODE = "LIST"
VERSION_ACTION_CODE = "VERSION"
SUCCESS_MESSAGE = "done"
ERROR_PREFIX = "error: "
Set username = Request.Form("username")
Set password = Request.Form("password")
Set action = Request.Form("action")
Set expireDays = Request.Form("expiredays") ' number of days
Set groupname = Request.Form("cgi_var1")
Set systemPassword = Request.Form("webmpass")
notes = ""
if (ADMINPWORD <> systemPassword) Then
errorMessage = ERROR_PREFIX & " security"
errorOut(errorMessage)
response.End
End if
' you can also check the incoming remote address with Request.ServerVariables("REMOTE_ADDR")
if (isnull(groupname) or (groupname = "")) then
Set groupname = Request.Form("sitename")
end if
if (isnull(groupname) or (groupname = "")) then
Set groupname = Request.Form("siteid")
end if
if (isnull(groupname) or (groupname = "")) then
groupname = DEFAULT_GROUP_NAME
end if
if (isnull(expireDays) or (0 = expireDays)) then
expireDate = 0 ' never
else
expireDate = now + expireDays
end if
if (not isnull(action)) then action = trim(ucase(action))
if (action = ADD_ACTION_CODE) then
if (isnull(username) or (username = "")) Then
errorMessage = ERROR_PREFIX & " empty username"
errorOut(errorMessage)
response.End
End if
errorCode = auth.UserAdd(username, password, notes, expireDate)
if (errorCode <> 0) then
if ((errorCode = 3) and (okToAddUserIfAlreadyThere)) then
'nothing - continue and add to group anyway
else
errorMessage = ERROR_PREFIX & " User could not be added, username: *" & username & "* password: *" & password & "*, code is " & errorCode
errorOut(errorMessage)
response.End
End if
End if
errorCode = auth.GroupAddUser(groupname, username)
if (errorCode <> 0) then
errorMessage = ERROR_PREFIX & " User could not be added to group: " & groupname & ", username: *" & username & "* password: *" & password & "*, code is " & errorCode
errorOut(errorMessage)
response.End
End if
Response.Write(SUCCESS_MESSAGE)
Response.End
end if
if (action = DELETE_ACTION_CODE) then
Dim userList
userList = Split(username, ":")
for counter = 0 To UBound(userList)
' response.Write("
" & counter & ": " & userList(counter))
' just attempt to delete them all
singleUsername = userList(counter)
if (isnull(singleUsername) or (singleUsername = "")) Then
' ignore
else
errorCode = auth.UserDelete(singleUsername)
end if
Next
' errorCode = auth.UserDelete(username)
' if (errorCode <> 0) then
' errorMessage = ERROR_PREFIX & " User could not be deleted, username: *" & username & "*, code is " & errorCode
' errorOut(errorMessage)
' else
' Response.Write(SUCCESS_MESSAGE)
' End if
Response.End
End if
if (action = EXISTS_ACTION_CODE) then
if (auth.UserLookup(username) = 0) then
Response.Write(SUCCESS_MESSAGE)
else
errorMessage = ERROR_PREFIX & " does not exist"
response.Write(errorMessage)
end if
Response.End
End if
if (action = LIST_ACTION_CODE) then
i = 0
Response.Write("