Subversion Repositories ALCASAR

Rev

Rev 2384 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2384 Rev 2392
Line 22... Line 22...
22
				"DELETE FROM $config[sql_user_info_table] WHERE username = '$login';");
22
				"DELETE FROM $config[sql_user_info_table] WHERE username = '$login';");
23
				if ($res) {
23
				if ($res) {
24
					echo "<b>$l_user $login $l_removed</b><br>\n";
24
					echo "<b>$l_user $login $l_removed</b><br>\n";
25
 
25
 
26
					if (preg_match('/^([a-fA-F0-9]{2}[:|\-]?){6}$/', $login)) {
26
					if (preg_match('/^([a-fA-F0-9]{2}[:|\-]?){6}$/', $login)) {
27
						$user_ip = exec('sudo chilli_query list | grep '.escapeshellarg($login)." |  cut -d' ' -f2");
27
						$user_ip = exec('sudo /usr/sbin/chilli_query list | awk '.escapeshellarg('($5 == 1) && ($6 == "'.$login.'") {print $2}'));
28
						//on vérifie que l'@IP de l'@MAC est différente de celle de l'admin sur l'ACC
28
						//on vérifie que l'@IP de l'@MAC est différente de celle de l'admin sur l'ACC
29
						if ((!empty($user_ip)) && ($user_ip !== $_SERVER['REMOTE_ADDR'])) {
29
						if ((!empty($user_ip)) && ($user_ip !== $_SERVER['REMOTE_ADDR'])) {
30
							exec('sudo chilli_query logout '.escapeshellarg($login));
30
							exec('sudo /usr/sbin/chilli_query logout mac '.escapeshellarg($login));
31
						}
31
						}
32
					}
32
					}
33
				}
33
				}
34
				else
34
				else
35
					echo "<b>Error deleting user $login from user info table: " . da_sql_error($link,$config) . "</b><br>\n";
35
					echo "<b>Error deleting user $login from user info table: " . da_sql_error($link,$config) . "</b><br>\n";