summaryrefslogblamecommitdiffstats
path: root/www/index.php
blob: 1fd25a2cc79a9e389e95237ec71b0263e629c058 (plain) (tree)
1
2
3
4
5
6
     


                                           

                      
















                                                                                                      
     




                                                                                                                  
 
  
     
          
<?php
	require_once "vendor/autoload.php";
	use Rhilip\Bencode\TorrentFile;
	use Rhilip\Bencode\ParseException;
?>
<meta charset=UTF-8 />
<meta name=viewport content='width=device-width, initial-scale=1.0'>
<h1>število datotek: <?= shell_exec("find .. -name '*.torrent' | wc -l") ?></h1>
<h2><a href=list.php>seznam</a></h2>
<h2>iskalnik</h2>
<form>
	<input name=i value="<?= !empty($_REQUEST["i"]) ? htmlspecialchars($_REQUEST["i"]) : "" ?>" />
	<input type=submit value=išči />
</form>
<?php if (!empty($_REQUEST["i"])) { ?>
<h3>rezultati</h3>
<pre>
<?php
$q = "find .. -name '*.torrent' | xargs grep -lie " . escapeshellarg($_REQUEST["i"]);
echo htmlspecialchars($q);
?>
</pre>
<ul>
<?php
foreach (explode(PHP_EOL, shell_exec($q)) as $f) {
	if (trim($f) == "")
		continue;
	$t = TorrentFile::load($f);
	echo "<li> <a href=info.php?h=" . $t->getInfoHash() . ">" . htmlspecialchars($t->getName()) . "</a></li>";
}
?>
</ul>
<?php } ?>