| Line 1... |
Line 1... |
| 1 |
<?php
|
1 |
<?php
|
| 2 |
# $Id: index.php 2083 2016-12-05 23:15:10Z richard $
|
2 |
# $Id: index.php 2085 2016-12-07 18:29:05Z richard $
|
| 3 |
#
|
3 |
#
|
| 4 |
# index.php for ALCASAR bu Rexy
|
4 |
# index.php for ALCASAR by Rexy
|
| 5 |
# UI & css style by stephane ERARD
|
5 |
# UI & css style by stephane ERARD
|
| 6 |
# The contents of this file may be used under the terms of the GNU
|
6 |
# The contents of this file may be used under the terms of the GNU
|
| 7 |
# General Public License Version 2, provided that the above copyright
|
7 |
# General Public License Version 2, provided that the above copyright
|
| 8 |
# notice and this permission notice is included in all copies or
|
8 |
# notice and this permission notice is included in all copies or
|
| 9 |
# substantial portions of the software.
|
9 |
# substantial portions of the software.
|
| Line 87... |
Line 87... |
| 87 |
if(isset($_GET['warn']) && isset($_GET['url']))
|
87 |
if(isset($_GET['warn']) && isset($_GET['url']))
|
| 88 |
{
|
88 |
{
|
| 89 |
$direct_access = False;
|
89 |
$direct_access = False;
|
| 90 |
}
|
90 |
}
|
| 91 |
|
91 |
|
| 92 |
|
- |
|
| 93 |
# If the user is connected : retrieve the 3 last connexions
|
- |
|
| 94 |
if ((isset ($user[4])) && ($user[4] != "0")){
|
92 |
if ((isset ($user[4])) && ($user[4] != "0")){ # the user is authenticated
|
| 95 |
|
- |
|
| 96 |
if(isset($_GET['redirect'])) # if user has been warned, we redirect him to his website
|
93 |
if(isset($_GET['redirect'])) # if user has been warned, we redirect him to his website
|
| 97 |
{
|
94 |
{
|
| 98 |
$redir = "http://".$_GET['url'];
|
95 |
$redir = "http://".$_GET['url'];
|
| 99 |
header("Location: $_GET[url]",TRUE,307);
|
96 |
header("Location: $_GET[url]",TRUE,307);
|
| 100 |
exit;
|
97 |
exit;
|
| 101 |
}
|
98 |
}
|
| 102 |
|
- |
|
| 103 |
|
- |
|
| - |
|
99 |
// we retrieve his three last connections
|
| 104 |
if ((is_file("./acc/manager/lib/sql/drivers/mysql/functions.php"))&&(is_file("/etc/freeradius-web/config.php"))){
|
100 |
((is_file("./acc/manager/lib/sql/drivers/mysql/functions.php"))&&(is_file("/etc/freeradius-web/config.php"))){
|
| 105 |
include_once("/etc/freeradius-web/config.php");
|
101 |
include_once("/etc/freeradius-web/config.php");
|
| 106 |
include_once("./acc/manager/lib/sql/drivers/mysql/functions.php");
|
102 |
include_once("./acc/manager/lib/sql/drivers/mysql/functions.php");
|
| 107 |
|
103 |
|
| 108 |
$sql = "SELECT UserName, AcctStartTime, AcctStopTime, acctsessiontime FROM radacct WHERE UserName='$user[5]' ORDER BY AcctStartTime DESC LIMIT 0 , $nb_connection_history";
|
104 |
$sql = "SELECT UserName, AcctStartTime, AcctStopTime, acctsessiontime FROM radacct WHERE UserName='$user[5]' ORDER BY AcctStartTime DESC LIMIT 0 , $nb_connection_history";
|
| 109 |
$link = @da_sql_pconnect($config); // on affiche pas les erreurs
|
105 |
$link = @da_sql_pconnect($config);
|
| 110 |
if ($link){
|
106 |
if ($link){
|
| 111 |
$res = @da_sql_query($link,$config,$sql); // on affiche pas les erreurs
|
107 |
$res = @da_sql_query($link,$config,$sql);
|
| 112 |
|
- |
|
| 113 |
if ($res){
|
108 |
if ($res){
|
| 114 |
$connection_history.= "<ul>";
|
109 |
$connection_history.= "<ul>";
|
| 115 |
while(($row = @da_sql_fetch_array($res,$config))){
|
110 |
while(($row = @da_sql_fetch_array($res,$config))){
|
| 116 |
$connected = "";
|
111 |
$connected = "";
|
| 117 |
if ($row['acctstoptime'] == "") $connected = " (active)";
|
112 |
if ($row['acctstoptime'] == "") $connected = " (active)";
|
| Line 120... |
Line 115... |
| 120 |
$connection_history.="</ul>";
|
115 |
$connection_history.="</ul>";
|
| 121 |
}
|
116 |
}
|
| 122 |
}
|
117 |
}
|
| 123 |
}
|
118 |
}
|
| 124 |
}
|
119 |
}
|
| 125 |
else # user not connected
|
120 |
else # the user isn't authenticated
|
| 126 |
{
|
121 |
{
|
| 127 |
exec("sudo /usr/sbin/ipset list not_auth_yet | grep $remote_ip | wc -l 2>&1", $ipset_not_auth_yet);
|
122 |
exec("sudo /usr/sbin/ipset list not_auth_yet | grep $remote_ip | wc -l 2>&1", $ipset_not_auth_yet);
|
| 128 |
if(!$direct_access && $ipset_not_auth_yet[0] == '0') # it's the first stage of the interception
|
123 |
if(!$direct_access && $ipset_not_auth_yet[0] == '0') # it's the first stage of the interception
|
| 129 |
{
|
124 |
{
|
| 130 |
$display_menu = True; # Display menu for user not_auth_yet
|
125 |
$display_menu = True; # Display menu for user not_auth_yet
|
| Line 426... |
Line 421... |
| 426 |
}
|
421 |
}
|
| 427 |
else {
|
422 |
else {
|
| 428 |
$sms_div='';
|
423 |
$sms_div='';
|
| 429 |
$sms_div_over='';
|
424 |
$sms_div_over='';
|
| 430 |
}
|
425 |
}
|
| 431 |
?>
|
- |
|
| 432 |
<?php
|
- |
|
| 433 |
if ($direct_access || $display_menu){
|
426 |
if ($direct_access || $display_menu){
|
| 434 |
echo " <div id=\"box_bienvenue\">
|
427 |
echo " <div id=\"box_bienvenue\">
|
| 435 |
$l_welcome
|
428 |
$l_welcome
|
| 436 |
</div>
|
429 |
</div>
|
| 437 |
<div class=\"box_menu\" id=\"box_conn\" onmouseover=\"valoriserDiv5(text_conn);\">
|
430 |
<div class=\"box_menu\" id=\"box_conn\" onmouseover=\"valoriserDiv5(text_conn);\">
|