Subversion Repositories ALCASAR

Rev

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

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