Bravo List
Register
Go Back   > Bravo List > Source Code > Archived Trackers > BT.Manager (phpMyBitTorrent) > Mods & Themes
Reply
  #1  
Old 29th June 2010, 10:50
Hasan Hasan is offline
Senior Member
 
Join Date: Apr 2010
Denmark
Posts: 29
Default Guest Online/log Script!
A little script I made..( Used codes from other script and made this)
I'm still new too php so please be gentle o.o


In this script you can see guest/user online last 5 mins(you can chose how long time as well)and there will be added a log too..

You can see how it looks in my side wwww.u-torrentz.org, Just scroll down.

1) Install the Sql ( remember to change CHARSET to "latin1" when you import the sql file)

Code:
Code:
CREATE TABLE `guest` (
  `time` int(15) NOT NULL default '0',
  `ip` varchar(50) NOT NULL default '',
  `browser` varchar(50) NOT NULL default '',
  PRIMARY KEY  (`time`)
)ENGINE=MyISAM DEFAULT CHARSET=latin1;
2) Upload the online.php file in you root ( You can mod it and add so you can see ip by adding "ip" or do other mods o.o)

3)

Add this code where ever you want it to... (easily too mod)

Code:
                
        //Guest Online
        $db_host = "localhost";
        $db_user = "User-name"; 
        $db_pass = "Password";
        $db_name = "DATABASE";
        $dbc = mysql_connect($db_host, $db_user, $db_pass);
        $dbs = mysql_select_db($db_name);
        $tm = time();
        $timeout = $tm - (300);  //300 is 5 mins
        if($_SERVER["REMOTE_ADDR"]){$ip=$_SERVER["REMOTE_ADDR"
                                             ];}
            else{$ip=$_SERVER["HTTP_X_FORWARDED_FOR"];}
        $brws = explode("(",$_SERVER["HTTP_USER_AGENT"]);
        $browser = $brws[0];
        mysql_query("INSERT INTO guest SET  time='".$tm."', ip='".$ip."', browser='".$browser."'");
        $delete = mysql_db_query($db_name, "DELETE FROM guest WHERE time<$timeout"); 

if(!($delete)) { 

    print ""; 

} 

        $count = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM guest"));
        mysql_close();
        echo "<br/><a href=\"online.php\"><b>Total Guest Online In Last 5 mins:</b> $count[0]</a><br/>";
Here you go :d
Attached Files
File Type: php online.php (835 Bytes, 18 views)
File Type: sql guest.sql (214 Bytes, 11 views)
Reply With Quote
The Following 2 Users Say Thank You to Hasan For This Useful Post:
Baba (25th March 2020), Fynnon (29th June 2010)
  #2  
Old 1st July 2010, 04:28
joeroberts's Avatar
joeroberts joeroberts is offline
BT.Manager Owner
 
Join Date: Jan 2008
United States
Posts: 2,113
Default
There is no need to use data base conection for this mod as pmbt hold data base open for the full duration.
__________________
Do not ask me to help you work on your site that is not phpMyBitTorrent
Do not ask me to make a mod for any other source
Do not Ask me to setup your site.
I will no longer help you setup your site, there is a setup script if you have trouble with it post in the forum here or in BT.Manager™ forum
My Current Demo is here http://demo.btmanager.org/
Reply With Quote
  #3  
Old 1st July 2010, 11:30
Hasan Hasan is offline
Senior Member
 
Join Date: Apr 2010
Denmark
Posts: 29
Default
Quote:
Originally Posted by joeroberts View Post
There is no need to use data base conection for this mod as pmbt hold data base open for the full duration.
Yea I figured that out but again I'm still new to this. do not wanna edit the code :P

and your welcome for this xD
Reply With Quote
Reply

Tags
guest , online or log , script

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Guest download HelixiR Template Shares 2 23rd March 2011 11:36
Online Decoding Fynnon Community Cafe 3 10th February 2010 11:29
Guest Group [permission] mhmd_1983 Template Shares 3 17th September 2008 10:26
Guest Upload netdsl Yuna Scatari Edition (YSE) 0 16th August 2008 13:42



All times are GMT +2. The time now is 13:32. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.