]> 472bisson.ca Git - magnet.git/blobdiff - index.php
Added http://torcache.net
[magnet.git] / index.php
index c32640f097a42a3fb9e4a28cf4821eb5bc5f2e0e..090c191f4f2aaebc43fd1e30119e659b6b7b55ee 100644 (file)
--- a/index.php
+++ b/index.php
@@ -1,42 +1,49 @@
-<!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>
-
+<!DOCTYPE html>\r
+<html>\r
+    <head>\r
+        <title>Torrage</title>\r
+        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">\r
+        <link href="style.css" rel="stylesheet" type="text/css" />\r
+    </head>\r
+    <body>\r
+        <h1>Torrage</h1>\r
+        <form action="index.php" method="get">\r
+            <input type="text" name="infohash"/>\r
+            <input type="submit" value="Get .torrent"/>\r
+            <br />\r
+            <input type="radio" name="site" value="torrage" checked/>\r
+            <span>Torrage</span>\r
+            <input type="radio" name="site" value="torcache"/>\r
+            <span>Torcache</span>\r
+        </form>                \r
+        <?php\r
+        //http://torrage.com/torrent/640FE84C613C17F663551D218689A64E8AEBEABE.torrent\r
+        //http://torcache.net/torrent/640FE84C613C17F663551D218689A64E8AEBEABE.torrent\r
+\r
+        if (filter_has_var(INPUT_GET, 'infohash') && filter_has_var(INPUT_GET, 'site'))\r
+        {\r
+            $infohash = filter_input(INPUT_GET, 'infohash');\r
+            $site = filter_input(INPUT_GET, 'site');\r
+            if (strlen($infohash) == 40 && ctype_xdigit($infohash))\r
+            {\r
+                $infohash = strtoupper($infohash);\r
+                //echo "Debug:$url = ".$url."<br />";\r
+                if ($site == 'torrage')\r
+                {\r
+                    $url = "http://torrage.com/torrent/" . $infohash . ".torrent";\r
+                    header('Location: ' . $url);  //Internet \r
+                }\r
+                else\r
+                {\r
+                    $url = "http://torcache.net/torrent/" . $infohash . ".torrent";\r
+                    header('Location: ' . $url);  //Internet \r
+                }\r
+            }\r
+            else\r
+            {\r
+                echo "<a>Invalid INFO_HASH</a>";\r
+            }\r
+        }\r
+        ?>\r
+    </body>\r
 </html>                                                                                                           
\ No newline at end of file