From c6156989725399a83f4a33384a3c60885ed6f211 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Luka=20=C5=A0ijanec?= Date: Mon, 30 Jan 2023 17:27:57 +0100 Subject: new www, c mods --- www/index.php | 108 ++++++++++++++-------------------------------------------- www/info.php | 78 ++++++++++++++++++++++++++++++++++++++++++ www/list.php | 17 +++++++++ 3 files changed, 121 insertions(+), 82 deletions(-) create mode 100644 www/info.php create mode 100644 www/list.php (limited to 'www') diff --git a/www/index.php b/www/index.php index ac4bb50..1fd25a2 100644 --- a/www/index.php +++ b/www/index.php @@ -1,89 +1,33 @@ "; - while (false !== ($entry = readdir($handle))) { - if (preg_match("/torrent$/", $entry)) { - $h = htmlspecialchars(explode(".", $entry)[0]); - echo '
  • ' . $h . ''; - } - } - die(); - closedir($handle); - } else { - die("ne morem brati direktorija"); - } -} -if (!preg_match("/^[a-f0-9A-F]{40}$/", $_REQUEST["h"])) - die('!preg_match("/^[a-f0-9A-F]{40}$/", $_REQUEST["h"])'); -$t = TorrentFile::load("../".$_REQUEST["h"].".torrent"); + require_once "vendor/autoload.php"; + use Rhilip\Bencode\TorrentFile; + use Rhilip\Bencode\ParseException; ?> - - -

    getName()) ?>

    -<?= htmlspecialchars($t->getName()) ?> - - - - - - - - - - - isPrivate()) echo ""; ?> - - - - - - - - - - - - - -getRootData()["source"]["v"]) { ?> - - - - - - - -getSource())) { ?> - - - - -
    pridobljenogetCreationDate()) ?>
    tipgetProtocol() ?>
    datotečni načingetFileMode() ?>
    zaseben
    magnetna povezava
    .torrent>torrent datoteka
    velikostgetSize()/(1024*1024*1024), 6, ",", "") ?> GiB
    število datotekgetFileCount() ?>
    ip naslov viragetRootData()["source"]["ip"]) ?>
    odjemalec viragetRootData()["source"]["v"]) ?>
    velikost koščkagetPieceLength()/1024; ?> kB
    izvorgetSource()) ?>
    + +

    število datotek:

    +

    seznam

    +

    iskalnik

    +
    + " /> + +
    + +

    rezultati

    +
    +
    +
    + diff --git a/www/info.php b/www/info.php new file mode 100644 index 0000000..7ec562a --- /dev/null +++ b/www/info.php @@ -0,0 +1,78 @@ + + + + +

    getName()) ?>

    +<?= htmlspecialchars($t->getName()) ?> + + + + + + + + + + + isPrivate()) echo ""; ?> + + + + + + + + + + + + + + + +getRootData()["source"]["v"]) { ?> + + + + + + + +getSource())) { ?> + + + + +
    pridobljenogetCreationDate()) ?>
    tipgetProtocol() ?>
    datotečni načingetFileMode() ?>
    zaseben
    magnetna povezava
    .torrent>torrent datoteka
    velikostgetSize()/(1024*1024*1024), 6, ",", "") ?> GiB
    število datotekgetFileCount() ?>
    ip naslov viragetRootData()["source"]["ip"]) ?>
    odjemalec viragetRootData()["source"]["v"]) ?>
    velikost koščkagetPieceLength()/1024; ?> kB
    izvorgetSource()) ?>
    + " . htmlspecialchars($k) . ""; + } else { + echo "
  • " . htmlspecialchars($k) . " (" . number_format($v/(1024*1024), 6, ",", "") . " MiB)"; + } +} +echo ""; +?> + +

    interna stran, dostop prepovedan

    + diff --git a/www/list.php b/www/list.php new file mode 100644 index 0000000..6dbeb40 --- /dev/null +++ b/www/list.php @@ -0,0 +1,17 @@ +"; + while (false !== ($entry = readdir($handle))) { + if (preg_match("/torrent$/", $entry)) { + $h = htmlspecialchars(explode(".", $entry)[0]); + echo '
  • ' . $h . ''; + } + } + die(); + closedir($handle); +} else { + die("ne morem brati direktorija"); +} -- cgit v1.2.3