Miscellaneous
  Home arrow Miscellaneous arrow Show the Number of Users Online
Codewalker Forums 
  Tutorials  
Database Articles  
Miscellaneous  
Navigation Usability  
PEAR Articles  
Programming Basics  
Server Administration  
XML Tutorials  
  Reviews  
Database Book Reviews  
Linux Book Reviews  
Miscellaneous Reviews  
PHP Book Reviews  
PHP Software Reviews  
Server Admin Reviews  
SQL Tool Reviews  
  Code Gallery  
Content Management Code  
Contest Code  
Counters Code  
Database Code  
Date Time Code  
Discussion Board Code  
Email Code  
File Manipulation Code  
GUI Code  
Link Farm Code  
Miscellaneous Code  
Search Code  
Site Navigation Code  
User Management Code  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Download TestComplete 
Forums Sitemap 
Weekly Newsletter 
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
MISCELLANEOUS

Show the Number of Users Online
By: Codewalkers
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 4
    2002-07-08

    Table of Contents:
  • Show the Number of Users Online
  • The Code

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Show the Number of Users Online


    (Page 1 of 2 )

    Learn how to show the number of users on your site who are online using the power of PHP.

    By : Akash Goel

    This tutorial has been graciously provided by spoono.com

    This script will explain how to display the number of users online using your website. You have to put this on everypage you want it to appear. It can be broken down into 2 sections. The first is creating the table, and the second is the PHP script itself. Beware you should have knowledge of PHP before attempting this. We also reccommend you have PhpMyAdmin :)

    Alright log on to PhpMyAdmin and make a new database called "users". We are going to insert 3 fields into a new table called useronline called timestamp, ip, and file. Lets dump the following code into the Users database using the form on the PhpMyAdmin page:

    CREATE TABLE useronline (
        timestamp int(15) DEFAULT '0' NOT NULL,
        ip varchar(40) NOT NULL,
        file varchar(100) NOT NULL,
        PRIMARY KEY (timestamp),
        KEY ip (ip),
        KEY file (file)
    );

    Alright Now lets create the PHP script. Its rather large and lets hope you can follow along. Here is what we'll do in English: 1. Give the server info. 2. Get the time. 3. Insert the values of the person thats online into the mySQL, then create the Failed response if it failed. 4. Do the same thing but delete the user from the database when he leaves 5. Grab the results. 6. Output the results.

    More Miscellaneous Articles
    More By Codewalkers


       · I don't know but it seems to me that this doesn't teach you how to do this, it just...
     

    MISCELLANEOUS ARTICLES

    - Using PHP to Stream MP3 Files and Prevent Il...
    - 10 Must Have Firefox Improvements
    - All About OpenOffice 3.0
    - Shell Script Writing
    - Loops in the UNIX Shell
    - The Test in the UNIX Shell
    - Data Streams and the UNIX Shell
    - Control Mechanisms of the UNIX Shell
    - Variables Within the UNIX Shell
    - The Shell and UNIX
    - In Detail: UNIX File Systems
    - Rights Management in UNIX
    - UNIX File Systems
    - The Terminal in UNIX
    - Operating Systems and UNIX





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek