]> 472bisson.ca Git - magnet.git/blobdiff - index.php
Test commit from NetBeans.
[magnet.git] / index.php
index af112141bb35cfce07de49f9079f0c5408e90291..3ac54f4a4b68717411b279f604ee94c4ca8fa3bb 100644 (file)
--- a/index.php
+++ b/index.php
@@ -1,39 +1,38 @@
-<!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" />
-               <link href='http://fonts.googleapis.com/css?family=Voces' rel='stylesheet' type='text/css'>
-
-       </head>
-       
-       <body>
-               <h1>Torrage</h1>
-               <form action="index.php" method="get">
-                       <input type="text" width="600" 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 /> ";
-                       
-                       $url = "http://torrage.com/torrent/".$infohash.".torrent";
-                       
-                       echo $url;
-                                               
-                       header( 'Location: '.$url ) ;  //Internet 
-               }
-               ?>
-
-</html>
+<!DOCTYPE html>\r
+<html>\r
+\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
+       \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
+               </form>\r
+               \r
+               <?php \r
+               \r
+               //http://torrage.com/torrent/640FE84C613C17F663551D218689A64E8AEBEABE.torrent\r
+               if(isset($_GET["infohash"]))\r
+               {\r
+                       $infohash = $_GET['infohash'];\r
+                       //echo "Debug:IF -- ".$_GET["infohash"]."<br /> ";\r
+                       if(strlen($infohash) == 40 && ctype_xdigit($infohash))\r
+                       {\r
+                               //echo "Debug:$url = ".$url."<br />";\r
+                               $url = "http://torrage.com/torrent/".$infohash.".torrent";\r
+                               header( 'Location: '.$url ) ;  //Internet \r
+                       }\r
+                       else\r
+                       {\r
+                               echo "<a>Invalid INFO_HASH</a>";        \r
+                       }\r
+               }\r
+               ?>\r
+       </body>\r
+\r
+</html>                                                                                                           
\ No newline at end of file