Subversion Repositories ALCASAR

Rev

Rev 460 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 460 Rev 609
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2
<HTML><!-- written by Rexy -->
2
<HTML><!-- written by Rexy -->
3
<head>
3
<head>
4
<META HTTP-EQUIV="Refresh" CONTENT="30">
4
<META HTTP-EQUIV="Refresh" CONTENT="30">
5
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]">
5
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]">
6
<title>&Eacute;tat du r&eacute;seau</title>
6
<title>&Eacute;tat du r&eacute;seau</title>
7
<link rel="stylesheet" href="/css/style.css">
7
<link rel="stylesheet" href="/css/style.css">
8
</head>
8
</head>
9
<body>
9
<body>
10
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
10
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
11
<?
11
<?
12
# Choice of language
12
# Choice of language
-
 
13
$mac_allowed_list="/usr/local/etc/alcasar-macallowed";
13
$Language = 'en';
14
$Language = 'en';
14
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
15
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
15
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
16
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
16
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
17
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
17
if($Language == 'fr'){
18
if($Language == 'fr'){
18
  $l_activity = "Activit&eacute; sur le r&eacute;seau de consultation";
19
  $l_activity = "Activit&eacute; sur le r&eacute;seau de consultation";
19
  $l_ip_adr = "Adresse IP";
20
  $l_ip_adr = "Adresse IP";
20
  $l_mac_adr = "Adresse MAC";
21
  $l_mac_adr = "Adresse MAC";
21
  $l_user = "Usager";
22
  $l_user = "Usager";
22
  $l_mac_allowed = "@MAC autoris&eacute;e";
23
  $l_mac_allowed = "@MAC autoris&eacute;e";
23
  $l_action = "Action";
24
  $l_action = "Action";
24
  $l_dissociate = "Dissocier";
25
  $l_dissociate = "Dissocier";
25
  $l_disconnect = "D&eacute;connecter";
26
  $l_disconnect = "D&eacute;connecter";
26
  $l_refresh = "Cette page est rafraichie toutes les 30 secondes";
27
  $l_refresh = "Cette page est rafraichie toutes les 30 secondes";
-
 
28
  $l_error_open_file = "Erreur d'ouverture du fichier"; 
27
}
29
}
28
else {
30
else {
29
  $l_activity = "Activity on the consultation LAN";
31
  $l_activity = "Activity on the consultation LAN";
30
  $l_ip_adr = "IP Adress";
32
  $l_ip_adr = "IP Adress";
31
  $l_mac_adr = "MAC Adress";
33
  $l_mac_adr = "MAC Adress";
32
  $l_user = "User";
34
  $l_user = "User";
33
  $l_mac_allowed = "@MAC allowed";
35
  $l_mac_allowed = "@MAC allowed";
34
  $l_action = "Action";
36
  $l_action = "Action";
35
  $l_dissociate = "Dissociate";
37
  $l_dissociate = "Dissociate";
36
  $l_disconnect = "Disconnect";
38
  $l_disconnect = "Disconnect";
37
  $l_refresh = "This frame is refreshed every 30'";
39
  $l_refresh = "This frame is refreshed every 30'";
-
 
40
  $l_error_open_file = "File open error"; 
38
}
41
}
39
echo "
42
echo "
40
<tr><th>$l_activity</th></tr>
43
<tr><th>$l_activity</th></tr>
41
<tr bgcolor=\"#FFCC66\"><td><img src=\"/images/pix.gif\" width=\"1\"
44
<tr bgcolor=\"#FFCC66\"><td><img src=\"/images/pix.gif\" width=\"1\"
42
height=\"2\"></td></tr>
45
height=\"2\"></td></tr>
43
</TABLE>";
46
</TABLE>";
44
if (isset($_POST['action'])){
47
if (isset($_POST['action'])){
45
	switch ($_POST['action']){
48
	switch ($_POST['action']){
46
		case 'user_unconnect' :
49
		case 'user_unconnect' :
47
			exec ("sudo /usr/local/sbin/alcasar-logout.sh $_POST[user]");
50
			exec ("sudo /usr/local/sbin/alcasar-logout.sh $_POST[user]");
48
			unset ($_POST['user']);
51
			unset ($_POST['user']);
49
			unset ($_POST['choix']);
52
			unset ($_POST['choix']);
50
		break;
53
		break;
51
		case 'mac_unconnect' :
54
		case 'mac_unconnect' :
52
			exec ("sudo /usr/sbin/chilli_query logout $_POST[mac_addr]");
55
			exec ("sudo /usr/sbin/chilli_query logout $_POST[mac_addr]");
53
			unset ($_POST['mac_addr']);
56
			unset ($_POST['mac_addr']);
54
			unset ($_POST['choix']);
57
			unset ($_POST['choix']);
55
		break;
58
		break;
56
	}
59
	}
57
}
60
}
58
?>
61
?>
59
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
62
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
60
	<tr><td valign="middle" align="left">
63
	<tr><td valign="middle" align="left">
61
	<center>
64
	<center>
62
<? echo "$l_refresh";?>
65
<? echo "$l_refresh";?>
63
	<table border=1 width="80%" bordercolordark="#ffffe0" bordercolorlight="#000000" width="100%" cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
66
	<table border=1 width="80%" bordercolordark="#ffffe0" bordercolorlight="#000000" width="100%" cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
64
		<tr bgcolor="#d0ddb0">
67
		<tr bgcolor="#d0ddb0">
65
<? echo "
68
<? echo "
66
		<th>#</th>
69
		<th>#</th>
67
		<th>$l_ip_adr</th>
70
		<th>$l_ip_adr</th>
68
		<th>$l_mac_adr</th>
71
		<th>$l_mac_adr</th>
69
		<th>$l_user</th>
72
		<th>$l_user</th>
70
		<th>$l_action</th>
73
		<th>$l_action</th>
71
		</tr>";
74
		</tr>";
72
		$output = array(); $nb_ligne = 0;
75
		$output = array(); $nb_ligne = 0;
73
		exec ('sudo /usr/sbin/chilli_query list|sort -k5 -r', $output);
76
		exec ('sudo /usr/sbin/chilli_query list|sort -k5 -r', $output);
74
		while (list(,$ligne) = each($output)){
77
		while (list(,$ligne) = each($output)){
75
			$detail = explode (" ", $ligne);
78
			$detail = explode (" ", $ligne);
76
			if (($detail[1] != "0.0.0.0")&&($detail[1] != "1.0.0.0")){
79
			if (($detail[1] != "0.0.0.0")&&($detail[1] != "1.0.0.0")){
77
				$nb_ligne ++;
80
				$nb_ligne ++;
78
				echo "<FORM action='".$_SERVER['PHP_SELF']."' method=POST>";
81
				echo "<FORM action='".$_SERVER['PHP_SELF']."' method=POST>";
79
				echo "<TR>";
82
				echo "<TR>";
80
				echo "<TD>"; echo $nb_ligne; echo "</TD>";
83
				echo "<TD>"; echo $nb_ligne; echo "</TD>";
81
				echo "<TD>"; echo $detail[1]; echo "</TD>";
84
				echo "<TD>"; echo $detail[1]; echo "</TD>";
82
				echo "<TD>"; echo $detail[0]; echo "</TD>";
85
				echo "<TD>"; echo $detail[0]; echo "</TD>";
83
				echo "<TD>";
86
				echo "<TD>";
84
				# station authorisée 
87
				# station authorisée 
85
				if ($detail[4] == "1"){
88
				if ($detail[4] == "1"){
86
				# par @MAC
89
				# par @MAC
87
					if ($detail[5] == "-"){
90
					if ($detail[5] == "-"){
-
 
91
						echo "$l_mac_allowed";
-
 
92
						if (is_file ($mac_allowed_list)) # le fichier existe
-
 
93
							{
-
 
94
							$tab=file($mac_allowed_list);
-
 
95
							if ($tab) # le fichier n'est pas vide
-
 
96
								{
-
 
97
								foreach ($tab as $line)
-
 
98
									{
-
 
99
									$field=explode("#", $line);
-
 
100
									$mac_addr=trim($field[0],"macallowed=");
-
 
101
									if (trim($detail[0]) == trim($mac_addr))
-
 
102
										{
-
 
103
										echo " ( $field[1])";
-
 
104
										break;	
-
 
105
										}
-
 
106
									}
-
 
107
								}
-
 
108
							}
-
 
109
						else { echo "$l_error_open_file $mac_allowed_list";}
88
						echo "$l_mac_allowed</TD><TD>&nbsp;";}
110
						echo "</TD><TD>&nbsp;";
-
 
111
					}
89
				# par usager authentifié
112
				# par usager authentifié
90
					else {
113
					else {
91
						echo "<a href=\"/acc/manager/htdocs/user_admin.php?login=$detail[5]\" title=\"Editer l'utilisateur $detail[5]\">$detail[5]</a>";
114
						echo "<a href=\"/acc/manager/htdocs/user_admin.php?login=$detail[5]\" title=\"Editer l'utilisateur $detail[5]\">$detail[5]</a>";
92
						echo "</TD>";
115
						echo "</TD>";
93
						echo "<TD>";
116
						echo "<TD>";
94
						echo "<INPUT type='hidden' name='action' value='mac_unconnect'>";
117
						echo "<INPUT type='hidden' name='action' value='mac_unconnect'>";
95
						echo "<INPUT type='hidden' name='user' value='$detail[5]'>";
118
						echo "<INPUT type='hidden' name='user' value='$detail[5]'>";
96
						echo "<INPUT type='hidden' name='mac_addr' value='$detail[0]'>";
119
						echo "<INPUT type='hidden' name='mac_addr' value='$detail[0]'>";
97
						echo "<INPUT type=submit value='$l_disconnect'>";
120
						echo "<INPUT type=submit value='$l_disconnect'>";
98
						}
121
						}
99
					}
122
					}
100
				# station sans usager connecté
123
				# station sans usager connecté
101
				else { 
124
				else { 
102
					echo "&nbsp;";
125
					echo "&nbsp;";
103
					echo "</TD>";
126
					echo "</TD>";
104
					echo "<TD>";
127
					echo "<TD>";
105
					echo "<INPUT type='hidden' name='action' value='mac_unconnect'>";
128
					echo "<INPUT type='hidden' name='action' value='mac_unconnect'>";
106
					echo "<INPUT type='hidden' name='mac_addr' value='$detail[0]'>";
129
					echo "<INPUT type='hidden' name='mac_addr' value='$detail[0]'>";
107
					echo "<INPUT type='submit' value='$l_dissociate'>";
130
					echo "<INPUT type='submit' value='$l_dissociate'>";
108
				}
131
				}
109
				echo "</TD></TR></FORM>";
132
				echo "</TD></TR></FORM>";
110
			}
133
			}
111
		}
134
		}
112
		?>
135
		?>
113
		</td></tr>
136
		</td></tr>
114
	</table>
137
	</table>
115
	</td></tr>
138
	</td></tr>
116
</table>
139
</table>
117
</html>
140
</html>
118
 
141