%
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
FRIENDS
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%>