/var/www/hkosl.com/oneMotorChunHing_delete20240201/html/html/online/online.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?
//Script created by janssens.org.uk under the GNU GPL
//For help with this please go to: http://janssens.org.uk/repository/php/php-user-online-script/

//Database variables
$server             "localhost";          // Your MySQL Server address. This is usually localhost
$db_user            "man";         // Your MySQL Username
$db_pass            "we11d0ne";        // Your MySQL Password
$database           "oneERP";          // Database Name

//Customizations
$timeoutseconds     "300";            // How long it it boefore the user is no longer online

//Only one person is online
$oneperson1       "There is curently";  //Change the text that will be displayed
$oneperson2       "person online.";     //Change the text that will be displayed

//Two or more people online
$twopeople1       ="There are currently"//Change the text that will be displayed
$twopeople2       ="people online.";      //Change the text that will be displayed



//The following should only be modified if you know what you are doing
$t time();
mysql_connect($server$db_user$db_pass) or die ("Unable to display number of users online: could not connect to the database");

$sql "INSERT INTO online VALUES ('".time()."','".$_SERVER['REMOTE_ADDR']."','".$_SERVER['PHP_SELF']."')";
mysql_db_query($database$sql) or die("Error: Unable to insert data into the database, make sure you have write priveledges");

$sql "DELETE FROM online WHERE timestamp<".($t-3)."";
mysql_db_query($database$sql) or die("Error: Unable to delete old records from the database, make sure you have permission to delete data");

$result=mysql_db_query($database"SELECT DISTINCT ip FROM online WHERE file='".$_SERVER['PHP_SELF']."'") or die("Error: Unable to select data");
$users mysql_num_rows($result);
mysql_close();

if (
$users==1){
    echo 
$oneperson1 .$users .$oneperson2;
}
else{
    echo 
$twopeople1 .$users .$twopeople2;
}
?>