X-Git-Url: https://472bisson.ca/gitweb/magnet.git/blobdiff_plain/b66caf1dce9526aeece6d22dc82382475cb02722..c0adce5f9b064b542725bc661737678311bd7479:/index.php diff --git a/index.php b/index.php index 0838e17..6f9e740 100644 --- a/index.php +++ b/index.php @@ -1,71 +1,125 @@ "; - if($site == 'torrage') + $name = filter_input(INPUT_GET, 'tname'); + $trackers = filter_input(INPUT_GET, 'trackers'); + $webseeds = filter_input(INPUT_GET, 'webseeds'); + + if(strlen($infohash) == 0) + { + $error_code = 1; + } + else if(strlen($infohash) == 40 && ctype_xdigit($infohash)) { - $url = "http://torrage.com/torrent/" . $infohash . ".torrent"; - header('Location: ' . $url); //Internet + $magnetlink = "magnet:?xt=urn:btih:" . $infohash; + + if($name != "") + { + $magnetlink = $magnetlink . "&dn=" . $name; + } + if($trackers != "") + { + $trackers = str_replace("\r","&tr=",$trackers); + $trackers = str_replace(" ","&tr=",$trackers); + $magnetlink = $magnetlink . "&tr=" . $trackers; + } + if ($webseeds != "") + { + $magnetlink = $magnetlink . "&ws=" . $webseeds; + } } - else if($site == 'torcache') - { - $url = "http://torcache.net/torrent/" . $infohash . ".torrent"; - header('Location: ' . $url); //Internet - } - else if($site == 'istoretor') - { - $url = "http://istoretor.com/fdown.php?hash=" . $infohash . ".torrent"; - header('Location: ' . $url); //Internet - } - else - { - $url = "http://zoink.it/torrent/" . $infohash . ".torrent"; - header('Location: ' . $url); //Internet - } - } - else - { - echo "Invalid INFO_HASH"; - } + else + { + $error_code = 2; + } + //$magnetlink = "magnet:?xt=urn:btih:" .$infohash . "&dn=" . $name . "&tr=" . $trackers; } ?>
-