Fix script per squid

This commit is contained in:
Claudio Maffioletti
2017-05-23 10:20:39 +02:00
parent d6f3443ad8
commit d0cc3f4d25
7 changed files with 78 additions and 30 deletions

View File

@@ -20,19 +20,33 @@ my $dbmysql = DBI->connect("DBI:mysql:;host=$DBhost", $DBuser, $DBpass) or die (
$sts = $dbmysql->prepare("use $DBname");
$sts->execute ();
#open LOG, ">> /srv/www/htdocs/pannello_vbc/proxy/squid_acl/squid_pool.log";
#LOG->autoflush(1);
open LOG, ">> /usr/local/mybin/proxy/squid_acl/squid_pool.log";
LOG->autoflush(1);
# pass = PASSWORD('".$param[1]."')
alarm $timeout;
while($limit) {
my $query = "";
my $input = <>;
print LOG "AUTH -- $input\n";
chop $input;
my @param = split / /, $input;
if ($param[0] ne "") {
$query = "SELECT id, primo, (tempo*3600)-time_to_sec(timediff(ultimo, primo)) AS rimasto, tempo FROM proxy_utenti WHERE user = '".$param[0]."' AND pass = PASSWORD('".$param[1]."') AND attivo = 1";
$query = " SELECT
id,
primo,
(tempo*3600)-time_to_sec(timediff(ultimo, primo)) AS rimasto,
tempo
FROM
proxy_utenti
WHERE
user = '".$param[0]."'
AND
pass = ENCRYPT('".$param[1]."',LEFT(pass, 2))
AND
attivo = 1";
$limit--;
alarm $timeout;
} else {