basename (__FILE__) on internal pages

0

I have the following structure on my pages:

for example, site.php

<?php require_once "config.php";  $livre = true; ?>
<!DOCTYPE html>
<html>
<head>
 <title><?php echo $constantes->getTituloSite(); ?></title>
 <?php  require_once("_scripts/_php/_configuracoes/meta.ini"); ?>
 <link rel="shortcut icon" type="image/x-icon" href="_imgs/favicon.ico" />
 <link type="text/css" rel="stylesheet" href="_scripts/_css/estilo.css" />
 <link type="text/css" rel="stylesheet" href="_scripts/_css/site.css" />
 <script type="text/javascript" src="_scripts/_js/jquery-2.1.4.min.js"></script>
</head>
<body>
   <div class="topo">
     <h1 class="h1Centralizado"><?php echo $constantes->getTituloSite(); ?></h1>
   </div>
   <div class="cont">
      <div class="sessoes"><?php require_once("siteConteudo.php"); ?></div>
   </div>
   <div class="final">
      <div class="sessoes"><?php require_once("site/_requeridos/final.php"); ?></div>
   </div>
</body>
</html>

And I have the file below config.php included in site.php by require_once     

  if (!isset($_SESSION["acesso"])) {

      $paginaAtual = basename( __FILE__ );

      echo $paginaAtual;
      exit();

      if (
          $paginaAtual <> "401.php" &&
          $paginaAtual <> "403.php" &&
          $paginaAtual <> "404.php" &&
          $paginaAtual <> "500.php" &&
          $paginaAtual <> "recuperSenha.php"
      ) header("Location: index.php");

  }

  header  ("Content-Type: text/html; charset=utf-8");

  require_once "_scripts/_php/_configuracoes/erros.php";
  require_once "_classes/_conexao/Conexao.php";

  require_once "_classes/_mvc/_modelos/Membros.php";  
  require_once "_classes/_mvc/_modelos/Fotos.php";

  require_once "_classes/_mvc/_controles/MembrosDao.php";
  require_once "_classes/_mvc/_controles/FotosDao.php";

  require_once "_classes/_util/PhpUtil.php";  
  require_once "_classes/_util/Constantes.php";

  $connection = new Conexao();
  $conexao = $connection->abreConexao();

  $membrosDao = new MembrosDao($conexao);
  $fotosDao = new FotosDao($conexao);

  $phpUtil = new PhpUtil();  
  $constantes = new Constantes();  

?>

And I have if else within config.php getting the name of the page:

  if (!isset($_SESSION["acesso"])) {

      $paginaAtual = basename( __FILE__ );

      echo $paginaAtual;
      exit();

      if (
          $paginaAtual <> "401.php" &&
          $paginaAtual <> "403.php" &&
          $paginaAtual <> "404.php" &&
          $paginaAtual <> "500.php" &&
          $paginaAtual <> "recuperSenha.php"
      ) header("Location: index.php");

  }

It happens that it does not deliver to me

site.php

and yes

config.php

In this way, I will never have exactly how to check it out.

  if (
      $paginaAtual <> "401.php" &&
      $paginaAtual <> "403.php" &&
      $paginaAtual <> "404.php" &&
      $paginaAtual <> "500.php" &&
      $paginaAtual <> "recuperSenha.php"
  ) header("Location: index.php");

Because it will always be config.php

Some way around this problem?

    
asked by anonymous 05.01.2019 / 12:24

0 answers