Line 1... |
Line 1... |
1 |
<?php
|
1 |
<?php
|
2 |
$hostname = "alcasar";
|
2 |
$hostname = "alcasar";
|
3 |
$network_pb = False;
|
3 |
$network_pb = True;
|
4 |
$cert_add = "http://alcasar/certs";
|
4 |
$cert_add = "http://alcasar/certs";
|
5 |
$direct_access = False;
|
5 |
$direct_access = False;
|
6 |
$diagnostic = "eth0 link down";
|
6 |
$diagnostic = "eth0 link down";
|
7 |
$remote_ip = ($_SERVER['REMOTE_ADDR']);
|
7 |
$remote_ip = ($_SERVER['REMOTE_ADDR']);
|
8 |
$tab = array();$user = array();
|
8 |
$tab = array();$user = array();
|
9 |
$connection_history = "";
|
9 |
$connection_history = "";
|
10 |
$nb_connection_history = 3;
|
10 |
$nb_connection_history = 3;
|
11 |
|
11 |
|
12 |
# on discrimine les accès directs sur Alcasar par rapport aux redirections (blacklist ou pannes rso)
|
12 |
# on discrimine les accès directs sur Alcasar par rapport aux redirections (blacklist ou pannes rso)
|
13 |
if (($_SERVER['HTTP_HOST'] == $_SERVER['SERVER_ADDR']) || preg_match ("/^alcasar/", $_SERVER['HTTP_HOST']) || preg_match ("/^$hostname/", $_SERVER['HTTP_POST']))
|
13 |
if (($_SERVER['HTTP_HOST'] == $_SERVER['SERVER_ADDR']) || preg_match ("/^alcasar/", $_SERVER['HTTP_HOST']) || preg_match ("/^$hostname/", $_SERVER['HTTP_HOST']))
|
14 |
{
|
14 |
{
|
15 |
$direct_access=True;
|
15 |
$direct_access=True;
|
16 |
exec ("sudo /usr/sbin/chilli_query list|grep $remote_ip" , $tab);
|
16 |
exec ("sudo /usr/sbin/chilli_query list|grep $remote_ip" , $tab);
|
17 |
$user = explode (" ", $tab[0]);
|
17 |
$user = explode (" ", $tab[0]);
|
18 |
}
|
18 |
}
|
Line 28... |
Line 28... |
28 |
return $time[0]." h ".$time[1]." m ".$time[2]." s";
|
28 |
return $time[0]." h ".$time[1]." m ".$time[2]." s";
|
29 |
}
|
29 |
}
|
30 |
|
30 |
|
31 |
$l_connected = "connected"; // a traduire (choix de la langue ci-dessous mais nécessitant de $connection_history)
|
31 |
$l_connected = "connected"; // a traduire (choix de la langue ci-dessous mais nécessitant de $connection_history)
|
32 |
// si on a pas d'accès à la bdd, la page s'affiche quand même correctement
|
32 |
// si on a pas d'accès à la bdd, la page s'affiche quand même correctement
|
33 |
if ($user[4] != "0"){
|
33 |
if ((isset ($user[4])) && ($user[4] != "0")){
|
34 |
if ((is_file("./acc/manager/lib/sql/drivers/mysql/functions.php"))&&(is_file("/etc/freeradius-web/config.php"))){
|
34 |
if ((is_file("./acc/manager/lib/sql/drivers/mysql/functions.php"))&&(is_file("/etc/freeradius-web/config.php"))){
|
35 |
include_once("/etc/freeradius-web/config.php");
|
35 |
include_once("/etc/freeradius-web/config.php");
|
36 |
include_once("./acc/manager/lib/sql/drivers/mysql/functions.php");
|
36 |
include_once("./acc/manager/lib/sql/drivers/mysql/functions.php");
|
37 |
|
37 |
|
38 |
$sql = "SELECT UserName, AcctStartTime, AcctStopTime, acctsessiontime FROM radacct WHERE UserName='$user[5]' ORDER BY AcctStartTime DESC LIMIT 0 , $nb_connection_history";
|
38 |
$sql = "SELECT UserName, AcctStartTime, AcctStopTime, acctsessiontime FROM radacct WHERE UserName='$user[5]' ORDER BY AcctStartTime DESC LIMIT 0 , $nb_connection_history";
|
Line 100... |
Line 100... |
100 |
$l_acc_access = "<a href=\"https://$hostname/acc\">ALCASAR Control Center</a>";
|
100 |
$l_acc_access = "<a href=\"https://$hostname/acc\">ALCASAR Control Center</a>";
|
101 |
$l_install_certif = "<a href=\"$cert_add/certificat_alcasar_ca.crt\">Install ALCASAR AC Certificate</a>";
|
101 |
$l_install_certif = "<a href=\"$cert_add/certificat_alcasar_ca.crt\">Install ALCASAR AC Certificate</a>";
|
102 |
$l_install_certif_more = "<a href=\"$cert_add/certificat_alcasar_ca.cert\">Install ALCASAR AC Certificate</a>";
|
102 |
$l_install_certif_more = "<a href=\"$cert_add/certificat_alcasar_ca.cert\">Install ALCASAR AC Certificate</a>";
|
103 |
$l_certif_explain = "Allow secure data exchange between your computer and ALCASAR portal.<BR>If this certificate isn't incorporated in your computer, some security alerts should appear in your browser.<br><br>";
|
103 |
$l_certif_explain = "Allow secure data exchange between your computer and ALCASAR portal.<BR>If this certificate isn't incorporated in your computer, some security alerts should appear in your browser.<br><br>";
|
104 |
$l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">Complementary help</a>";
|
104 |
$l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">Complementary help</a>";
|
105 |
if ($user[4] == "0") {
|
105 |
if ((isset ($user[4])) && ($user[4] == "0")) {
|
106 |
$l_logout_explain = "No Internet consultation session is actualy open on your system";
|
106 |
$l_logout_explain = "No Internet consultation session is actualy open on your system";
|
107 |
$l_logout = "<a href=\"http://www.google.fr\">Open an Internet session</a>";}
|
107 |
$l_logout = "<a href=\"http://www.google.fr\">Open an Internet session</a>";}
|
108 |
else {
|
108 |
else {
|
- |
|
109 |
if (isset ($user[5])) {
|
109 |
$l_logout_explain = "Close the session of the user actualy connecterd.<br> User logged-on : <a href=\"http://$hostname:3990/logoff\" title=\"Disconnect user $user[5]\"><b>$user[5]</b></a><br><br>$nb_connection_history last connections :$connection_history";
|
110 |
$l_logout_explain = "Close the session of the user actualy connecterd.<br> User logged-on : <a href=\"http://$hostname:3990/logoff\" title=\"Disconnect user $user[5]\"><b>$user[5]</b></a><br><br>$nb_connection_history last connections :$connection_history";
|
110 |
$l_logout = "<a href=\"http://$hostname:3990/logoff\">Logoff from internet</a>";}
|
111 |
$l_logout = "<a href=\"http://$hostname:3990/logoff\">Logoff from internet</a>";
|
- |
|
112 |
}
|
- |
|
113 |
}
|
111 |
$l_password_change = "<a href=\"https://$hostname/pass\">Change your password</a>";
|
114 |
$l_password_change = "<a href=\"https://$hostname/pass\">Change your password</a>";
|
112 |
$l_password_change_explain = "Ridirect you on password change page.<br><br> You should already have an Internet access account.";
|
115 |
$l_password_change_explain = "Ridirect you on password change page.<br><br> You should already have an Internet access account.";
|
113 |
$l_back_page = "<a href=\"javascript:history.back()\">Previous page</a>";
|
116 |
$l_back_page = "<a href=\"javascript:history.back()\">Previous page</a>";
|
114 |
}
|
117 |
}
|
115 |
$l_title = ($direct_access ? $l_access_welcome : ($network_pb ? $l_access_unavailable : $l_access_denied));
|
118 |
$l_title = ($direct_access ? $l_access_welcome : ($network_pb ? $l_access_unavailable : $l_access_denied));
|
Line 125... |
Line 128... |
125 |
$img_certificate = "certificat.png";
|
128 |
$img_certificate = "certificat.png";
|
126 |
$img_acc = "logo-alcasar_70.png";
|
129 |
$img_acc = "logo-alcasar_70.png";
|
127 |
$img_false = "interdit.png";
|
130 |
$img_false = "interdit.png";
|
128 |
$img_internet = $img_connect;
|
131 |
$img_internet = $img_connect;
|
129 |
|
132 |
|
130 |
if ($user[4] == "0") {
|
133 |
if ((isset ($user[4])) && ($user[4] == "0")) {
|
131 |
if (! $network_pb) {
|
134 |
if (! $network_pb) {
|
132 |
$img_internet = $img_access;
|
135 |
$img_internet = $img_access;
|
133 |
}
|
136 |
}
|
134 |
else {
|
137 |
else {
|
135 |
$img_internet = $img_warning;
|
138 |
$img_internet = $img_warning;
|