Subversion Repositories ALCASAR

Rev

Rev 3127 | Rev 3132 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 3127 Rev 3129
Line 6... Line 6...
6
		$strResult = 0;
6
		$strResult = 0;
7
		// Déclaration des paramètres de connexion
7
		// Déclaration des paramètres de connexion
8
		$host = "localhost";
8
		$host = "localhost";
9
		$DB_USER = "radius";
9
		$DB_USER = "radius";
10
		$DB_RADIUS = "radius";
10
		$DB_RADIUS = "radius";
11
		$radiuspwd = "";
11
		$radiuspwd = "pJHKcy9Jv1HrCMHM";
12
		// Connexion au serveur
12
		// Connexion au serveur
13
		$mysqli = new mysqli($host, $DB_USER, $radiuspwd, $DB_RADIUS);
13
		$mysqli = new mysqli($host, $DB_USER, $radiuspwd, $DB_RADIUS);
14
		if ($texte == 'user') {$query = "SELECT UserName FROM userinfo";}
14
		if ($texte == 'user') {$query = "SELECT UserName FROM userinfo";}
15
		else { $query = "SELECT GroupName FROM radusergroup GROUP BY GroupName";}
15
		else { $query = "SELECT GroupName FROM radusergroup GROUP BY GroupName";}
16
		$result = $mysqli->query($query);
16
		$result = $mysqli->query($query);
Line 19... Line 19...
19
		// Deconnexion de la base de donnees
19
		// Deconnexion de la base de donnees
20
		$mysqli->close();
20
		$mysqli->close();
21
		return $strResult;
21
		return $strResult;
22
 }
22
 }
23
// router test
23
// router test
24
function routerTest($host) {
24
function routerTest($host,$nic) {
25
	$out = exec("(sudo arping -c1 -f $host|grep 'Received 0 response'|wc -l)");
25
	$out = exec("(sudo arping -I$nic -c1 $host|grep response|cut -d' ' -f2)");
26
	return ($out == "0") ? true : false;
26
	return ($out == "1") ? true : false;
27
}
27
}
28
 
28
 
29
// Internet test
29
// Internet test
30
function internetTest() {
30
function internetTest() {
31
	$host  = 'www.google.com';
31
	$host  = 'www.google.com';
Line 158... Line 158...
158
	$lan_status =  $l_lan." "." <img src='/images/state_error.gif'> ";
158
	$lan_status =  $l_lan." "." <img src='/images/state_error.gif'> ";
159
}
159
}
160
 
160
 
161
// Router status
161
// Router status
162
$mask = strrchr($conf['PUBLIC_IP'],"/");
162
$mask = strrchr($conf['PUBLIC_IP'],"/");
163
if(routerTest($conf['GW']) && ($conf['GW'].$mask != $conf['PUBLIC_IP'])){
163
if(routerTest($conf['GW'],$conf['EXTIF']) && ($conf['GW'].$mask != $conf['PUBLIC_IP'])){
164
	$router_status =  $l_router." "." <img src='/images/state_ok.gif'> ";	
164
	$router_status =  $l_router." "." <img src='/images/state_ok.gif'> ";	
165
} else{
165
} else{
166
	$router_status =  $l_router." "." <img src='/images/state_error.gif'> ";
166
	$router_status =  $l_router." "." <img src='/images/state_error.gif'> ";
167
}
167
}
168
 
168