######################################################## ## ## Hack Title: Online Time Stats ## Hack Version: 1.0.2 ## Author: Christoph "Toxic" Hellings (toxic@freenet.de) ## Date Created: 09-09-02 ## Date Updated: 08-10-02 ## Thread Location: http://www.tforumhacks.com/tforum/viewtopic.php?TopicID=1111 ## Working Example: http://cts-f.net/cts/forum ## Description: Adds to the stats page a top ten with users most online. ## ## ## Installation Level: Intermediate ## Installation Time: 10 Minutes ## Files To Edit: 5 ## Edit Database: yes ## Included Files: none ## ######################################################## ## ## Installation/Author Notes: ## ## I think it works but no warranty... ## ## After installing the hack, logging online time must ## be started using the admin panel. ## ## if you have a gateway installed you should do ## the instructions for functions.php in your ## gwfunctions.php, too. ## ######################################################## # #-----[ ACTION: BACKUP ]------------------------------------------ # Every time you edit your files, you should always back them up first. Although all of these hacks have been tested on various systems, they may not work with your configuration or you may not like what it does. Backing up protects yourself and your users from downtime. # #-----[ ACTION: EDIT DATABASE ]---------------------------------- # ALTER TABLE t_users ADD OnlineTime INT(11) DEFAULT '0' NOT NULL AFTER LastActive; INSERT INTO t_bSettings (Name,Value) VALUES ('OnlineTimeStart', '0'); # #-----[ ACTION: OPEN ]------------------------------------------- # admin.php # #-----[ ACTION: FIND ]------------------------------------------- # Edit Options
# #-----[ ACTION: ADD AFTER ]-------------------------------------- # Online Time Logging
# #-----[ ACTION: OPEN ]------------------------------------------- # adminfunctions.php # #-----[ ACTION: ADD ]-------------------------------------------- # function StartOnlineTime() { global $Submit; if ($Submit == "Yes") { $query = "UPDATE t_users set OnlineTime=0"; $result = mysql_query($query); if (!$result) die("Rename failed. Reason: ".mysql_error()); $query = "UPDATE t_bSettings SET Value='".time()."' WHERE Name='OnlineTimeStart'"; $result = mysql_query($query); if (!$result) die("Rename failed. Reason: ".mysql_error()); echo "(Re)Start successful!"; } else {?> tForum Administration Area
(Re)Start Online Time Logging?


>
> ">Top
">"> ">"> ">"> "> 
"> "> "> "> /bar-left.gif" height="" >/bar-center.gif" width="" height="" >/bar-right.gif" height="">

# #-----[ ACTION: SAVE & UPLOAD ]----------------------------------- # admin.php adminfunctions.php functions.php english_lg.php stats.php # #----------------------------------------------------------------- # EOF