Ir para conteúdo
Fórum Script Brasil

adrianpedro

Membros
  • Total de itens

    1
  • Registro em

  • Última visita

Sobre adrianpedro

adrianpedro's Achievements

0

Reputação

  1. Galera, precisei desenterrar esse post. Estou com um sistema em desenvolvimento mas não estou conseguindo bloquear os acessos via url. Meu código da referida página onde preciso que seja bloqueado o acesso direto é essa: index.php <?php require_once ('php/validasessao.php'); ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Sistema DeathFile</title> <!--<script src="includes/ice/ice.js" type="text/javascript"></script>--> </head> <body background="img/fundo.jpg" width="100%"> <div id="geral" width="50%"> <div id="cabecalho"> <table align="center" width="87%" height="112"> <tr> <td width="18%"><img src="img/logo2.png" width="85" height="87"/> <td width="36%" height="106" align="center"><form action="php/pesquisar.php" method="POST"> <input type="text" name="buscaFile" value="" /> <input type="submit" name="btnbuscar" value="Pesquisar" /> </form></td> <td width="22%" height="106"><div align="justify"> <font color="#FFFFFF"><b><? echo $_SESSION['idlogin']; ?></b></font> </td> <td width="23%"><a href="php/logout.php"><input type="button" name="logout" value="Logout"></a></td> <td width="1%"> </td> </tr> </table> </div> <div id="central"> <table align="center" width="90%" height="183"> <tr> <td width="21%" height="103"> <div id="tree" class="tree" width="110"> <p> <form action=""> <input type="submit" value="Ano" name="ano" /> </p> <p> <input type="submit" value="Turma" name="turma" /> </p> <p> <input type="submit" value="Documento" name="doc" /> </p> </form> </div> <p><br /> </p> <p><br /> </p> <!-- #########DIV PARA UPLOAD DE ARQUIVOS. ESTÁ OK! ####### --> <div id="send" class="sendFile" width="300"> <form action="./php/upload.php" enctype="multipart/form-data" method="POST"> Nome para o arquivo: <input type="text" name="nome_file"> <br /> <input name="localFile" size="20" type="file" /> <input type="submit" value="Enviar" name="sendFile" /> </form> </div> <!-- ############################################################## --> </td> <td width="79%" valign="top"> <div id="topmenu"> <font color="#FFFFFF"><strong><table border="2" bgcolor="#666666" width="85%" align="tip"> <tr> <td width="10%">ID</td> <td width="61%">NOME</td> <td width="29%">TIPO</td> </tr> <tr> <td height="200" colspan="7" rowspan="7" bgcolor="#CCCCCC"></td> </tr> <tr> </table> </div> <div id="botaoacao"> <table width="1051" align="left"> <tr> <td width="288" height="29"><!--<a href="php/create.php">--> <input type="submit" id="criarPasta" name="criarPasta" value="Criar Pasta" onClick="window.open('php/criapasta.php');" /> <input type="button" id="imprimir" name="impressao" value="Imprimir" onClick="javascript('window.print()');"/> </td> </tr> </table> </div> <p><br /> <br /> <div id="rodape"> </p> </body> </html> validasessao.php <? $requi = $_SERVER["HTTP_REFERER"]; $requi= strtolower("/$requi/"); // $server = $_SERVER['SERVER_NAME']; $server= strtolower("/$server/"); if(preg_match($server, $requi) == 0){ header("Location: start.php"); die(); } ?> Porém essa versão bloqueia até de mais, porque por mais que eu chame a página a partir da start.php (que é o form inicial para login) que por sua vez chama o script login.php para validar o user e pass, sempre me devolve pra tela inicial do sistema. Outras formas que tentei do valida foram: <? if(basename($_SERVER["PHP_SELF"])==basename(__FILE__) ){ exit("<script>alert('não permitido')</script>\n <script>window.location=('start.php')</script>"); } ?> e essa <? if (basename($_SERVER['SCRIPT_NAME']) == basename(__FILE__)) { echo "usuário sem permissão!"; die(); } ?> Mas nenhuma delas me bloqueia o quando digito o caminho http://localhost/index.php. Se alguém tiver uma luz para a razão pela qual o sistema não bloqueia, me avise... preciso com urgência. Obrigado! :D
×
×
  • Criar Novo...