Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- header('Content-type: text/plain');
- $info_hash = $_GET['info_hash'];
- $peer_id = $_GET['peer_id'];
- $ip = $_SERVER['REMOTE_ADDR'];
- $port = intval($_GET['port']);
- $uploader = ($_GET['left'] == 0) ? 1 : 0;
- $event = in_array($_GET['event'], array('started', 'completed', 'stopped')) ? $_GET['event'] : 'empty';
- mysql_connect('localhost', 'root', '');
- mysql_select_db('tracker');
- switch ($event) {
- case 'started': mysql_query("INSERT INTO peers (info_hash, peer_id, uploader, ip, port) VALUES ('$info_hash', '$peer_id', $uploader, '$ip', $port);"); break;
- case 'completed': mysql_query("UPDATE peers SET uploader = 1 WHERE info_hash = '$info_hash' AND peer_id = '$peer_id';"); break;
- case 'stopped': mysql_query("DELETE FROM peers WHERE info_hash = '$info_hash' AND peer_id = '$peer_id';"); die();
- }
- echo 'd8:intervali1800e5:peersl';
- $res = mysql_query("SELECT peer_id, ip, port FROM peers WHERE info_hash = '$info_hash' AND peer_id != '$peer_id'" . ($uploader ? " AND uploader = 0" : "") . " ORDER BY RAND() LIMIT 25;");
- if (!mysql_num_rows($res)) die('ee');
- while ($row = mysql_fetch_assoc($res))
- echo 'd7:peer id' . strlen($row['peer_id']) . ':' . $row['peer_id'] . '2:ip' . strlen($row['ip']) . ':' . $row['ip'] . '4:porti' . $row['port'] . 'ee';
- die('ee');
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement