Who is logged in, please help

Newbie81

Member
Joined
Nov 7, 2006
Messages
12
Programming Experience
Beginner
Hello all,

I have created a succesful login, that verifies users email and password. Once the user logs in, i want a table displaying all the current users who are logged on using a dynamic table. I have made a start with the table, but i dont know how to display the current users who are logged on.

This is what i have done:

Dim cmd As SqlCommand = SqlConnection1.CreateCommand
cmd.Connection = SqlConnection1
cmd.CommandType = CommandType.Text
cmd.CommandText = "SELECT * "
'Forename, Surname, Password,ID
cmd.CommandText &= "FROM Schoolmates "
'cmd.CommandText &= "WHERE Email ='" & UCase(Trim(txtEmail.Text)) & "'"
'cmd.CommandText &= "And Password ='" & UCase(Trim(txtPassword.Text)) & "'"
Dim dsAdapter As New SqlDataAdapter
Dim dsDataset As New DataSet
dsAdapter.SelectCommand = cmd
dsAdapter.Fill(dsDataset)


Response.Write("Number of rows:" & dsDataset.Tables(0).Rows.Count)
Dim rowNumber As Int16
For rowNumber = 0 To dsDataset.Tables(0).Rows.Count - 1
If UCase(dsDataset.Tables(0).Rows(rowNumber).Item("Email")) = UCase(Trim(txtEmail.Text)) AndAlso UCase(dsDataset.Tables(0).Rows(rowNumber).Item("Password")) = UCase(Trim(txtPassword.Text)) Then
Response.Write("User's surname " & dsDataset.Tables(0).Rows(rowNumber).Item("Surname") & "<BR>")
Else
Response.Write("Password you entered was incorrect." & dsDataset.Tables(0).Rows(rowNumber).Item("email") & "<BR>")
End If
Next rowNumber
Response.Write("<BR>")
Response.Write("<BR>")
Response.Write("<BR>")
Response.Write("<BR>")
Response.Write("<Table border=1><tr><td>Fore Name</td><td>Sur Name</td><td>Phone</td><td>Email</td></tr>")
Response.Write("<tr>")
Response.Write("<td>" & dsDataset.Tables(0).Rows(1).Item("Forename") & "</td>")
Response.Write("<td>" & dsDataset.Tables(0).Rows(1).Item("Surname") & "</td>")
Response.Write("<td>" & dsDataset.Tables(0).Rows(1).Item("Telephone") & "</td>")
Response.Write("<td>" & dsDataset.Tables(0).Rows(1).Item("Email") & "</td></tr>")
Response.Write("</table>")

SqlConnection1.Close()
SqlConnection1 =
Nothing
End Sub

I thank you all you experts in advance.
 
I recently implemented a similar system. Upon logon the program writes an entry into a table of a logon time, and NULL logoff time for the user.

SELECT * FROM user_logons WHERE logoff_time is NULL

Brings a list of all logged on users
 
Thank you

Thank you for your reply. I have implemented a column called "status" using boolean values....How did you actually get it to write an entry everytime the user logs on? For example, everytime a user logs on, i want to display 1 or true.

Sorry I am completely new at this. Thank you for your help and understanding.
 
My brief was to create an application that runs when the user logs into windows. It appears that your brief is somewhat different; that they are logging into a web application. In either case there is a definite event that occurs; mine was the application starting up, yours will be the success of the login process. At that time, is when you should insert a record into the table of logins
 
Back
Top