<% 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 %> Tap - Dance Archive

Dance Archive
<% 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.
Dance Code:
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) %>

Thank you. Please click here to return to the dance archive.
<% 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) %> <% 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 %> <% END IF rs.MoveNext LOOP RS.Close %>
<% rem ********************************************************** rem deal with next/prev IF page>1 THEN %>