Subversion Repositories ALCASAR

Rev

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

Rev 1306 Rev 1345
Line 1... Line 1...
1
<?php
1
<?php
2
# $Id: index.php 1306 2014-01-16 10:37:45Z richard $
2
# $Id: index.php 1345 2014-05-10 10:24:39Z richard $
3
#
3
#
4
# index.php for ALCASAR captive portal
4
# index.php for ALCASAR captive portal
5
# by REXY
5
# by REXY
6
# UI & css style by stephane ERARD
6
# UI & css style by stephane ERARD
7
# The contents of this file may be used under the terms of the GNU
7
# The contents of this file may be used under the terms of the GNU
Line 40... Line 40...
40
	}
40
	}
41
}else{
41
}else{
42
	exit("Error opening the file ".CONF_FILE);
42
	exit("Error opening the file ".CONF_FILE);
43
}
43
}
44
fclose($ouvre);
44
fclose($ouvre);
-
 
45
$organisme = trim($conf["ORGANISM"]);
-
 
46
$domainname = trim($conf["DOMAIN"]);
45
$hostname = alcasar.".".$conf["DOMAIN"];
47
$hostname = "alcasar.".$domainname;
46
$network_pb = False;
48
$network_pb = False;
47
$cert_add = "http://$hostname/certs";
49
$cert_add = "http://$hostname/certs";
48
$direct_access = False;
50
$direct_access = False;
49
$diagnostic = "can't contact the default router";
51
$diagnostic = "can't contact the default router";
50
$remote_ip = ($_SERVER['REMOTE_ADDR']);
52
$remote_ip = ($_SERVER['REMOTE_ADDR']);
51
$tab = array();$user = array();
53
$tab = array();$user = array();
52
$connection_history =  "";
54
$connection_history =  "";
53
$nb_connection_history = 3;
55
$nb_connection_history = 3;
54
 
56
 
55
# on discrimine les accès directs sur Alcasar par rapport aux redirections (blacklist ou pannes rso)
57
# on discrimine les accès directs sur Alcasar par rapport aux redirections (blacklist ou pannes rso)
56
if (($_SERVER['HTTP_HOST'] == $_SERVER['SERVER_ADDR']) || preg_match ("/^alcasar/", $_SERVER['HTTP_HOST']) || preg_match ("/^$hostname/", $_SERVER['HTTP_HOST']))
58
if (($_SERVER['HTTP_HOST'] == $_SERVER['SERVER_ADDR']) || preg_match ("/^alcasar$/", $_SERVER['HTTP_HOST']) || preg_match ("/^$hostname$/", $_SERVER['HTTP_HOST']) || preg_match ("/^$organisme$/", $_SERVER['HTTP_HOST']))
57
	{
59
	{
58
	$direct_access=True;
60
	$direct_access=True;
59
	exec ("sudo /usr/sbin/chilli_query list|grep $remote_ip" , $tab);
61
	exec ("sudo /usr/sbin/chilli_query list|grep $remote_ip" , $tab);
60
	$user = explode (" ", $tab[0]);
62
	$user = explode (" ", $tab[0]);
61
	}
63
	}