<?
ob_start("ob_gzhandler");
require_once("include/bittorrent.php");
require_once("include/benc.php");
hit_start();
function err()
{
benc_resp(array("failure reason" => array(type => "string", value => )));
hit_end();
exit();
}
function benc_resp()
{
benc_resp_raw(benc(array(type => "dictionary", value => )));
}
function benc_resp_raw()
{
header("Content-Type: text/plain");
header("Pragma: no-cache");
print();
}
= "info_hash:peer_id:!ip:port:uploaded:downloaded:le ft:!event";
foreach (explode(":", ) as )
{
if ( == "!")
{
= substr(, 1);
= 1;
}
else
= 0;
if (!isset())
{
if (!)
err("missing key");
continue;
}
= unesc();
}
Bookmarks