X-Git-Url: https://472bisson.ca/gitweb/magnet.git/blobdiff_plain/f72c8eb6379cc7fad9cf8b4f49920a5004d3f52d..c0adce5f9b064b542725bc661737678311bd7479:/index.php diff --git a/index.php b/index.php index bda4744..6f9e740 100644 --- a/index.php +++ b/index.php @@ -4,20 +4,35 @@ if(filter_has_var(INPUT_GET, 'submit')) $infohash = filter_input(INPUT_GET, 'infohash'); $name = filter_input(INPUT_GET, 'tname'); $trackers = filter_input(INPUT_GET, 'trackers'); - - if(strlen($infohash) == 40 && ctype_xdigit($infohash)) - { - $magnetlink = "magnet:?xt=urn:btih:" . $infohash; - - if($name != "") - { - $magnetlink = $magnetlink . "&dn=" . $name; - } - if($trackers != "") + $webseeds = filter_input(INPUT_GET, 'webseeds'); + + if(strlen($infohash) == 0) + { + $error_code = 1; + } + else if(strlen($infohash) == 40 && ctype_xdigit($infohash)) { - $magnetlink = $magnetlink . "&tr=" . $trackers; + $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 + { + $error_code = 2; + } //$magnetlink = "magnet:?xt=urn:btih:" .$infohash . "&dn=" . $name . "&tr=" . $trackers; } ?> @@ -27,47 +42,84 @@ if(filter_has_var(INPUT_GET, 'submit'))