Programming Tools
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingProgramming Tools

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old April 27th, 2002, 11:35 PM
mytch mytch is offline
Dev Articles Novice (500 - 999 posts)
 
Join Date: Apr 2002
Location: Sydney, Australia
Posts: 589 mytch User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Exclamation Article Discussion: Finding How Many Users Are On Your Site With PHP

Finding How Many Users Are On Your Site With PHP If you have any questions or comments on this article then please post them here.

You can read the article here .

Reply With Quote
  #2  
Old May 1st, 2002, 06:35 AM
anthony_irl anthony_irl is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Ireland
Posts: 13 anthony_irl User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Maybe there shoulda been a file to delete the entries after a certain amount of time. I know it's easy to implement but newbies might miss it completely and end up with a huge table of users.

Otherwise a great article.

Reply With Quote
  #3  
Old May 1st, 2002, 07:38 AM
cypher cypher is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2002
Location: Perth, Western Australia
Posts: 3 cypher User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to cypher
How would I make a script that deletes all th entries b4 a certain date... automactically say every 14days..

Reply With Quote
  #4  
Old May 1st, 2002, 07:57 AM
cypher cypher is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2002
Location: Perth, Western Australia
Posts: 3 cypher User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to cypher
actually all entries b4 todays date..

Reply With Quote
  #5  
Old May 1st, 2002, 07:20 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
i dont have time to write the actuall code for it, but the method i would use would be a text file,

for example (this is not in php, just a genralisation)

if(filedate = todaysdate)
then
database has already been scaned for old entries
else
remove old entries
update file date to today

end

something like that should do the job, only needs basic php to do

hope it helps you get an idea

Reply With Quote
  #6  
Old May 2nd, 2002, 11:25 AM
cypher cypher is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2002
Location: Perth, Western Australia
Posts: 3 cypher User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to cypher
<?php

require("../connect.php");

$today = date("mdGis"); // 0431225208

$result = mysql_query("delete from usersOnline where dateAdded < '$today'");

?>

Hehehehe I thought that up myself lol piece of cake!

Reply With Quote
  #7  
Old May 2nd, 2002, 04:15 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
lol, that would work 2 heheh

Reply With Quote
  #8  
Old May 6th, 2002, 05:30 PM
CodeurNet CodeurNet is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2002
Posts: 1 CodeurNet User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to CodeurNet
Post Users online, another way...

Great code ! Here is the code I'm using on my site.

<CODE>

# variables
$timestamp = time();
$timeoutseconds = 300;
$timeout = $timestamp-$timeoutseconds;

# connect to db
mysql_connect("localhost", "username", "password");
mysql_select_db("database");

# delete previous entry
$delete = mysql_query("DELETE FROM users_online WHERE timestamp < $timeout OR ip = '$REMOTE_ADDR'");
if(!($delete)) print "Erreur";

# add current visit
$insert = mysql_query("INSERT INTO users_online VALUES ('$timestamp','$REMOTE_ADDR','$PHP_SELF')");
if(!($insert)) print "Erreur";

# query database
$result = mysql_query("SELECT ip FROM users_online");
if(!($result)) print "Erreur";

# get number of users and close connection
$nb_users = mysql_num_rows($result);
mysql_free_result($result);
mysql_close();

$users_string = "$nb_users utilisateur(s) en-ligne";

</CODE>

And then I can just use <? echo $users_string; ?> where I want the script to output the number of users online.

Might not be the best version but works great for me ! Let me know what you think.

Cheers

Reply With Quote
  #9  
Old June 18th, 2002, 12:28 PM
camarosource camarosource is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Posts: 2 camarosource User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 m 33 sec
Reputation Power: 0
Send a message via ICQ to camarosource
Not working.

URL

No matter how many people view it, it shows "1" person..

Help..

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingProgramming Tools > Article Discussion: Finding How Many Users Are On Your Site With PHP


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

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five &quot;checkpoints&quot; for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

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





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