Search squid archive

HI, MY ACL HELPER need help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hi all, i have acl helper to lookup user from db by ip.

include("db.php");

// loop
while (!feof(STDIN)) {
       $line = trim(fgets(STDIN));
       $ip = rawurldecode($line);
       checkIp($ip);

}


// Check db
function checkIp($ip) {

$ip = mysql_escape_string($ip);
$query = "SELECT * FROM `sessions`";
$result = mysql_query($query);
$num_rows = mysql_num_rows($result);

while ($row=mysql_fetch_array($result)) {

if ($row['ip'] == $ip) {
   fwrite(STDOUT, "OK user=".$row['username']."\n"); // sif user found
   return true;
}


}
fwrite(STDOUT, "ERR"."\n"); // no found


sleep(2);
}

and log helperhanlde read unexpected read from IPUYser #1, #2, etc 1 bytes
in some cases 16 bytes when return user,

this question how exact value to return, with quotes?

OK user="pepe"\n      ? no work
OK "user=pepe"\n        ? no work


regards

[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux