<?php .......... $torrent = new Torrent($_FILES['file']['tmp_name']); if ($hash = $torrent->hash_info()) { move_uploaded_file($_FILES['file']['tmp_name'], "torrent/new/" . microtime(true) . rand(1000, 9999) . ".torrent"); mysql_query("INSERT INTO video SET `show` = '" . mysql_real_escape_string($show) . "', hash = '" . mysql_real_escape_string($hash) . "'}'"); $error = " "; } else { $error = " torrent-"; } .......... ?>
<?php ...... $xrc = XML_RPC2_Client::create("http://127.0.0.1/RPC2", array("encoding" => "utf-8")); .....
..... foreach ($xrc->download_list("complete") as $hash) { $episode = mysql_fetch_assoc(mysql_query("SELECT * FROM video WHERE hash = '" . mysql_real_escape_string($hash) . "'")); if (!$episode) { // continue; } $base_path = $xrc->{"d.get_base_path"}($hash); if (is_file($base_path)) { // , mysql_query("UPDATE video SET filename = '" . mysql_real_escape_string($base_path) . "', hash = '' WHERE hash = '" . mysql_real_escape_string($hash) . "'"); $xrc->{"d.erase"}($hash); } else { printf("$base_path does not exist!\n"); } } ?>
Source: https://habr.com/ru/post/147015/
All Articles