Subversion Repositories ALCASAR

Rev

Rev 2394 | Rev 2841 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2394 Rev 2401
Line 2... Line 2...
2
 
2
 
3
// store user @IP who can join this page (still have their status.php tab open) in a file.
3
// store user @IP who can join this page (still have their status.php tab open) in a file.
4
$filename = '/var/tmp/havp/current_users.txt';
4
$filename = '/var/tmp/havp/current_users.txt';
5
$user_ip = $_SERVER['REMOTE_ADDR'];
5
$user_ip = $_SERVER['REMOTE_ADDR'];
6
 
6
 
-
 
7
$isConnected = exec('sudo /usr/sbin/chilli_query list | awk '.escapeshellarg('($2 == "'.$user_ip.'") {print $5}'));
-
 
8
if ($isConnected === '0') {
-
 
9
	exit();
-
 
10
}
-
 
11
 
7
if ((!file_exists($filename)) || (filesize($filename) === 0)) {
12
if ((!file_exists($filename)) || (filesize($filename) === 0)) {
8
	// Creating file and write user @IP.
13
	// Creating file and write user @IP.
9
	file_put_contents($filename, $user_ip.':TEMP'.PHP_EOL);
14
	file_put_contents($filename, $user_ip.':TEMP'.PHP_EOL);
10
} else {
15
} else {
11
	// If we found duplicate user IP, it will not be writen again
16
	// If we found duplicate user IP, it will not be writen again