1805 |
clement.si |
1 |
<?php
|
|
|
2 |
if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php"))
|
|
|
3 |
include_once("../lib/sql/drivers/$config[sql_type]/functions.php");
|
|
|
4 |
else{
|
|
|
5 |
echo "<b>Could not include SQL library</b><br>\n";
|
|
|
6 |
exit();
|
|
|
7 |
}
|
|
|
8 |
|
|
|
9 |
$date=date($config[sql_full_date_format]);
|
|
|
10 |
$lockmsg_name = $attrmap['Dialup-Lock-Msg'] . '0';
|
|
|
11 |
$msg = $$lockmsg_name;
|
|
|
12 |
$admin = '-';
|
|
|
13 |
if ($_SERVER["PHP_AUTH_USER"] != '')
|
|
|
14 |
$admin = $_SERVER["PHP_AUTH_USER"];
|
|
|
15 |
if ($msg == '')
|
|
|
16 |
echo "<b>Lock Message should not be empty</b><br>\n";
|
|
|
17 |
else{
|
|
|
18 |
$sql_servers = array();
|
|
|
19 |
if ($config[sql_extra_servers] != '')
|
|
|
20 |
$sql_servers = explode(' ',$config[sql_extra_servers]);
|
|
|
21 |
$sql_servers[] = $config[sql_server];
|
|
|
22 |
foreach ($sql_servers as $server){
|
|
|
23 |
$link = da_sql_host_connect($server,$config);
|
|
|
24 |
if ($link){
|
|
|
25 |
$r = da_sql_query($link,$config,
|
|
|
26 |
"INSERT INTO $config[sql_badusers_table] (username,incidentdate,admin,reason)
|
|
|
27 |
VALUES ('$login','$date','$admin','$msg');");
|
|
|
28 |
if (!$r)
|
|
|
29 |
echo "<b>SQL Error:" . da_sql_error($link,$config) . "</b><br>\n";
|
|
|
30 |
else
|
|
|
31 |
echo "<b>User added to badusers table</b><br>\n";
|
|
|
32 |
da_sql_close($link,$config);
|
|
|
33 |
}
|
|
|
34 |
else
|
|
|
35 |
echo "<b>SQL Error: Could not connect to SQL database: $server</b><br>\n";
|
|
|
36 |
}
|
|
|
37 |
}
|
|
|
38 |
?>
|