Advertisement
Guest User

Untitled

a guest
Dec 16th, 2023
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.14 KB | None | 0 0
  1. <?php
  2. /*
  3. *
  4. * @ This file is created by http://DeZender.Net
  5. * @ deZender (PHP5 Decoder for ionCube Encoder)
  6. *
  7. * @ Version : 3.5.0.0
  8. * @ Author : DeZender
  9. * @ Release on : 22.06.2018
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. namespace App\Controllers;
  15.  
  16. class BoletosListarController extends Controller
  17. {
  18. public function boletoListar($request, $response, $args)
  19. {
  20. $vars = ['conf' => $GLOBALS['dadosTwig']];
  21.  
  22. return $this->view->render($response, 'boletosListar.twig', $vars);
  23. }
  24.  
  25. public function validaCliente($request, $response, $args)
  26. {
  27. $_SESSION['cliente'] = null;
  28. $_SESSION['servidor'] = null;
  29. $body = $request->getParsedBody();
  30. $baseUrl = $_ENV['BASE_URL'];
  31. $servidor = null;
  32. $dados = [];
  33. $resposta = [];
  34.  
  35. if (false !== getenv('URL_SERVER')) {
  36. $url_servidores = $_ENV['URL_SERVER'];
  37. $servidor = explode(',', $url_servidores);
  38. }
  39.  
  40. $dados['cpf_cnpj'] = (isset($body['cpf_cnpj']) ? str_replace('.', '', str_replace('-', '', str_replace('/', '', $body['cpf_cnpj']))) : null);
  41. $dados['password'] = (isset($body['senha']) ? $body['senha'] : null);
  42. $dados['acesso'] = (isset($body['acesso']) ? $body['acesso'] : null);
  43. $dados['idcliente'] = (isset($body['idcliente']) ? $body['idcliente'] : null);
  44.  
  45. if ($dados['cpf_cnpj'] && $dados['password']) {
  46. $resposta = Request::postFree($baseUrl . '/noauth/faturas', $dados);
  47.  
  48. if (200 == $resposta['status']) {
  49. $_SESSION['cliente'] = ['cpf_cnpj' => $dados['cpf_cnpj'], 'password' => $dados['password']];
  50. $_SESSION['servidor'] = $baseUrl;
  51.  
  52. return $response->withJson(['msg' => 'Acesso disponível.', 'tipo' => 'faturas'], 200);
  53. }
  54.  
  55. if (false != getenv('URL_SERVER')) {
  56. $url_servidores = $_ENV['URL_SERVER'];
  57. $servidor = explode(',', $url_servidores);
  58. }
  59.  
  60. if (null != $servidor) {
  61. for ($i = 0; $i < sizeof($servidor); ++$i) {
  62. $srv = $servidor[$i];
  63. $respostas = Request::postFree($srv . '/noauth/faturas/' . $dados['cpf_cnpj'], null);
  64.  
  65. if (200 == $respostas['status']) {
  66. $_SESSION['cliente'] = ['cpf_cnpj' => $dados['cpf_cnpj'], 'password' => $dados['password']];
  67. $_SESSION['servidor'] = $srv;
  68.  
  69. return $response->withJson(['msg' => 'Acesso disponível.', 'tipo' => 'faturas'], 200);
  70. }
  71. }
  72. }
  73.  
  74. return $response->withJson(['msg' => 'CPF/CNPJ não encontrado.'], 400);
  75. }
  76.  
  77. if ($dados['cpf_cnpj'] && null == $dados['password']) {
  78. $resposta = Request::getFree($baseUrl . '/noauth/faturas/' . $dados['cpf_cnpj'], null);
  79.  
  80. if (200 == $resposta['status']) {
  81. if (true == $dados['acesso']) {
  82. $resposta = Request::getFree($baseUrl . '/noauth/faturas/' . $dados['cpf_cnpj'] . '/idcliente/' . $dados['idcliente'], null);
  83.  
  84. switch ($resposta['resposta']->tipo) {
  85. case 'faturas':
  86. $_SESSION['cliente'] = ['cpf_cnpj' => $dados['cpf_cnpj'], 'password' => $dados['password'], 'idcliente' => $dados['idcliente']];
  87. $_SESSION['servidor'] = $baseUrl;
  88. $cpf = $_SESSION['cliente'];
  89. ...........................................................................
  90. ............................................
  91. .......................
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement