List folder with files with htm extension and open in new page

0

I get ".htm" extension files daily with information I need to open to view, and I always use the right mouse button and 'open with' button and choose the browser. Like this: archivotexto1.htm archivotexto2.htm archivotexto3.htm

Detail: File names always vary, but the extension is always '.htm'

I tried to make this code:

<?php
// diretório onde estão os arquivos
$diretorio = "c:\diretorio\mes_e_Ano";

// *.txt são os formatos de arquivos a serem alterados
foreach (glob("$diretorio/*.*") as $arquivo) {
$p1 = explode("/", $arquivo);
$p2 = explode(".", $p1[1]);
//print "<a href=\"$arquivo\" target=\"_blank\">$p2[0]</a><br>";
//print "<a href=\"#\" onclick=\"window.open('$arquivo','_blank','')\">$p2[0]</a><br>";
print "<a href=\"#\" onclick=\"window.open('http://nomeservidor/mes_e_ano/','$arquivo','')\">$p2[0]</a><br>";
}

?>

opens the file view. I can visualize. But when I click on them, it presents error that there is no visualization. 'Forbidden'

If you change the parameter on the server, in the "Options -Indexes", putting a "#" on the front it starts to display and it works, however the correct one is to keep the parameter for security reasons. >

I would like to know how I can when I click on the symbolic link, already open automatically, without having to disable the parameter.

If someone can help, thank you

    
asked by anonymous 05.10.2017 / 15:21

0 answers