|
#1
|
|||
|
|||
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; 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/>"; |
#2
|
||||
|
||||
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/ |
#3
|
|||
|
|||
Quote:
and your welcome for this xD |
Tags |
guest , online or log , script |
|
|
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 |