]> 472bisson.ca Git - magnet.git/blob - index.php
Added http://torcache.net
[magnet.git] / index.php
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>Torrage</title>
5 <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
6 <link href="style.css" rel="stylesheet" type="text/css" />
7 </head>
8 <body>
9 <h1>Torrage</h1>
10 <form action="index.php" method="get">
11 <input type="text" name="infohash"/>
12 <input type="submit" value="Get .torrent"/>
13 <br />
14 <input type="radio" name="site" value="torrage" checked/>
15 <span>Torrage</span>
16 <input type="radio" name="site" value="torcache"/>
17 <span>Torcache</span>
18 </form>
19 <?php
20 //http://torrage.com/torrent/640FE84C613C17F663551D218689A64E8AEBEABE.torrent
21 //http://torcache.net/torrent/640FE84C613C17F663551D218689A64E8AEBEABE.torrent
22
23 if (filter_has_var(INPUT_GET, 'infohash') && filter_has_var(INPUT_GET, 'site'))
24 {
25 $infohash = filter_input(INPUT_GET, 'infohash');
26 $site = filter_input(INPUT_GET, 'site');
27 if (strlen($infohash) == 40 && ctype_xdigit($infohash))
28 {
29 $infohash = strtoupper($infohash);
30 //echo "Debug:$url = ".$url."<br />";
31 if ($site == 'torrage')
32 {
33 $url = "http://torrage.com/torrent/" . $infohash . ".torrent";
34 header('Location: ' . $url); //Internet
35 }
36 else
37 {
38 $url = "http://torcache.net/torrent/" . $infohash . ".torrent";
39 header('Location: ' . $url); //Internet
40 }
41 }
42 else
43 {
44 echo "<a>Invalid INFO_HASH</a>";
45 }
46 }
47 ?>
48 </body>
49 </html>