<% Option Explicit Dim sql,rsUsers,rsUser,username,startletter,alphabet username = Request.Cookies("username") startletter = Request.QueryString("startletter") 'Example of protecting a page for members only if username = "" then Response.Redirect("nologin.asp?page=userview.asp") end if 'If no letter has been clicked (this is 1st visit), start displaying at letter A if startletter = "" then startletter = "A" end if %> <% 'If 123 option is chosen, pick all records that don't start with a letter (this makes a BIG sql string) if startletter = "nonalphabet" then sql = "SELECT username, icon FROM users WHERE username Not Like 'a%'" for alphabet = 98 to 122 sql = sql & " AND username Not Like '" & chr(alphabet) & "%'" next sql = sql & " ORDER BY username" 'Otherwise just get the users that start with the chosen letter else sql = "SELECT username, icon FROM users WHERE username Like '" & startletter & "%' ORDER BY username" end if Set rsUsers = Server.CreateObject("ADODB.Recordset") rsUsers.Open sql, conn, 3, 3 sql = "SELECT icon FROM Users WHERE username = '" & username & "'" Set rsUser = Server.CreateObject("ADODB.Recordset") rsUser.Open sql, conn, 3, 3 %> User List





Here's a listing of all signed-up members. Clicking the letters along the top shows names starting with that letter. You can message someone else by clicking on the envelope icon.

123 <%'Loop through alphabet (chars 65 to 90 are A-Z) for alphabet = 65 to 90%> <%=chr(alphabet)%>
<%if not rsUsers.EOF then%> <%rsUsers.Movefirst do until rsUsers.EOF%> <%rsUsers.Movenext loop%>
Username Icon Contact
<%=rsUsers("username")%> _small.gif" width="20" height="20"> ">send a message to <%=rsUsers(" border=0 hspace="10">send message
<%'If no users, give a message else%>

Sorry, there's no users starting with the letter <%=startletter%>.

<%end if%>

Back to home page

<% rsUsers.close set rsUsers = nothing rsUser.close set rsUser = nothing conn.close set conn = nothing %>