2
Guys, I’m trying to call the user logged in on this variable but it’s not working, I’d like to know where I’m going wrong.
<?php
include("../conexao_checkout.php");
$usuario = $_SESSION['UsuarioID'];
$usuario_nome = $_SESSION['UsuarioNome'];
$ip = $_SERVER["REMOTE_ADDR"];
$data_contratado = date('Y-m-d H:i:s');
$exibicao = $_POST["exibicao"];
$filtro = $_POST["filtro"];
$entrega = $_POST["entrega"];
$contrata = $_POST["contrata"];
if ($filtro > 0) {
$cli = " AND `id_cliente` = ".$filtro;
}else{
$cli = "";
}
if ($entrega != "") {
$data2 = str_replace('/', '-', $entrega);
$nova_data2 = strftime("%Y-%m-%d", strtotime($data2));
$ent = "AND `prazo_entrega` LIKE '%".$nova_data2."%' ";
}else{
$ent = "";
}
if ($contrata != "") {
$data1 = str_replace('/', '-', $contrata);
$nova_data = strftime("%Y-%m-%d", strtotime($data1));
$cont = "AND `contratacao` LIKE '%".$nova_data."%' ";
}else{
$cont = "";
}
$results = mysqli_query($conexao, "SELECT * FROM `servicos_filiais` WHERE `tecnico_interno` = $usuario {$cli} {$ent} {$cont};");
Could edit the question and post the code as text?
– Victor Stafusa
Read this: Injection of SQL.
– Victor Stafusa
Vctor Stafusa, edited with the code, thank you friend I will read these lessons.
– Alan Arantes