Subversion Repositories ALCASAR

Rev

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

Rev 2841 Rev 2883
Line 1... Line 1...
1
<?php
1
<?php
2
 
-
 
-
 
2
// this script is executed by status page (controler.js) of each users
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 = '/tmp/current_users.txt';
4
$filename = '/tmp/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}'));
7
$isConnected = exec('sudo /usr/sbin/chilli_query list | awk '.escapeshellarg('($2 == "'.$user_ip.'") {print $5}'));
Line 22... Line 22...
22
			$found = true;
22
			$found = true;
23
			break;
23
			break;
24
		}
24
		}
25
	}
25
	}
26
	fclose($fh);
26
	fclose($fh);
27
 
-
 
28
	// else we write user IP in the file
27
	// else we write user IP in the file
29
	if (!$found) {
28
	if (!$found) {
30
		file_put_contents($filename, $user_ip.':TEMP'.PHP_EOL, FILE_APPEND);
29
		file_put_contents($filename, $user_ip.':TEMP'.PHP_EOL, FILE_APPEND);
31
	}
30
	}
32
}
31
}