Rodrigo Gliksberg wrote:
> 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
>
no quotes, ensure utf8 or ASCII charset and url-encode any whitespace or
special codes in values.
Amos
-- Please be using Current Stable Squid 2.7.STABLE6 or 3.0.STABLE14 Current Beta Squid 3.1.0.7Received on Fri Apr 17 2009 - 02:21:29 MDT
This archive was generated by hypermail 2.2.0 : Fri Apr 17 2009 - 12:00:02 MDT