Subversion Repositories ALCASAR

Rev

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

Rev 768 Rev 830
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
#retrieve IP_address of ALCASAR
-
 
13
$ouvre=fopen("/usr/local/etc/alcasar.conf","r");
-
 
14
if ($ouvre){
-
 
15
	while (!feof ($ouvre))
-
 
16
	{
-
 
17
		$tampon = fgets($ouvre, 4096);
-
 
18
		if (strpos($tampon,"=")!==false){
-
 
19
			$tmp = explode("=",$tampon);
-
 
20
			$conf[$tmp[0]] = $tmp[1];
-
 
21
		}
-
 
22
	}
-
 
23
}else{
-
 
24
	exit("Erreur d'ouverture du fichier ".ALCASAR_ETH1);
-
 
25
}
-
 
26
fclose($ouvre);
-
 
27
$tmp = explode("/",$conf["PRIVATE_IP"]);
-
 
28
$private_ip=$tmp[0];
12
# Choice of language
29
# Choice of language
13
$mac_allowed_list="/usr/local/etc/alcasar-macallowed";
30
$mac_allowed_list="/usr/local/etc/alcasar-macallowed";
14
$Language = 'en';
31
$Language = 'en';
15
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
32
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
16
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
33
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
17
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
34
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
18
if($Language == 'fr'){
35
if($Language == 'fr'){
19
  $l_activity = "Activit&eacute; sur le r&eacute;seau de consultation";
36
  $l_activity = "Activit&eacute; sur le r&eacute;seau de consultation";
20
  $l_ip_adr = "Adresse IP";
37
  $l_ip_adr = "Adresse IP";
21
  $l_mac_adr = "Adresse MAC";
38
  $l_mac_adr = "Adresse MAC";
22
  $l_user = "Usager";
39
  $l_user = "Usager";
23
  $l_mac_allowed = "@MAC autoris&eacute;e";
40
  $l_mac_allowed = "@MAC autoris&eacute;e";
24
  $l_action = "Action";
41
  $l_action = "Action";
25
  $l_dissociate = "Dissocier";
42
  $l_dissociate = "Dissocier";
26
  $l_disconnect = "D&eacute;connecter";
43
  $l_disconnect = "D&eacute;connecter";
27
  $l_refresh = "Cette page est rafraichie toutes les 30 secondes";
44
  $l_refresh = "Cette page est rafraichie toutes les 30 secondes";
28
  $l_error_open_file = "Erreur d'ouverture du fichier"; 
45
  $l_error_open_file = "Erreur d'ouverture du fichier"; 
29
}
46
}
30
else {
47
else {
31
  $l_activity = "Activity on the consultation LAN";
48
  $l_activity = "Activity on the consultation LAN";
32
  $l_ip_adr = "IP Adress";
49
  $l_ip_adr = "IP Adress";
33
  $l_mac_adr = "MAC Adress";
50
  $l_mac_adr = "MAC Adress";
34
  $l_user = "User";
51
  $l_user = "User";
35
  $l_mac_allowed = "@MAC allowed";
52
  $l_mac_allowed = "@MAC allowed";
36
  $l_action = "Action";
53
  $l_action = "Action";
37
  $l_dissociate = "Dissociate";
54
  $l_dissociate = "Dissociate";
38
  $l_disconnect = "Disconnect";
55
  $l_disconnect = "Disconnect";
39
  $l_refresh = "This frame is refreshed every 30'";
56
  $l_refresh = "This frame is refreshed every 30'";
40
  $l_error_open_file = "File open error"; 
57
  $l_error_open_file = "File open error"; 
41
}
58
}
42
echo "
59
echo "
43
<tr><th>$l_activity</th></tr>
60
<tr><th>$l_activity</th></tr>
44
<tr bgcolor=\"#FFCC66\"><td><img src=\"/images/pix.gif\" width=\"1\"
61
<tr bgcolor=\"#FFCC66\"><td><img src=\"/images/pix.gif\" width=\"1\"
45
height=\"2\"></td></tr>
62
height=\"2\"></td></tr>
46
</TABLE>";
63
</TABLE>";
47
if (isset($_POST['action'])){
64
if (isset($_POST['action'])){
48
	switch ($_POST['action']){
65
	switch ($_POST['action']){
49
		case 'user_disconnect' :
66
		case 'user_disconnect' :
50
			exec ("sudo /usr/sbin/chilli_query logout $_POST[mac_addr]");
67
			exec ("sudo /usr/sbin/chilli_query logout $_POST[mac_addr]");
51
			unset ($_POST['user']);
68
			unset ($_POST['user']);
52
			unset ($_POST['mac_addr']);
69
			unset ($_POST['mac_addr']);
53
			unset ($_POST['choix']);
70
			unset ($_POST['choix']);
54
		break;
71
		break;
55
		case 'mac_disconnect' :
72
		case 'mac_disconnect' :
56
			exec ("sudo /usr/sbin/chilli_query dhcp-release $_POST[mac_addr]");
73
			exec ("sudo /usr/sbin/chilli_query dhcp-release $_POST[mac_addr]");
57
			unset ($_POST['mac_addr']);
74
			unset ($_POST['mac_addr']);
58
			unset ($_POST['choix']);
75
			unset ($_POST['choix']);
59
		break;
76
		break;
60
	}
77
	}
61
}
78
}
62
?>
79
?>
63
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
80
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
64
	<tr><td valign="middle" align="left">
81
	<tr><td valign="middle" align="left">
65
	<center>
82
	<center>
66
<? echo "$l_refresh";?>
83
<? echo "$l_refresh";?>
67
	<table border=1 width="80%" bordercolordark="#ffffe0" bordercolorlight="#000000" width="100%" cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
84
	<table border=1 width="80%" bordercolordark="#ffffe0" bordercolorlight="#000000" width="100%" cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
68
		<tr bgcolor="#d0ddb0">
85
		<tr bgcolor="#d0ddb0">
69
<? echo "
86
<? echo "
70
		<th>#</th>
87
		<th>#</th>
71
		<th>$l_ip_adr</th>
88
		<th>$l_ip_adr</th>
72
		<th>$l_mac_adr</th>
89
		<th>$l_mac_adr</th>
73
		<th>$l_user</th>
90
		<th>$l_user</th>
74
		<th>$l_action</th>
91
		<th>$l_action</th>
75
		</tr>";
92
		</tr>";
76
		$output = array(); $nb_ligne = 0;
93
		$output = array(); $nb_ligne = 0;
77
		exec ('sudo /usr/sbin/chilli_query list|sort -k5 -r', $output);
94
		exec ('sudo /usr/sbin/chilli_query list|sort -k5 -r', $output);
78
		while (list(,$ligne) = each($output)){
95
		while (list(,$ligne) = each($output)){
79
			$detail = explode (" ", $ligne);
96
			$detail = explode (" ", $ligne);
80
			if (($detail[1] != "0.0.0.0")&&($detail[1] != "1.0.0.0")){
97
			if ($detail[1] != $private_ip){
81
				$nb_ligne ++;
98
				$nb_ligne ++;
82
				echo "<FORM action='".$_SERVER['PHP_SELF']."' method=POST>";
99
				echo "<FORM action='".$_SERVER['PHP_SELF']."' method=POST>";
83
				echo "<TR>";
100
				echo "<TR>";
84
				echo "<TD>"; echo $nb_ligne; echo "</TD>";
101
				echo "<TD>".$nb_ligne."</TD>";
85
				echo "<TD>"; echo $detail[1]; echo "</TD>";
102
				echo "<TD>".$detail[1]."</TD>";
86
				echo "<TD>"; echo $detail[0]; echo "</TD>";
103
				echo "<TD>".$detail[0]."</TD>";
87
				echo "<TD>";
104
				echo "<TD>";
88
				# station authorisée 
105
				# authorized equipment 
89
				if ($detail[4] == "1"){
106
				if ($detail[4] == "1"){
90
				# par @MAC
107
				# by MAC address
91
					if ($detail[5] == "-"){
108
					if ($detail[5] == $detail[0]){
92
						echo "$l_mac_allowed";
109
						echo "$l_mac_allowed";
93
						if (is_file ($mac_allowed_list)) # le fichier existe
110
						if (is_file ($mac_allowed_list)) # le fichier existe
94
							{
111
							{
95
							$tab=file($mac_allowed_list);
112
							$tab=file($mac_allowed_list);
96
							if ($tab) # le fichier n'est pas vide
113
							if ($tab) # le fichier n'est pas vide
97
								{
114
								{
98
								foreach ($tab as $line)
115
								foreach ($tab as $line)
99
									{
116
									{
100
									$field=explode("#", $line);
117
									$field=explode("#", $line);
101
									$mac_addr=trim($field[0],"macallowed=");
118
									$mac_addr=trim($field[0],"macallowed=");
102
									if (strcasecmp (trim($detail[0]), trim($mac_addr)) == 0)
119
									if (strcasecmp (trim($detail[0]), trim($mac_addr)) == 0)
103
										{
120
										{
104
										echo " ( $field[1])";
121
										echo " ( $field[1])";
105
										break;	
122
										break;	
106
										}
123
										}
107
									}
124
									}
108
								}
125
								}
109
							}
126
							}
110
						else { echo "$l_error_open_file $mac_allowed_list";}
127
						else { echo "$l_error_open_file $mac_allowed_list";}
111
						echo "</TD><TD>&nbsp;";
128
						echo "</TD><TD>&nbsp;";
112
					}
129
					}
113
				# par usager authentifié
130
				# by user
114
					else {
131
					else {
115
						echo "<a href=\"/acc/manager/htdocs/user_admin.php?login=$detail[5]\" title=\"Editer l'utilisateur $detail[5]\">$detail[5]</a>";
132
						echo "<a href=\"/acc/manager/htdocs/user_admin.php?login=$detail[5]\" title=\"Editer l'utilisateur $detail[5]\">$detail[5]</a>";
116
						echo "</TD>";
133
						echo "</TD>";
117
						echo "<TD>";
134
						echo "<TD>";
118
						echo "<INPUT type='hidden' name='action' value='user_disconnect'>";
135
						echo "<INPUT type='hidden' name='action' value='user_disconnect'>";
119
						echo "<INPUT type='hidden' name='user' value='$detail[5]'>";
136
						echo "<INPUT type='hidden' name='user' value='$detail[5]'>";
120
						echo "<INPUT type='hidden' name='mac_addr' value='$detail[0]'>";
137
						echo "<INPUT type='hidden' name='mac_addr' value='$detail[0]'>";
121
						echo "<INPUT type=submit value='$l_disconnect'>";
138
						echo "<INPUT type=submit value='$l_disconnect'>";
122
						}
139
						}
123
					}
140
					}
124
				# station sans usager connecté
141
				# equipment without authenticated user
125
				else { 
142
				else { 
126
					echo "&nbsp;";
143
					echo "&nbsp;";
127
					echo "</TD>";
144
					echo "</TD>";
128
					echo "<TD>";
145
					echo "<TD>";
129
					echo "<INPUT type='hidden' name='action' value='mac_disconnect'>";
146
					echo "<INPUT type='hidden' name='action' value='mac_disconnect'>";
130
					echo "<INPUT type='hidden' name='mac_addr' value='$detail[0]'>";
147
					echo "<INPUT type='hidden' name='mac_addr' value='$detail[0]'>";
131
					echo "<INPUT type='submit' value='$l_dissociate'>";
148
					echo "<INPUT type='submit' value='$l_dissociate'>";
132
				}
149
				}
133
				echo "</TD></TR></FORM>";
150
				echo "</TD></TR></FORM>";
134
			}
151
			}
135
		}
152
		}
136
		?>
153
		?>
137
		</td></tr>
154
		</td></tr>
138
	</table>
155
	</table>
139
	</td></tr>
156
	</td></tr>
140
</table>
157
</table>
141
</html>
158
</html>
142
 
159