diff options
author | Anton Luka Šijanec <anton@sijanec.eu> | 2023-01-30 20:11:54 +0100 |
---|---|---|
committer | Anton Luka Šijanec <anton@sijanec.eu> | 2023-01-30 20:11:54 +0100 |
commit | a6565a01376af755c1b0fc2c62b4a4f8d8b952bf (patch) | |
tree | 3eb74e6509398d07d51129670c82825d2eff4076 /www/index.php | |
parent | new www, c mods (diff) | |
download | travnik-a6565a01376af755c1b0fc2c62b4a4f8d8b952bf.tar travnik-a6565a01376af755c1b0fc2c62b4a4f8d8b952bf.tar.gz travnik-a6565a01376af755c1b0fc2c62b4a4f8d8b952bf.tar.bz2 travnik-a6565a01376af755c1b0fc2c62b4a4f8d8b952bf.tar.lz travnik-a6565a01376af755c1b0fc2c62b4a4f8d8b952bf.tar.xz travnik-a6565a01376af755c1b0fc2c62b4a4f8d8b952bf.tar.zst travnik-a6565a01376af755c1b0fc2c62b4a4f8d8b952bf.zip |
Diffstat (limited to '')
-rw-r--r-- | www/index.php | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/www/index.php b/www/index.php index 1fd25a2..e37fe7f 100644 --- a/www/index.php +++ b/www/index.php @@ -16,7 +16,7 @@ <h3>rezultati</h3> <pre> <?php -$q = "find .. -name '*.torrent' | xargs grep -lie " . escapeshellarg($_REQUEST["i"]); +$q = "find .. -maxdepth 2 -name '*.torrent' | xargs grep -lie " . escapeshellarg($_REQUEST["i"]); echo htmlspecialchars($q); ?> </pre> @@ -26,7 +26,11 @@ 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>"; + $m = []; + preg_match("|/([a-fA-F0-9]*).torrent|", $f, $m); + if (count($m) < 2) + var_dump([$f, $m]); + echo "<li> <a href=info.php?h=" . $m[1] . ">" . htmlspecialchars($t->getName()) . "</a></li>"; } ?> </ul> |