Subversion Repositories ALCASAR

Rev

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

Rev 719 Rev 783
Line 17... Line 17...
17
 *   along with this program; if not, write to the                         *
17
 *   along with this program; if not, write to the                         *
18
 *   Free Software Foundation, Inc.,                                       *
18
 *   Free Software Foundation, Inc.,                                       *
19
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
19
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
20
 ***************************************************************************/
20
 ***************************************************************************/
21
 
21
 
22
// $Id: portail.php 719 2011-09-24 10:25:47Z franck $
22
// $Id: portail.php 783 2011-12-17 14:24:08Z richard $
23
 
23
 
24
// xml_utilisateur()
24
// xml_utilisateur()
25
 
25
 
26
function request ($texte) {
26
function request ($texte) {
27
		$strResult = 0;
27
		$strResult = 0;
28
		// Déclaration des paramètres de connexion
28
		// Déclaration des paramètres de connexion
29
		$host = "localhost";
29
		$host = "localhost";
30
		$DB_USER = "radius";
30
		$DB_USER = "radius";
31
		$DB_RADIUS = "radius";
31
		$DB_RADIUS = "radius";
32
		$radiuspwd = "w9VMtJD1";
32
		$radiuspwd = "";
33
		// Connexion au serveur
33
		// Connexion au serveur
34
		mysql_connect($host, $DB_USER,$radiuspwd) or die("erreur de connexion au serveur");
34
		mysql_connect($host, $DB_USER,$radiuspwd) or die("erreur de connexion au serveur");
35
		mysql_select_db($DB_RADIUS) or die("erreur de connexion a la base de donnees");
35
		mysql_select_db($DB_RADIUS) or die("erreur de connexion a la base de donnees");
36
		// Creation et envoi de la requete
36
		// Creation et envoi de la requete
37
		if ($texte == 'user') {$query = "SELECT UserName FROM userinfo";}
37
		if ($texte == 'user') {$query = "SELECT UserName FROM userinfo";}
Line 55... Line 55...
55
	
55
	
56
	return $_text;
56
	return $_text;
57
} 
57
} 
58
// Fonction de test de connectivité internet
58
// Fonction de test de connectivité internet
59
function internetTest(){
59
function internetTest(){
60
        $host = "www.google.fr";  # Google Test
60
        $host = "www.google.com";  # Google Test
61
        $host2 = "www.alcasar.info";
61
        $host2 = "www.alcasar.info";
62
        $port = "80";
62
        $port = "80";
63
        //var $num;     //non utilisé
63
        //var $num;     //non utilisé
64
        //var $error;   //non utilisé
64
        //var $error;   //non utilisé
65
	if (! $sock = @fsockopen($host, $port, $num, $error, 2)) {
65
	$sock = fsockopen($host, $port, $num, $error, 2);
-
 
66
	if (!$sock){
66
		return false; } # Internet access is down
67
		return false; # Internet access is down
-
 
68
		}
67
	else 	{   
69
	else 	{   
68
		fclose($sock);
70
		fclose($sock);
69
		if ($sock = @fsockopen($host2, $port, $num, $error, 2))	{
71
		$sock = fsockopen($host2, $port, $num, $error, 2);
-
 
72
		if ($sock){
70
                	fputs($sock,"GET http://$host2/images/M_images/weblink24.png HTTP/1.0\n\n");
73
                	fputs($sock,"GET http://$host2/images/M_images/weblink24.png HTTP/1.0\n\n");
71
                	fclose($sock); }
74
			fclose($sock); }
72
		return true;
75
		return true;
73
		}
76
		}
74
}
77
}
75
// Fonction de test du filtrage
78
// Fonction de test du filtrage
76
function filtrageTest($file, $search_regex){
79
function filtrageTest($file, $search_regex){
Line 94... Line 97...
94
// html_portail()
97
// html_portail()
95
function html_portail () {
98
function html_portail () {
96
	global $webpath;
99
	global $webpath;
97
	global $XPath;
100
	global $XPath;
98
	global $text;
101
	global $text;
99
 
-
 
-
 
102
	exec ("sudo /usr/local/bin/alcasar-watchdog.sh -lt");
100
	$file_version = "/var/www/html/VERSION";
103
	$file_version = "/var/www/html/VERSION";
101
	$handle = fopen ($file_version, "r");
104
	$handle = fopen ($file_version, "r");
102
	$INSTALLEDVERSION = fread ($handle, filesize ($file_version));
105
	$INSTALLEDVERSION = fread ($handle, filesize ($file_version));
103
	fclose ($handle);
106
	fclose ($handle);
104
	$file_bl = "/var/www/html/VERSION-BL";
107
	$file_bl = "/var/www/html/VERSION-BL";
Line 115... Line 118...
115
		$web_filter_status = $text['enable'];}
118
		$web_filter_status = $text['enable'];}
116
	else {	$web_filter_status = $text['disable'];}
119
	else {	$web_filter_status = $text['disable'];}
117
	if (filtrageTest("/etc/dansguardian/dansguardian.conf","/^proxyport = 8090/")){
120
	if (filtrageTest("/etc/dansguardian/dansguardian.conf","/^proxyport = 8090/")){
118
		$web_antivir_status = $text['enable'];}
121
		$web_antivir_status = $text['enable'];}
119
	else {	$web_antivir_status = $text['disable'];}
122
	else {	$web_antivir_status = $text['disable'];}
120
	if (internetTest()){
123
	if ((filtrageTest("/var/www/html/index.php","/network_pb = False/")) && (internetTest())){
121
		$internet_status =  "<img src='/images/state_ok.gif'>".$text['enable'];
124
		$internet_status =  "<img src='/images/state_ok.gif'>".$text['enable'];
122
		$version = dns_get_record("version.alcasar.info",DNS_TXT);
125
		$version = dns_get_record("version.alcasar.info",DNS_TXT);
123
		$AVAILABLEDVERSION = $version[0]['txt'];
126
		$AVAILABLEDVERSION = $version[0]['txt'];
124
	} else {
127
	} else {
125
		$internet_status =  "<img src='/images/state_error.gif'>".$text['disable'];
128
		$internet_status =  "<img src='/images/state_error.gif'>".$text['disable'];