Subversion Repositories ALCASAR

Rev

Rev 1090 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log

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