| Line 1... |
Line 1... |
| 1 |
<?php
|
1 |
<?php
|
| 2 |
# $Id: index.php 1987 2016-07-12 22:24:04Z richard $
|
2 |
# $Id: index.php 1988 2016-07-13 14:16:37Z raphael.pion $
|
| 3 |
#
|
3 |
#
|
| 4 |
# index.php for ALCASAR
|
4 |
# index.php for ALCASAR
|
| 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 110... |
Line 110... |
| 110 |
# the user isn't connected and he isn't in the ipset "not_auth_yet" yet
|
110 |
# the user isn't connected and he isn't in the ipset "not_auth_yet" yet
|
| 111 |
exec("sudo /usr/sbin/ipset list not_auth_yet | grep $remote_ip | wc -l 2>&1", $ipset_not_auth_yet);
|
111 |
exec("sudo /usr/sbin/ipset list not_auth_yet | grep $remote_ip | wc -l 2>&1", $ipset_not_auth_yet);
|
| 112 |
if(!$direct_access && $ipset_not_auth_yet[0] == '0')
|
112 |
if(!$direct_access && $ipset_not_auth_yet[0] == '0')
|
| 113 |
{
|
113 |
{
|
| 114 |
exec("sudo /usr/sbin/ipset add not_auth_yet $remote_ip"); # Add in the ipset "not_auth_yet" to not loop when redirected
|
114 |
exec("sudo /usr/sbin/ipset add not_auth_yet $remote_ip"); # Add in the ipset "not_auth_yet" to not loop when redirected
|
| - |
|
115 |
if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on")
|
| - |
|
116 |
{
|
| 115 |
echo "<script>window.location.assign='http://$_SERVER[HTTP_HOST]'</script>";
|
117 |
header("Location: http://$_SERVER[HTTP_HOST]");
|
| - |
|
118 |
}
|
| - |
|
119 |
else
|
| - |
|
120 |
{
|
| 116 |
echo "<script>window.location.reload(true)</script>"; # the user web browser need to perform a new DNS request when redirected (as in a "<CTRL>+F5")
|
121 |
echo "<script>window.location.reload(true)</script>"; # the user web browser need to perform a new DNS request when redirected (as in a "<CTRL>+F5")
|
| 117 |
//header("Location: http://$_SERVER[HTTP_HOST]");
|
122 |
echo "<script>window.location.href='http://$_SERVER[HTTP_HOST]'</script>";
|
| - |
|
123 |
}
|
| 118 |
exit;
|
124 |
exit;
|
| 119 |
}
|
125 |
}
|
| - |
|
126 |
|
| - |
|
127 |
|
| 120 |
}
|
128 |
}
|
| 121 |
|
129 |
|
| 122 |
# Choice of language
|
130 |
# Choice of language
|
| 123 |
$Language = 'en';
|
131 |
$Language = 'en';
|
| 124 |
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
|
132 |
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
|