Subversion Repositories ALCASAR

Rev

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

Rev 3033 Rev 3127
Line 20... Line 20...
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) {
25
	$port = 80;
-
 
26
 
-
 
27
	$test = exec("ping -c 3 $host", $out, $res);
25
	$out = exec("(sudo arping -c1 -f $host|grep 'Received 0 response'|wc -l)");
28
 
-
 
29
	return ($res == 0) ? true : false;
26
	return ($out == "0") ? true : false;
30
}
27
}
31
 
28
 
32
// Internet test
29
// Internet test
33
function internetTest() {
30
function internetTest() {
34
	$host  = 'www.google.com';
31
	$host  = 'www.google.com';
Line 48... Line 45...
48
	}
45
	}
49
 
46
 
50
	return false;
47
	return false;
51
}
48
}
52
 
49
 
53
// filtering test
50
// searchString = search for a string in a file
54
function filtrageTest($file, $search_regex){
51
function searchString($file, $search_regex){
55
	$pointeur = fopen($file,"r");
52
	$pointeur = fopen($file,"r");
56
	$result = false;
53
	$result = false;
57
	if ($pointeur)
54
	if ($pointeur)
58
		{
55
		{
59
		while (!feof($pointeur))
56
		while (!feof($pointeur))
Line 168... Line 165...
168
} else{
165
} else{
169
	$router_status =  $l_router." "." <img src='/images/state_error.gif'> ";
166
	$router_status =  $l_router." "." <img src='/images/state_error.gif'> ";
170
}
167
}
171
 
168
 
172
// Internet status
169
// Internet status
173
if ((filtrageTest("/var/www/html/index.php","/network_pb = false/")) && (internetTest())) {
170
if ((searchString("/var/www/html/index.php","/network_pb = false/")) && (internetTest())) {
174
	$internet_status =  $l_DNS." "." <img src='/images/state_ok.gif'> ";
171
	$internet_status =  $l_DNS." "." <img src='/images/state_ok.gif'> ";
175
	$version = dns_get_record("version.alcasar.net",DNS_TXT);
172
	$version = dns_get_record("version.alcasar.net",DNS_TXT);
176
	if (!empty($version)) {
173
	if (!empty($version)) {
177
		$AVAILABLEDVERSION = $version[0]['txt'];
174
		$AVAILABLEDVERSION = $version[0]['txt'];
178
	} else {
175
	} else {