diff --git a/app/controllers/Controller.php b/app/controllers/Controller.php index b5449d2..2cd12ad 100644 --- a/app/controllers/Controller.php +++ b/app/controllers/Controller.php @@ -328,6 +328,35 @@ class Controller extends DBA{ } } } + public function insertLog(){ + $DATA = $_POST['DATA']; + $TELA = $_POST['TELA']; + $CD_USUARIO = $_POST['CD_USUARIO']; + $NO_USUARIO = $_POST['NO_USUARIO']; + $CD_ALUNO = $_POST['CD_ALUNO']; + $NO_ALUNO = $_POST['NO_ALUNO']; + $CIDADE = $_POST['CIDADE']; + if($DATA!=''){ + $this->sql = "INSERT INTO log_pais (DATA, TELA, CD_USUARIO, NO_USUARIO, CD_ALUNO,NO_ALUNO, CIDADE) + VALUES (:DATA, :TELA, :CD_USUARIO, :NO_USUARIO, :CD_ALUNO, :NO_ALUNO, :CIDADE)"; + $this->stmt = self::$instMARIA->prepare($this->sql); + $this->stmt->bindValue(':DATA', $DATA); + $this->stmt->bindValue(':TELA', $TELA); + $this->stmt->bindValue(':CD_USUARIO', $CD_USUARIO); + $this->stmt->bindValue(':NO_USUARIO', $NO_USUARIO); + $this->stmt->bindValue(':CD_ALUNO', $CD_ALUNO); + $this->stmt->bindValue(':NO_ALUNO', $NO_ALUNO); + $this->stmt->bindValue(':CIDADE', $CIDADE); + $this->stmt->execute(); + if($this->stmt){ + echo 'log salvo'; + }else{ + echo 'erro'; + } + }else{ + echo 'erro'; + } + } } class DBA{ diff --git a/app/controllers/LogController.php b/app/controllers/LogController.php new file mode 100644 index 0000000..e74c3d6 --- /dev/null +++ b/app/controllers/LogController.php @@ -0,0 +1,9 @@ +insertLog(); + } +} \ No newline at end of file diff --git a/routes/router.php b/routes/router.php index 6ef139f..acdff6d 100644 --- a/routes/router.php +++ b/routes/router.php @@ -38,6 +38,7 @@ $router= [ "POST"=>[ "/inserirpais" => fn()=> load("PaisController","insert"), "/inserir_acesso" => fn()=> load("AcessoController","inserir"), + "/log" => fn()=> load("LogController","inserirLog"), ] ];