summaryrefslogtreecommitdiffstats
path: root/www/list.php
blob: 6dbeb40ef4c655068c3867580d6a1e318671fd18 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php
require_once "vendor/autoload.php";
use Rhilip\Bencode\TorrentFile;
use Rhilip\Bencode\ParseException;
if ($handle = opendir("..")) {
	echo "<ul>";
	while (false !== ($entry = readdir($handle))) {
		if (preg_match("/torrent$/", $entry)) {
			$h = htmlspecialchars(explode(".", $entry)[0]);
			echo '<li> <a href="info.php?h=' . $h . '">' . $h . '</a>';
		}
	}
	die();
	closedir($handle);
} else {
	die("ne morem brati direktorija");
}