]> 472bisson.ca Git - magnet.git/blobdiff - index.php
Validated InfoHash and Style.
[magnet.git] / index.php
index e7c059122330065a184ce169b5ddf21f0a3b8aa4..c32640f097a42a3fb9e4a28cf4821eb5bc5f2e0e 100644 (file)
--- a/index.php
+++ b/index.php
@@ -2,44 +2,41 @@
 <html>
 
        <head>
-               <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
                <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" width="600" name="infohash"/>
-                       
-                       
+                       <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 /> ";
-                       
-                       $url = "http://torrage.com/torrent/".$infohash.".torrent";
-                       
-                       echo $url;
-                                               
-                       header( 'Location: '.$url ) ;  //Internet   
-
+                       //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>
+</html>                                                                                                           
\ No newline at end of file