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 28th, 2002, 12:35 AM
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: 8
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, 07: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, 08: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, 08: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, 08: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, 12:25 PM
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, 05: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, 06: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, 01: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!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

Request Your Free Technology Downloads!
 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

Request Your Free Technology Downloads!
 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

Request Your Free Technology Downloads!
 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

Request Your Free Technology Downloads!
 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

Request Your Free Technology Downloads!
 

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




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