8 $trackers = str_replace("&tr="," ",$trackers);
10 if(filter_has_var(INPUT_GET
, 'submit'))
12 $infohash = filter_input(INPUT_GET
, 'infohash');
13 $tor_name = filter_input(INPUT_GET
, 'tname');
14 $trackers = filter_input(INPUT_GET
, 'trackers');
15 $webseeds = filter_input(INPUT_GET
, 'webseeds');
17 $infohash = strtoupper($infohash);
19 if(strlen($infohash) == 0)
23 else if(strlen($infohash) == 40 && ctype_xdigit($infohash))
25 $magnetlink = "magnet:?xt=urn:btih:" . $infohash;
29 $magnetlink = $magnetlink . "&dn=" . $tor_name;
33 $trackers = str_replace("\r","&tr=",$trackers);
34 $trackers = str_replace(" ","&tr=",$trackers);
35 $magnetlink = $magnetlink . "&tr=" . $trackers;
39 $magnetlink = $magnetlink . "&ws=" . $webseeds;
46 //$magnetlink = "magnet:?xt=urn:btih:" .$infohash . "&dn=" . $tor_name . "&tr=" . $trackers;
53 <meta charset
="utf-8" />
54 <meta name
="viewport" content
="width=device-width, initial-scale=1">
56 <link rel
="icon" type
="image/png" sizes
="32x32" href
="magnet.png">
58 <link rel
="stylesheet" type
="text/css" href
="https://www.w3schools.com/w3css/4/w3.css">
59 <link rel
="stylesheet" type
="text/css" href
="https://www.w3schools.com/lib/w3-theme-red.css">
60 <link rel
="stylesheet" type
="text/css" href
="style.css">
63 <section
class="w3-panel">
64 <div
class="w3-card-4">
65 <div
class="w3-container w3-theme">
68 <form
class="w3-container" name
="magnet" method
="get" action
="#">
70 <label
>Infohash
</label
>
71 <input
class="w3-input" type
="text" name
="infohash" value
='<?php echo $infohash ?>' placeholder
="Hash of the Torrent Ex: DA39A3EE5E6B4B0D3255BFEF95601890AFD80709" />
75 <input
class="w3-input" type
="text" name
="tname" value
='<?php echo $tor_name ?>' placeholder
="Name of the Torrent Ex:Linux 5.7" />
78 <label
>Trackers
</label
>
79 <textarea
class="w3-input" name
="trackers" placeholder
="One tracker per line Ex: udp://tracker.opentrackr.org:1337/announce"><?php
echo $trackers ?
></textarea
>
82 <label
>Webseeds
</label
>
83 <input
class="w3-input" type
="text" name
="webseeds" value
='<?php echo $webseeds ?>' placeholder
="Web Seeds Ex: http://example.com/linux.iso" />
86 <input
class="w3-button w3-theme-l3" type
="submit" name
="submit" value
="Create"/>
87 <input
class="w3-button w3-theme-l3" type
="reset" name
="reset" value
="Reset">
92 if(isset($error_code))
97 <div
class="w3-panel w3-pale-red w3-leftbar w3-border-red">
98 <p
>Error
: Infohash cannot be
empty.</p
>
102 else if($error_code == 2)
105 <div
class="w3-panel w3-pale-red w3-leftbar w3-border-red">
106 <p
>Error
: Invalid Infohash
.</p
>
111 else if(isset($magnetlink))
114 <div id
="magnet" class="w3-panel w3-pale-green w3-leftbar w3-border-green">
115 <p
><a href
= "<?php echo $magnetlink; ?>"><?php
echo $magnetlink; ?
></a
></p
>
122 <div
class="w3-panel w3-pale-blue w3-leftbar w3-border-blue">
123 <p
>Enter Some Torrent Info Hash
</p
>
129 <footer
class="w3-panel">
130 <a href
="https://www.w3schools.com/w3css/" target
="_blank" >W3
.css
</a
>
131 <a href
="https://github.com/cvmanjoo/magnet/" target
="_blank" >Github
</a
>