09 Reseed Mod

Started by Mindless, July 21, 2012, 07:56:54 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Mindless

Credits to putyn - think its fine requires snatchlist.

Code (sql) Select
ALTER TABLE torrents ADD `last_reseed` int(11) NOT NULL default '0';

next go to details and add in the big query

Code (php) Select
torrents.last_reseed,

after this or similiar line :

Code (php) Select
elseif (isset($_GET['thanks']))
$HTMLOUT .= "<h2>{$lang['details_thanks_added']}</h2>\n";


add after

Code (php) Select
elseif (isset($_GET["reseed"]))
$HTMLOUT.="<h2>PM was sent! Now wait for a seeder !</h2>\n";


add where you want to display it :

Code (php) Select
$next_reseed = 0;
  if ($row["last_reseed"] > 0)
  $next_reseed = ($row["last_reseed"] + 172800 ); //add 2 days
  $reseed = "<form method=\"post\" action=\"./takereseed.php\">
  <select name=\"pm_what\">
  <option value=\"last10\">last10</option>
  <option value=\"owner\">uploader</option>
  </select>
  <input type=\"submit\"  ".(($next_reseed > time()) ? "disabled" : "" )." value=\"SendPM\" />
  <input type=\"hidden\" name=\"uploader\" value=\"" . $row["owner"] . "\" />
  <input type=\"hidden\" name=\"reseedid\" value=\"$id\" />
  </form>";
  $HTMLOUT .= tr("Request reseed", $reseed,1);



save and upload : takereseed.php

Code (php) Select
<?php
//made by putyn @tbdev.net
require_once("include/bittorrent.php");
dbconn();
loggedinorreturn();
global 
$TBDEV;
$pm_what = isset($_POST["pm_what"]) && $_POST["pm_what"] =="last10" "last10" "owner";
$reseedid $_POST["reseedid"];
$uploader $_POST["uploader"];
$use_subject true//set it to false if you dont use subject in pms
$subject "Request reseed!";
$pm_msg "User " $CURUSER["username"] . " asked for a reseed on torrent ".$TBDEV['baseurl']."/details.php?id=" $reseedid " !\nThank You!";

$pms = array();
if (
$pm_what == "last10" ) {
$res mysql_query("SELECT snatched.userid, snatched.torrentid FROM snatched where snatched.torrentid =$reseedid AND snatched.seeder='yes' LIMIT 10") or sqlerr(__FILE____LINE__);
while($row mysql_fetch_assoc($res))
$pms[] = "(0,".$row["userid"].",".sqlesc(time()).",".sqlesc($pm_msg).($use_subject ",".sqlesc($subject) : "").")";
}
elseif(
$pm_what == "owner")
$pms[] = "(0,$uploader,".sqlesc(time()).",".sqlesc($pm_msg).($use_subject ",".sqlesc($subject) : "").")";

if(
count($pms) > 0)
mysql_query("INSERT INTO messages (sender, receiver, added, msg ".($use_subject ", subject" "")." ) VALUES ".join(",",$pms)) or sqlerr(__FILE____LINE__);

mysql_query("UPDATE torrents set last_reseed=".sqlesc(time())." WHERE id= $reseedid ") or sqlerr(__FILE____LINE__);
header("Refresh: 0; url=./details.php?id=$reseedid&reseed=1");
?>