Subversion Repositories ALCASAR

Rev

Rev 2065 | Go to most recent revision | Details | Last modification | View Log

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