57,7 → 57,7 |
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){ |
$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']); |
$Language = strtolower(substr(chop($Langue[0]),0,2)); } |
$redirect_link = "http://www.alcasar.net"; |
$redirect_link = "www.alcasar.net"; # beware !!! HTTP only |
|
# Retrieve the user info behind the remote ip |
exec ("sudo /usr/sbin/chilli_query list|grep $remote_ip" , $tab); |
65,11 → 65,13 |
|
|
# Test if it's a direct connexion to ALCASAR |
if ((isset($_SERVER['HTTP_HOST'])) && (($_SERVER['HTTP_HOST'] == $_SERVER['SERVER_ADDR']) || (preg_match ("/^alcasar$/", $_SERVER['HTTP_HOST'])) || (preg_match ("/^$hostname$/", $_SERVER['HTTP_HOST'])) || (preg_match ("/^$organisme$/", $_SERVER['HTTP_HOST'])))) |
if (isset($_SERVER['HTTP_HOST'])) |
{ |
echo $_SERVER['HTTP_HOST']." / ".$_SERVER['SERVER_ADDR']." / ".$hostname." / ".$organisme; |
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']))) |
{ |
$direct_access=True; |
exec("sudo /usr/sbin/ipset del not_auth_yet $remote_ip"); # del user of the ipset "not_auth_yet" to not loop |
} |
} |
# Function to adapt time connexion in seconds to H,M,S |
function secondsToDuration($seconds = null){ |
106,16 → 108,23 |
else # user not connected |
{ |
exec("sudo /usr/sbin/ipset list not_auth_yet | grep $remote_ip | wc -l 2>&1", $ipset_not_auth_yet); |
if(!$direct_access && $ipset_not_auth_yet[0] == '0') # it's an interception |
if(!$direct_access && $ipset_not_auth_yet[0] == '0') # it's the fist stage of an interception |
{ |
$display_menu = True; # Display menu for user not_auth_yet |
$redirect_link = $_SERVER['HTTP_HOST']; |
$redirect_link = $_SERVER['HTTP_HOST']; # to keep the user URL |
} |
if(isset($_GET['url'])) # When user has clicked to open a connection ... |
if(isset($_GET['url'])) # it's the second stage (when user has clicked to open a connection ...) |
{ |
exec("sudo /usr/sbin/ipset add not_auth_yet $remote_ip"); # Add user in the ipset "not_auth_yet" (DNS requests not intercepted) |
#header('Location: http://www.alcasar.net',TRUE,307); |
header("Location: $redirect_link"); |
if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'off') # in HTTP, the user is redirected on it's home page (in HTiTPS, it's on the default page) |
{ |
$redirect_link = "http://".$_GET['url']; |
} |
else |
{ |
$redirect_link = "http://".$redirect_link; |
} |
header("Location: $redirect_link",TRUE,307); |
exit; |
} |
if ($ipset_not_auth_yet[0] == '1'){ #if user not_auth_yet still here (index.php), we force DNS resquest. |