%
public function validateCharacter(char,byref result)
validChars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!?"
if (InStr(validChars,char) > 0) THEN
result = 1
ELSE
result = 0
END IF
END FUNCTION
public function validateDance(danceCode, byref result)
result = 1
IF (danceCode="") THEN
result = -1
END IF
testCode = Replace(danceCode," ","")
IF (LEN(testCode)<>9) THEN
result = -2
END IF
index = 1
DO WHILE (index<= LEN(danceCode))
validateCharacter Mid(danceCode,index,1), charResult
IF (charResult=0) THEN
index = LEN(danceCode)+10
result = -2
END IF
index=index+1
LOOP
end function
%>
<%
Actionvar=Request.QueryString("actionvar")
Set conn = server.createobject("adodb.connection")
DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)}; "
DSNtemp=dsntemp & "DBQ=" & server.mappath("tap.mdb")
conn.Open DSNtemp
'If the QueryString has the Actionvar = add then generate
'the page for adding items
IF Actionvar="add" THEN
IF Len(TRIM(request.form("flag"))) = 0 THEN
%>
To add your dance to the archive, launch Tap on your PDA, then choose the Perform menu, then Favorite Dances. Select the dance you wish to share, then tap Choose Dance. You will see a dance code listed: please enter the 9 characters without spaces, add a description, and if you wish, your name.
Description:
Your Name (optional):
<%
ELSEIF Request.Form("flag")="2" THEN
validateDance request("code"),result
IF result= -1 then
response.Write("
Please enter a dance code.")
response.End
END IF
IF result= -2 THEN
response.Write("
Your dance code isn't valid. Please compare it to the one listed on your PDA.
")
response.End
END IF
if request("descr")="" then
response.Write("
Please enter a description.
")
response.End
end if
rem if request("usrname")="" then
rem response.Write("
Please enter a name or nickname.")
rem response.End
rem end if
SQLstmt = "INSERT INTO dances (code,descr,usrname,insertdate)"
SQLstmt = SQLstmt & " VALUES ('" & request.form("code") & "','" & request.form("descr") & "','" & request.form("usrname") & "','" & date & "')"
conn.execute(SQLstmt)
%>
<%
END IF
'If the QueryString Actionvar isn't set to anything, generate the list of dances
ELSE
SQLstmt = "SELECT * FROM dances ORDER BY insertdate DESC"
%>
The following dances have been contributed by Tap users. To load the dance onto your PDA, start the Tap appplication, select the Practice menu, then Enter Dance Code. Enter the nine digit code, then tap Show Dance. The Tap application will automatically decode the dance code and save the dance into your list of Favorite Dances.
If you would like to contribute a dance to the archive, please click here.
<%
page=1
pageStr = request("page")
IF (pageStr<>"") THEN
page=CInt(pageStr)
END IF
itemsPerPage = 20
startIndex = ((page-1)*itemsPerPage)+1
endIndex = ((page)*itemsPerPage)
Set rs = conn.Execute(SQLstmt)
%>
Dance Code
Description
Name
Date Posted
<%
x=0
DO WHILE NOT rs.EOF
x=x+1
Recid = rs("ID")
code = rs("code")
descr = rs("descr")
usrname = rs("usrname")
insertdate = rs("insertdate")
IF (x>= startIndex AND x<=endIndex) THEN
%>
<%=code%>
<%=descr%>
<%=usrname%>
<%=insertdate%>
<%
END IF
rs.MoveNext
LOOP
RS.Close
%>
<%
rem **********************************************************
rem deal with next/prev
IF page>1 THEN
%>
Previous
<%
END IF
IF page>1 OR x>endIndex THEN
numPages = x/itemsPerPage
IF (x MOD itemsPerPage>0) THEN
numPages = numPages+1
END iF
p=1
DO WHILE (p<=numPages)
IF (p=page) THEN
%>
<%=p%>
<%
ELSE
%>
<%=p%>
<%
END IF
p=p+1
LOOP
END IF
IF x>endIndex THEN
%>
Next
<%
END IF
rem End next/prev stuff
rem **********************************************************
END IF
conn.Close
Set conn = nothing
Set SQLstmt = nothing
%>