QUOTE (TorrentialStorm @ Aug 28 2008, 09:48 AM)
This should be able to do it:
<?
set_time_limit(0);
require("backend/functions.php");
dbconn(false);
require_once("backend/benc.php");
require_once("backend/parse.php");
$torrent_dir = $site_config['torrent_dir'];
$res = mysql_query("SELECT id FROM torrents WHERE external = 'no'");
while ($row=mysql_fetch_assoc($res)) {
$id = $row["id"];
$dict = bdec_file("$torrent_dir/$id.torrent", filesize("$torrent_dir/$id.torrent"));
$dict["value"]["info"]["value"]["private"]["type"] = "integer";
$dict["value"]["info"]["value"]["private"]["value"] = 1;
$fs = fopen("$torrent_dir/$id.torrent", "w");
fwrite($fs, benc($dict));
fclose($fs);
$TorrentInfo = array();
$TorrentInfo = ParseTorrent("$torrent_dir/$id.torrent");
$infohash = $TorrentInfo[1];
mysql_query("UPDATE torrents SET info_hash='$infohash' WHERE id=$id");
}
?>
Where to put this ??