0
I am doing a check to send alerts if it exceeds the time when a task has to be done.
Code Jquery
:
function session_checking1()
{
$.post( "./alertaposicionamento", function( data ) {
if(data == "-1")
{
alert('Tem posicionamentos em atraso!');
}
});
}
var validateSession1 = setInterval(session_checking1, 10000);
On the page alertaposicionamento
have the following php:
$result1 = mysqli_query($conn, $query2);
while ($row = mysqli_fetch_array($result1)) {
$teste = $row["codigo"];
$teste1 = $row["Colaborador"];
$teste2 = $row["FimTarefa"];
$teste3 = $row["TipoPeriodicidade"];
$teste4 = $row["Tempo"];
$teste5 = $row["Ala"];
$teste8 = $row["nome"];
}
$query = "SELECT iduser, hostname FROM raddb.sessoes
WHERE datafim IS NULL AND hostname = '$teste5'";
$result = mysqli_query($conn, $query);
while ($row1 = mysqli_fetch_array($result)) {
$teste6 = $row1["iduser"];
$teste7 = $row1["hostname"];
}
if ($teste4 > $teste3 AND $teste5 == $teste7 AND $teste6 == $_SESSION['usuarioId']) {
//expired
echo "-1";
} else {
//not expired
echo "1";
}
Works correctly and as intended. I intended to make an improvement, I wanted to take the value of the variable $teste8
, send it by URL and add the value of this variable to the message I have inside the Jquery
alert('Tem posicionamento em atraso do (e o valor da variável $teste8) !');
.