Subversion Repositories ALCASAR

Rev

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

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