Bravo List
Register
Go Back   > Bravo List > Source Code > Archived Trackers > Template Shares > Mods & Themes
Reply
Thread Tools
  #1  
Old 24th March 2009, 10:04
Satanaz Satanaz is offline
Member
 
Join Date: Sep 2008
Posts: 8
Default [TSSE 3.1] TorrentHash Fix
Hi, this its a simple mod to fix the torrent hash of your torrent in the DB,

when i change my tracker of server, several torrents give this error "Failure reason "torrent not registered with this tracker", and was looking for a solution and i found the fix, but isnt compatible with the tsse 3.1, after changing a little the source code, work fine and without problems in my source,

i want to share the source code, if you have this problem someday:

PHP Code:
<?php
$rootpath 
"./../";
include(
$rootpath 'include/bittorrent.php');
include(
$rootpath 'include/benc.php');

function 
duplicate($id$hash) {
  
$q "SELECT id, name FROM torrents WHERE info_hash = {$hash} OR id = $id";
  
$res=mysql_query($q);
  echo 
"Duplicate torrent:<br/>";
  while (
$row mysql_fetch_assoc($res)) {
    echo 
$row['id'] . ": " $row['name'] . '<br/>';
  }
  echo 
"End duplicate torrentdump<br/><hr/>";
}

dbconn();
loggedinorreturn();
if (
get_user_class() < UC_ADMINISTRATORstderr("wegwezen""Neen, dit is werkelijk waar uw recht niet om te doen");

$torrents "SELECT id FROM torrents WHERE seeders='0' ORDER BY id ";
$res mysql_query($torrents);
$errors "";
while (
$row mysql_fetch_assoc($res)) {
  
$dict bdec_file($rootpath '/' $torrent_dir '/' $row['id'] . '.torrent'1024*1024);
  if (!isset(
$dict)) {
    
$errors $row['id'] . ": file not found<br/>";
    continue;
  }
//  echo "<pre>", print_r($dict), "</pre><br/>";
  
$dict $dict['value']; // easy :P
  
if (!isset($dict['info']['string']) || empty($dict['info']['string'])) {
    
$errors .= $row['id'] . ": update failed (can't read array)<br/>";
    echo 
"<pre>"print_r($dict), "</pre>";
    continue;
  }
  
$info_hash pack("H*"sha1($dict['info']['string']));
  
$info_hash sqlesc($info_hash);
  
$query "UPDATE torrents SET info_hash = {$info_hash} WHERE id = {$row['id']} LIMIT 1";
  if (!
mysql_query($query)) {
    
$errors .= $row['id'] . ": update failed (" htmlspecialchars($query) . ", " mysql_error() . ")<br/>";
    
duplicate($row['id'], $info_hash);
  }
}
if (empty(
$errors)) {
  echo 
"Geen errors :D";
}
echo 
$errors;
?>
All the credits of this script are of Shadowman of Tbdev.

Sorry my bad english.

Regards
SatanaZ
Reply With Quote
Reply

Tags
31 , fix , torrenthash , tsse


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT +2. The time now is 07:22. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.