]> 472bisson.ca Git - magnet.git/blob - index.php
Magnet Only
[magnet.git] / index.php
1 <?php
2 if(filter_has_var(INPUT_GET, 'submit'))
3 {
4 $infohash = filter_input(INPUT_GET, 'infohash');
5 $name = filter_input(INPUT_GET, 'tname');
6 $trackers = filter_input(INPUT_GET, 'trackers');
7
8 if(strlen($infohash) == 40 && ctype_xdigit($infohash))
9 {
10 $magnetlink = "magnet:?xt=urn:btih:" . $infohash;
11
12 if($name != "")
13 {
14 $magnetlink = $magnetlink . "&dn=" . $name;
15 }
16 if($trackers != "")
17 {
18 $magnetlink = $magnetlink . "&tr=" . $trackers;
19 }
20 }
21 //$magnetlink = "magnet:?xt=urn:btih:" .$infohash . "&dn=" . $name . "&tr=" . $trackers;
22 }
23 ?>
24 <!DOCTYPE html>
25 <html lang="en">
26 <head>
27 <title>Magnet</title>
28 <meta charset="utf-8" />
29 <meta name="viewport" content="width=device-width, initial-scale=1">
30 <link rel="stylesheet" type="text/css" href="https://www.w3schools.com/w3css/4/w3.css">
31 </head>
32 <body>
33 <div class="w3-card-4">
34 <div class="w3-container w3-green">
35 <h2>Magnet Info</h2>
36 </div>
37 <form class="w3-container" name="form1" method="get" action="#">
38 <p>
39 <label>Infohash</label>
40 <input class="w3-input" type="text" name="infohash" placeholder="Hash of the Torrent" />
41 </p>
42 <p>
43 <label>Name</label>
44 <input class="w3-input" type="text" name="tname" placeholder="Name of the Torrent" />
45 </p>
46 <p>
47 <label>Trackers</label>
48 <input class="w3-input" type="text" name="trackers" placeholder="Trackers" />
49 </p>
50 <p>
51 <input class="w3-button w3-green" type="submit" name="submit" value="Create"/>
52 <input class="w3-button w3-green" type="reset" name="reset" value="Reset">
53 </p>
54 </form>
55 </div>
56 <?php if(isset($magnetlink))
57 {
58 ?>
59 <div class="w3-panel w3-pale-green w3-leftbar w3-border-green">
60 <p><a href = "<?php echo $magnetlink; ?>"><?php echo $magnetlink; ?></a></p>
61 </div>
62 <?php
63 }
64 else {
65 ?>
66 <div class="w3-panel w3-pale-green w3-leftbar w3-border-green">
67 <p>Enter Some Torrent Info Hash</p>
68 </div>
69 <?php
70 }
71 ?>
72 </body>
73 </html>