Miscellaneous

  Home arrow Miscellaneous arrow Show the Number of Users Online
MISCELLANEOUS

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

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

  •  
     

    SEARCH CODEWALKERS

    TOOLS YOU CAN USE

    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

    blog comments powered by Disqus

    MISCELLANEOUS ARTICLES

    - Oracle Database XE: Indexes and Sequences
    - Modifying Tables in Oracle Database XE
    - Oracle Database XE: Tables and Constraints
    - More on Oracle Databases and Datatypes
    - Oracle Database XE Datatypes: Datetime and L...
    - Oracle Database XE Datatypes: Character and ...
    - From Databases to Datatypes
    - Firefox 3.6.6 Released with Improved Plug-in...
    - Attention Bloggers: WordPress 3.0 Now Releas...
    - Reflection in PHP 5
    - Inheritance and Other Advanced OOP Features
    - Advanced OOP Features
    - Linux from Scratch V.6.6 Review
    - Linux Gaining in Strength
    - Install Slackware on Your Old PC


    © 2003-2012 by Developer Shed. All rights reserved. DS Cluster 9 - Follow our Sitemap