How to sign up users for 90 days, using ASP and the internal database.
Signing up users that expire after a given time period is very easy using
the windows GUI or the remote administration module.
When you add a new user, merely specify the expiration date.
If you want to automatically schedule an email to remind the user (or yourself)
a few days before they expire, try
ocxQmail, available separately, and its
SendAt method.
Here is how to do this automatically using an ASP script:
First create a page that collects the username and password:
<html><head>
<FORM METHOD="POST" ACTION="/scripts/sampleSignupProcess.asp">
<INPUT SIZE=30 NAME="username" MAXLENGTH=200>
: <font color=blue>User Name</font>
<P>
<INPUT SIZE=30 NAME="password" MAXLENGTH=200>
: <font color=blue>Password</font>
<P>
<INPUT TYPE=submit VALUE="Submit">
</FORM>
</body></html>
Then use the following ASP file to collect the data, add the user to the internal database,
and set their expiration to 90 days from now.
<%
' Set this variable to be the AuthentiX group which is allowed
' access to the protected directory
authorizingGroup = "SampleGroup"
' Set this to be the number of days of permitted access,
' 0 for no expiration
numberOfDays = 90
' Set this to be the downloadArea
downloadArea = "http://www.yourdomain.com/members/"
' fire up AuthentiX OCX object
Set auth = Server.CreateObject("AUTHXOCX.AuthXOCXCtrl.1")
username = Request.Form("username")
if ("" = username) then
response.Write("Empty Username")
response.End
End if
password = Request.Form("password")
addResult = auth.GroupAddNewUser(authorizingGroup, username, password, "", 0)
if (3 = addResult) Then
' user already exists, maybe user has accessed other areas and
' now wants access to this dir
addResult = auth.GroupAddUser(authorizingGroup, username)
' override the random password with the stored one
auth.UserPassword(username) = password
End If
if (0 <> numberOfDays) Then
' Timeout users after a set period
if (auth.UserExpiration(email_address) = Empty) Then
' if not already set then set it
result = auth.UserModify(username, _
username, _
password, _
"", _
now + numberOfDays)
End If
End If
select case addResult
case 1
response.Write("Group does not exist.")
case 2
response.Write("Operation failed.")
case 0
response.Write("Operation succeeded.")
End Select
%>
</BODY>
</HTML>
|