]> 472bisson.ca Git - magnet.git/blob - index.php
3d30be87422fbe21f29de22da2ebe29b0f241b30
[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 <input type="radio" name="site" value="zoink"/>
19 <span>Zoink</span>
20 </form>
21 <?php
22 //http://torrage.com/torrent/640FE84C613C17F663551D218689A64E8AEBEABE.torrent
23 //http://torcache.net/torrent/640FE84C613C17F663551D218689A64E8AEBEABE.torrent
24 //http://zoink.it/torrent/640FE84C613C17F663551D218689A64E8AEBEABE.torrent
25
26 if (filter_has_var(INPUT_GET, 'infohash') && filter_has_var(INPUT_GET, 'site'))
27 {
28 $infohash = filter_input(INPUT_GET, 'infohash');
29 $site = filter_input(INPUT_GET, 'site');
30 if (strlen($infohash) == 40 && ctype_xdigit($infohash))
31 {
32 $infohash = strtoupper($infohash);
33 //echo "Debug:$url = ".$url."<br />";
34 if ($site == 'torrage')
35 {
36 $url = "http://torrage.com/torrent/" . $infohash . ".torrent";
37 header('Location: ' . $url); //Internet
38 }
39 else if ($site == 'torcache')
40 {
41 $url = "http://torcache.net/torrent/" . $infohash . ".torrent";
42 header('Location: ' . $url); //Internet
43 }
44 else
45 {
46 $url = "http://zoink.it/torrent/" . $infohash . ".torrent";
47 header('Location: ' . $url); //Internet
48 }
49 }
50 else
51 {
52 echo "<a>Invalid INFO_HASH</a>";
53 }
54 }
55 ?>
56 </body>
57 </html>