salvando e consultando logs no mariadb
This commit is contained in:
@@ -443,6 +443,20 @@ class Controller extends DBA{
|
||||
$this->res = $this->stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
return $this-> res;
|
||||
}
|
||||
public function getLogs($USUARIO,$CIDADE,$SISTEMA){
|
||||
$this->sql = "SELECT *
|
||||
FROM log_pais
|
||||
WHERE NO_USUARIO LIKE ?
|
||||
AND CIDADE = ?
|
||||
AND SISTEMA = ? ";
|
||||
$this->stmt = $this->getMARIA()->prepare($this->sql);
|
||||
$this->stmt->bindValue(1,"%".$USUARIO."%");
|
||||
$this->stmt->bindValue(2,$CIDADE);
|
||||
$this->stmt->bindValue(3,$SISTEMA);
|
||||
$this->stmt->execute();
|
||||
$this->res = $this->stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
return $this-> res;
|
||||
}
|
||||
public function deletaPais($CPF){
|
||||
$this->sql = "DELETE FROM usuarios WHERE CPF = ?";
|
||||
$this->stmt = $this->getMARIA()->prepare($this->sql);
|
||||
|
||||
@@ -6,4 +6,13 @@ class LogController{
|
||||
$Log = new Controller();
|
||||
$Logins = $Log->insertLog();
|
||||
}
|
||||
public function buscarLogs($params){
|
||||
$usuario = $params->USUARIO;
|
||||
$cidade = $params->CIDADE;
|
||||
$sistema = $params->SISTEMA;
|
||||
$Con = new Controller();
|
||||
$Logs = $Con->getLogs($usuario,$cidade,$sistema);
|
||||
echo json_encode($Logs);
|
||||
return json_encode($Logs);
|
||||
}
|
||||
}
|
||||
@@ -44,6 +44,7 @@ $router= [
|
||||
"/buscarCPFMae" => function(){load("LoginController","buscarCPFMae");},
|
||||
"/buscarCPFPai" => function(){load("LoginController","buscarCPFPai");},
|
||||
"/buscarcadastrocpf" => function(){load("LoginController","buscarCadastroCPF");},
|
||||
"/buscarlogs" => function(){load("LogController","buscarLogs");},
|
||||
],
|
||||
"POST"=>[
|
||||
"/inserirpais" => function(){load("PaisController","insert");},
|
||||
|
||||
Reference in New Issue
Block a user