]> 472bisson.ca Git - magnet.git/blobdiff - index.php
A Complete Refresh.
[magnet.git] / index.php
index c32640f097a42a3fb9e4a28cf4821eb5bc5f2e0e..bda47446b534b861d9dc2a9f2f7ce5443b4ec225 100644 (file)
--- a/index.php
+++ b/index.php
@@ -1,42 +1,73 @@
-<!DOCTYPE html>
-<html>
-
-       <head>
-               <title>Torrage</title>
-               
-               <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
-               
-               <link href="style.css" rel="stylesheet" type="text/css" />
-
-       </head>
-       
-       <body>
-               <h1>Torrage</h1>
-               <form action="index.php" method="get">
-                       <input type="text" name="infohash"/>
-                       <input type="submit" value="Get .torrent"/>
-               </form>
-               
-               <?php 
-               
-               //http://torrage.com/torrent/640FE84C613C17F663551D218689A64E8AEBEABE.torrent
-               if(isset($_GET["infohash"]))
-               {
-                       $infohash = $_GET['infohash'];
-                       //echo "Debug:IF -- ".$_GET["infohash"]."<br /> ";
-                       if(strlen($infohash) == 40 && ctype_xdigit($infohash))
-                       {
-                               //echo "Debug:$url = ".$url."<br />";
-                               $url = "http://torrage.com/torrent/".$infohash.".torrent";
-                               header( 'Location: '.$url ) ;  //Internet 
-                       }
-                       else
-                       {
-                               echo "<a>Invalid INFO_HASH</a>";        
-                       }
-               }
-               ?>
-               <label></label>
-       </body>
-
-</html>                                                                                                           
\ No newline at end of file
+<?php\r
+if(filter_has_var(INPUT_GET, 'submit'))\r
+{\r
+    $infohash = filter_input(INPUT_GET, 'infohash');\r
+    $name = filter_input(INPUT_GET, 'tname');\r
+    $trackers = filter_input(INPUT_GET, 'trackers');\r
+\r
+    if(strlen($infohash) == 40 && ctype_xdigit($infohash))\r
+    {\r
+        $magnetlink = "magnet:?xt=urn:btih:" . $infohash;\r
+\r
+        if($name != "")\r
+        {\r
+            $magnetlink = $magnetlink . "&dn=" . $name;\r
+        }\r
+        if($trackers != "")\r
+        {\r
+            $magnetlink = $magnetlink . "&tr=" . $trackers;\r
+        }\r
+    }\r
+    //$magnetlink = "magnet:?xt=urn:btih:" .$infohash . "&dn=" . $name . "&tr=" . $trackers;\r
+}\r
+?>\r
+<!DOCTYPE html>\r
+<html lang="en">\r
+    <head>\r
+        <title>Magnet</title>\r
+        <meta charset="utf-8" />\r
+        <meta name="viewport" content="width=device-width, initial-scale=1">\r
+        <link rel="stylesheet" type="text/css" href="https://www.w3schools.com/w3css/4/w3.css">\r
+    </head>\r
+    <body>\r
+      <div class="w3-card-4">\r
+        <div class="w3-container w3-green">\r
+          <h2>Magnet Info</h2>\r
+        </div>\r
+        <form class="w3-container" name="form1" method="get" action="#">\r
+          <p>\r
+            <label>Infohash</label>\r
+            <input class="w3-input" type="text" name="infohash" placeholder="Hash of the Torrent" />\r
+          </p>\r
+          <p>\r
+            <label>Name</label>\r
+            <input class="w3-input" type="text" name="tname" placeholder="Name of the Torrent" />\r
+          </p>\r
+          <p>\r
+            <label>Trackers</label>\r
+            <input class="w3-input" type="text" name="trackers" placeholder="Trackers" />\r
+          </p>\r
+          <p>\r
+            <input class="w3-button w3-green" type="submit" name="submit" value="Create"/>\r
+            <input class="w3-button w3-green" type="reset" name="reset" value="Reset">\r
+          </p>\r
+        </form>\r
+    </div>\r
+    <?php if(isset($magnetlink))\r
+    {\r
+      ?>\r
+      <div class="w3-panel w3-pale-green w3-leftbar w3-border-green">\r
+          <p><a href = "<?php echo $magnetlink; ?>"><?php echo $magnetlink; ?></a></p>\r
+      </div>\r
+      <?php\r
+    }\r
+    else {\r
+      ?>\r
+      <div class="w3-panel w3-pale-green w3-leftbar w3-border-green">\r
+          <p>Enter Some Torrent Info Hash</p>\r
+      </div>\r
+      <?php\r
+    }\r
+    ?>\r
+  </body>\r
+</html>
\ No newline at end of file