[squid-users] helperHandleRead: unexpected read

499258179 wx499258179 at gmail.com
Fri Nov 1 06:15:29 UTC 2019


Following is my php script, can u check for me, it is looks like  only one
line stdout
<?php

$STDIN=fopen("php://stdin", "r");
$STDOUT=fopen("php://stdout", "w");

$servername = "localhost";
$username = "test";
$password = "test";
$dbname = "test";
$socket = "/var/lib/mysql/mysql.sock";
$conn = mysqli_connect($servername, $username, $password,
$dbname,0,$socket);

if (mysqli_connect_errno()) {
    echo "Failed to connect to MySQL: " . mysqli_connect_error();
        exit();
}

date_default_timezone_set('US/Eastern');

while (!feof($STDIN)) {
$input = trim(fgets($STDIN));
$data = explode(' ',$input);
$username = rawurldecode($data[0]);

$result = mysqli_query($conn,"SELECT * FROM MyGuests WHERE username =
'$username'");
$row = mysqli_fetch_array($result);
$Time_Now = date("Y-m-d H:i:s");
$Start_Date = $row['reg_date'];
$Expire_Date = date("Y-m-d h:i:s",strtotime("$Start_Date +720 hours"));

if($Start_Date < $Time_Now)
{
        if($Time_Now < $Expire_Date)
        {
                fwrite($STDOUT, "OK\n");
                mysqli_close($conn);
        }
        else
        {
                fwrite($STDOUT, "ERR\n");
                mysqli_close($conn);
        }
}
else
{
fwrite($STDOUT, "ERR\n");
mysqli_close($conn);
}
}

?>



--
Sent from: http://squid-web-proxy-cache.1019090.n4.nabble.com/Squid-Users-f1019091.html


More information about the squid-users mailing list