Subversion Repositories ALCASAR

Rev

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

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