Display User Status?

This is a discussion on "Display User Status?" within the Classic ASP section. This forum, and the thread "Display User Status? are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > Classic ASP

Notices


Closed Thread
 
LinkBack Thread Tools
  #1 (permalink)  
Old Oct 12th, 2004, 02:54
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,608
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Send a message via Yahoo to Monie
Display User Status?

Hello everybody....

Its been so long since I tried to know the method used to display the status of the user that are currently online.
Is if involves a compleks programming to do this?

I am developing an INTRANET web system for my university.
I want to display the status of each user that have Registered/Logged On to the system by displaying the ONLINE or OFFLINE status.
Just like webforumz have used...:razz:

I have a page that will display all the list of the registered user,
at the end of each row, i want to display the ONLINE of OFFLINE status!

Can anybody give me a lecture on this...lol
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)

  #2 (permalink)  
Old Oct 12th, 2004, 09:44
Rob's Avatar
Rob Rob is offline
Head Admin & CEO

SuperMember
Join Date: Jul 2003
Location: at my desk
Age: 34
Posts: 2,952
Blog Entries: 7
Thanks: 7
Thanked 4 Times in 4 Posts
Send a message via MSN to Rob Send a message via Skype™ to Rob
Hi monie...

This will involve having an extra field in your database... something like member_LastActive.

Every time they hit a page on the intranet, you should update the field with the current date/time (use the now() function).

On you members page, you can simply query this field for each member... if the value is less than 10 or 15 minutes ago (or whatever period you think) then the user is online.

Hope this makes sense.
__________________
Rob - SEO Specialist
Owner & Founder of Webforumz.com

I am currently unavailable for private work
  #3 (permalink)  
Old Oct 12th, 2004, 11:24
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,608
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Send a message via Yahoo to Monie
Hemm......
I dont really understand the method!
If you have time, can you explain it to me further more
Thanx Rob.
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
  #4 (permalink)  
Old Oct 12th, 2004, 11:30
Rob's Avatar
Rob Rob is offline
Head Admin & CEO

SuperMember
Join Date: Jul 2003
Location: at my desk
Age: 34
Posts: 2,952
Blog Entries: 7
Thanks: 7
Thanked 4 Times in 4 Posts
Send a message via MSN to Rob Send a message via Skype™ to Rob
How does a user login right now?? He/she fills in a form and submits it right? You check the details he/she provided and validate them against your database..... right?

When displaying a page, how do you make sure you only show it to a member?
__________________
Rob - SEO Specialist
Owner & Founder of Webforumz.com

I am currently unavailable for private work
  #5 (permalink)  
Old Oct 13th, 2004, 01:43
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,608
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Send a message via Yahoo to Monie
Ok...let me start!
First of all, because my system will be used by quiet small numbers of user and for security purpose, the admin will provide a username and password to the user (in my case the lecturer, the only user to my system)
The information of the user (username & password) will be kept inside a database called userList.mdb

When they get their password and their username, they can logon to the system. All the validation I have successfully done.
(Invalid user, invalid password, invalid username...)

After they have successfully logged on to the system, there is a page where they can post their comment or complaint and later it will be display just like what webforumz do(like this page), at the bottom of their message, there will be an indicator indicating that they are online or offline.

so...do you follow me
thank for helping me Rob
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
  #6 (permalink)  
Old Oct 13th, 2004, 06:57
Rob's Avatar
Rob Rob is offline
Head Admin & CEO

SuperMember
Join Date: Jul 2003
Location: at my desk
Age: 34
Posts: 2,952
Blog Entries: 7
Thanks: 7
Thanked 4 Times in 4 Posts
Send a message via MSN to Rob Send a message via Skype™ to Rob
Everytime the lecturer hits a page, are you checking it IS in fact the lecturer? In other words, do you check for a valid login on each page he hits?
__________________
Rob - SEO Specialist
Owner & Founder of Webforumz.com

I am currently unavailable for private work
  #7 (permalink)  
Old Oct 13th, 2004, 12:09
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,608
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Send a message via Yahoo to Monie
Hai Rob,
Actually I dont really understand what you really mean.

Basically, once the lecturer has logged on to the system, they can go to any other page that i have provided.

The only reason I provide the login is basically to avoid any student that are trying to access the system and them make any room reservation purposely.
(my system is about ROOM RESERVATION)

Did you ask me for that Q?
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
  #8 (permalink)  
Old Oct 13th, 2004, 12:26
Rob's Avatar
Rob Rob is offline
Head Admin & CEO

SuperMember
Join Date: Jul 2003
Location: at my desk
Age: 34
Posts: 2,952
Blog Entries: 7
Thanks: 7
Thanked 4 Times in 4 Posts
Send a message via MSN to Rob Send a message via Skype™ to Rob
<blockquote id="quote" class="ffs">quote:<hr height="1" noshade="noshade" id="quote" />Basically, once the lecturer has logged on to the system, they can go to any other page that i have provided.<hr height="1" noshade="noshade" id="quote" /></blockquote id="quote">This is what I am talking about. When you say they can go to any other page, how does that 'other' page MAKE SURE it is the lecturer, instead of someone just guessing the URL ?
__________________
Rob - SEO Specialist
Owner & Founder of Webforumz.com

I am currently unavailable for private work
  #9 (permalink)  
Old Oct 14th, 2004, 01:50
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,608
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Send a message via Yahoo to Monie
Ohhh...
Actually, i dont have that! Is it a session variable?
I didn't think of it before...!

So, that means, when the student remember the lecturer url page
(the url address after they have successfully logged on), they can just type the url, and they can access the system!
Oh my god! This is a big trouble for me...!

Can you help me Rob?
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
  #10 (permalink)  
Old Oct 14th, 2004, 08:40
Rob's Avatar
Rob Rob is offline
Head Admin & CEO

SuperMember
Join Date: Jul 2003
Location: at my desk
Age: 34
Posts: 2,952
Blog Entries: 7
Thanks: 7
Thanked 4 Times in 4 Posts
Send a message via MSN to Rob Send a message via Skype™ to Rob
the check you are performing to make sure the lecturer entered the right login details.....
just make sure the same check is performed on each page.

Store the credentials in either session vars, or a cookie..... and request them on each page to compare to the database. There are of course many other ways of implementing security.... better security, but for an intranet I think this should suffice.
__________________
Rob - SEO Specialist
Owner & Founder of Webforumz.com

I am currently unavailable for private work
  #11 (permalink)  
Old Oct 15th, 2004, 01:54
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,608
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Send a message via Yahoo to Monie
Hai Rob...well actually, I have put this code on the top of my page so that any invalid user cannot get into the system without going through the login process.
Actually, I dont know the capability of this code that can detect any invalid user until I tried them just now!(entering the url)

When they type any url from the system, they will be redirect to session_ended.asp page

So...I have solve my problem!
Can we proceed with our DISPLAY USER STATUS discussion...

Code: Select all
<%
	Response.CacheControl = "no-cache"
	Response.AddHeader "Pragma", "no-cache"
	Response.Expires = -1
	If Session("user") = "" Then
	Response.Redirect("session_ended.asp")
	end if
%>
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
  #12 (permalink)  
Old Oct 15th, 2004, 09:54
Rob's Avatar
Rob Rob is offline
Head Admin & CEO

SuperMember
Join Date: Jul 2003
Location: at my desk
Age: 34
Posts: 2,952
Blog Entries: 7
Thanks: 7
Thanked 4 Times in 4 Posts
Send a message via MSN to Rob Send a message via Skype™ to Rob
Ok, now I have the REQUIRED information, I can proceed to help you.
The code you posted would need to be amended a little to make this work, so something like this should suffice.... note, I use pseudo code, and not real code... I make the assumption that you have a database and know how to connect.
Code: Select all
<%
    Response.CacheControl = "no-cache"
    Response.AddHeader "Pragma", "no-cache"
    Response.Expires = -1
    If Session("user") = "" Then
       Response.Redirect("session_ended.asp")
    else
       ' Code to connect to the Database and update 
       ' a 'Last Active' field with the current date and time
    end if
%>
The above will obviously update your lecturers last active time in the database EVERY time he hits a protected page.

On the page where you want to show the online status, simply request the last active field..... if it falls between 10 or 20 minutes (or whatever you decide) of the current time, then it is assumed your lecturer is online.

I hope this helps you.
__________________
Rob - SEO Specialist
Owner & Founder of Webforumz.com

I am currently unavailable for private work
  #13 (permalink)  
Old Oct 17th, 2004, 12:00
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,608
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Send a message via Yahoo to Monie
<blockquote id="quote" class="ffs">quote:<hr height="1" noshade="noshade" id="quote" />
' Code to connect to the Database and update
' a 'Last Active' field with the current date and time
<hr height="1" noshade="noshade" id="quote" /></blockquote id="quote">
I am lost at this part Rob:mad:
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
  #14 (permalink)  
Old Oct 17th, 2004, 12:05
benbacardi's Avatar
Highly Reputable Member
Join Date: Feb 2004
Location: United Kingdom
Age: 20
Posts: 611
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to benbacardi Send a message via Skype™ to benbacardi
here you have to connect to the database (you obviously know how to do that because you've done it before) and use an insert statement to add the current date and time into a field in the database called something like LastActive eg:

Code: Select all
date = Now()
"INSERT INTO lecturers (LastActive) VALUES (date) WHERE lecturerid='" & lecturerid & "'"
at least, that is what i would try.... im new to this ASP stuff too!
  #15 (permalink)  
Old Oct 17th, 2004, 12:11
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,608
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Send a message via Yahoo to Monie
<blockquote id="quote" class="ffs">quote:<hr height="1" noshade="noshade" id="quote" />
date = Now()
"INSERT INTO lecturers (LastActive) VALUES (date) WHERE lecturerid='" & lecturerid & "'"
<hr height="1" noshade="noshade" id="quote" /></blockquote id="quote">
Ok...
LastActive is the field in my database to store the time..right?
What about this: lecturerid='" & lecturerid & "'"?
I dont understand the bolded part! is it the unique or primary key for the lecturer?

After I have success doing that,
What about the code to display the user status (ONLINE @ OFFLINE)
I dont know how to request them from the database?
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
  #16 (permalink)  
Old Oct 17th, 2004, 14:00
benbacardi's Avatar
Highly Reputable Member
Join Date: Feb 2004
Location: United Kingdom
Age: 20
Posts: 611
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to benbacardi Send a message via Skype™ to benbacardi
to check who the lecturer signing in is, you must have a field in your database with the lecturers name or id? if so, then that is the record that you want to update with the time, right? so you must have some way of knowing what lecturer is signed in, then adding that value to the WHERE part of the statement so the database knows which record to update...

i have also just realised it needs to be an update statement:
Code: Select all
rightnow = Now()
"UPDATE lecturer SET LastActive = " & rightnow & " WHERE lecturerid = '" & lecturerid & "'"
does that help? of course, you then have to execute that statement...
  #17 (permalink)  
Old Oct 17th, 2004, 15:06
Rob's Avatar
Rob Rob is offline
Head Admin & CEO

SuperMember
Join Date: Jul 2003
Location: at my desk
Age: 34
Posts: 2,952
Blog Entries: 7
Thanks: 7
Thanked 4 Times in 4 Posts
Send a message via MSN to Rob Send a message via Skype™ to Rob
Monie....

You appear to be getting stuck on VERY basic things... whilst we are obviously going to continue helping you, you really should in addition, buy a book!

This will serve as an invaluable tool for 'the basics'
__________________
Rob - SEO Specialist
Owner & Founder of Webforumz.com

I am currently unavailable for private work
  #18 (permalink)  
Old Oct 29th, 2004, 04:18
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,608
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Send a message via Yahoo to Monie
Hai benbacardi...
I have been trying to do this code but I cannot make it works!
Could you help debugging the code...I dont know if the code is in the correct syntax or not!

I place this code at the top of all my page to check an invalid user that are trying to access the page without logging in!
When they are success, I want to update a field to store the current time ("LastActive" field)

When the user login, I ask for their Username and password!
and then, reffering to this username, update the LastActive field!
Code: Select all
<%@LANGUAGE="VBSCRIPT"%>
<% Option Explicit %> 
<%
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1
If Session("admin") = "" Then
Response.Redirect("session_ended.asp")
else

    Dim conn,admin,rightnow,user
    set conn=Server.CreateObject("ADODB.Connection")
    conn.Provider="Microsoft.Jet.OLEDB.4.0"
    conn.Open(Server.Mappath("database\users.mdb"))
    set admin = Server.CreateObject("ADODB.recordset")
	 
	user=Request.Form("txtusername") <%--txyusername is an input username in the login page-->
	rightnow = Now()
	admin.open "UPDATE userlist SET LastActive = " & rightnow & " WHERE username = " & user & ""
	'THIS IS THE ERROR THAT I GOT: The connection cannot be used to perform this operation. It is either closed or invalid in this context
end if
%>

<html>
<head>
..
..
..
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Closed Thread

Tags
display, user, status

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Status of IE cedric813 JavaScript Forum 1 Oct 21st, 2007 17:38
[SOLVED] Show "Image" Depends On User "Status"? Monie Classic ASP 6 Oct 16th, 2007 01:22
[SOLVED] User Last Visit Status Monie Classic ASP 3 Oct 10th, 2007 03:03
Status Bar Display Brakers Starting Out 0 Jul 22nd, 2007 14:04


All times are GMT. The time now is 05:02.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43