Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old December 28th, 2001, 02:23 PM
RobM RobM is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2001
Posts: 1 RobM User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
document.write? Help please

Hi all.

I have installed a cookie to remember a users name and password.
I would like to show who is online. So far I can only show one user. <script>document.write(yourname)</script>

How can I show all names online, and or a users online count?

Thanks in advance

Rob

Reply With Quote
  #2  
Old January 7th, 2002, 12:32 AM
Pasiphae1213's Avatar
Pasiphae1213 Pasiphae1213 is offline
Web Developer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2001
Location: Pennsylvania
Posts: 171 Pasiphae1213 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to Pasiphae1213 Send a message via Yahoo to Pasiphae1213
Re:

I think you are oversimplifying the problem a little.
What you probably want isn't Java, or even JavaScript for that matter. Try using PHP and SQL to accomplish your task.

I never did this, and I dont think I will ever have the use for it, but I am going to just ramble off the top of my head as to how it should be done:

1. Set a session cookie whenever the user logs in.
2. When you write the session cookie, add their name to a table in your SQL database.
3. The page that contains the user count could contain a simple query to the database to fetch the number of rows in the table, which will then return number of users that have sessions currently set.
4. When you destroy the session cookie, delete that row from the table that contains the username.

That is putting a lot of extra work on the SQL server, and the webserver. You are looking at about a minumum of 3 queries per user, assuming they only see the count on ONE page. If the count is in a header or an included file, its another query everytime that file is loaded. All that to display a little number. Now if you are going to do some sort of instant messaging between online users or something like that, it might be worth it. But to display the number of users, it might be a little too much.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > document.write? Help please


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway