Flicks FAQ: Signup90db

Back to the top of the FAQ

How to sign up users for 90 days, using ASP and an ODBC database.

First create a database that contains a table with a username field, a password field and a date field.
Here is a sample Access database.
For simplicity the example given uses this Access database.

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.

Setup this database up as a System DSN

Protect the directory using AuthentiX, by ODBC and with a custom select statement,

Set the password field to be password and the username field to be username.

Set the FROM field to be
FROM Users WHERE ((Users.DateField)>Now()) AND

                   [MS SQL note: use getdate() instead of now() ]

Then check by hand that existing non-expired users can get access to the directory, and that existing expired users cannot. Note that if you have Access open at the time you are trying to validate users, they will not validate, because Access is holding the database open. Close Access first.

Create a file to collect the username and password:


<FORM METHOD="POST" ACTION="/scripts/sampleSignupProcessDB.asp">
<INPUT SIZE=30 NAME="username" MAXLENGTH=200> 
: <font color=blue>User Name</font>

<INPUT SIZE=30 NAME="password" MAXLENGTH=200> 
: <font color=blue>Password</font>
<INPUT TYPE=submit VALUE="Submit">

Then use the following ASP file to collect the data, add the user to the ODBC database, setting their expiration to 90 days from now.

<!--#INCLUDE FILE = "adovbs.inc"-->

ConnectionString = "DSN=InnerJoin;
DriverId=25;FIL=MS Access;

passwordField = "password"
userField = "username"
datefield = "datefield"
dataTable = "Users"

numberOfDays = 90

username = Request.Form("username")

if ("" = username) then
	response.Write("Empty Username")
End if

password = Request.Form("password")

if ("" = password) then
	response.Write("Empty password")
End if

Set Conn = Server.CreateObject("ADODB.Connection")

Conn.Open ConnectionString,"",""

' Create ADO Recordset Component, and associate // it with ADO connection  

Set oRs = Server.CreateObject("ADODB.Recordset")
oRs.ActiveConnection = Conn
' Get empty recordset  
oRs.Source = "SELECT * FROM " & dataTable & " Where 1=2"
oRs.CursorType = adOpenStatic
oRs.LockType = adLockOptimistic

oRs(userField).Value = username
oRs(passwordField).Value = password
oRs(datefield).Value = now + 90



Back to the top of the FAQ