Bravo List
Register
Go Back   > Bravo List > Source Code > Archived Trackers > Torrent Strike
Reply
  #1  
Old 24th September 2008, 12:09
sharpe's Avatar
sharpe sharpe is offline
Senior Member
 
Join Date: Sep 2008
Posts: 52
Exclamation URGENT !! Parse error: syntax error
I get this error: Parse error: syntax error: Parse error: syntax error, unexpected $end in /users/*****/www/takeupload.php on line 338

PHP Code:
<?
/*
// +--------------------------------------------------------------------------+
// | TorrentStrike X-Edition by Neptune                                       |
// +--------------------------------------------------------------------------+
// | This file is part of TorrentStrike X-Edtion. Is based on TBDev,          |
// | originally by RedBeard of TorrentBits, extensively modified by           |
// | Gartenzwerg.                                                             |
// |                                                                          |
// | TorrentStrike is free software; you can redistribute it and/or modify    |
// | it under the terms of the GNU General Public License as published by     |
// | the Free Software Foundation; either version 2 of the License, or        |
// | (at your option) any later version.                                      |
// |                                                                          |
// | TorrentStrike is distributed in the hope that it will be useful,         |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of           |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            |
// | GNU General Public License for more details.                             |
// |                                                                          |
// | You should have received a copy of the GNU General Public License        |
// | along with TorrentStrike; if not, write to the Free Software Foundation, |
// | Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA            |
// +--------------------------------------------------------------------------+
// |                                       TorrentStrike X-Edition by Neptune |
// +--------------------------------------------------------------------------+
*/
require_once("include/benc.php");
require_once(
"include/bittorrent.php");

ini_set("upload_max_filesize",$max_torrent_size);

function 
bark($msg) {
    
genbark($msg"Upload failed!");
}

 

loggedinorreturn();

if (
$CURUSER["uploadpos"] == 'no')
die;  

foreach(
explode(":","descr:type:name") as $v) {
    if (!isset(
$_POST[$v]))
        
bark("missing form data");
}
if (!empty(
$_POST['poster']))
$poster unesc($_POST['poster']);

if (!isset(
$_FILES["file"]))
    
bark("missing form data");

$f $_FILES["file"];
$fname unesc($f["name"]);
if (empty(
$fname))
    
bark("Empty filename!");
    
$nfofile $_FILES['nfo'];
if (
$nfofile['name'] != '')
{
    if (
$nfofile['size'] == 0)
      
bark("0-byte NFO");

    if (
$nfofile['size'] > 65535)
      
bark("NFO is too big! Max 65,535 bytes.");

    
$nfofilename $nfofile['tmp_name'];

    if (@!
is_uploaded_file($nfofilename))
      
bark("NFO upload failed");
}      

// Handle picture uploads
$picnum 0;
if (
$_FILES["pic1"]["name"] != "") {
    
tr_msg("Vorschaubild ".($picnum+1)." verkleinern und ablegen");
    if (
torrent_image_upload($_FILES["pic1"], $id$picnum+1))
        
$picnum++;


if (
$_FILES["pic2"]["name"] != "") {    
    
tr_msg("Vorschaubild ".($picnum+1)." verkleinern und ablegen");
    if (
torrent_image_upload($_FILES["pic2"], $id$picnum+1))

        
$picnum++;

$descr unesc($_POST["descr"]);
if (!
$descr)
  
bark("You must enter a description!");

$catid = ($_POST["type"]);
if (!
is_valid_id($catid))
    
bark("You must select a category to put the torrent in!");
    
if (!
validfilename($fname))
    
bark("Invalid filename!");
if (!
preg_match('/^(.+)\.torrent$/si'$fname$matches))
    
bark("Invalid filename (not a .torrent).");
$shortfname $torrent $matches[1];
if (!empty(
$_POST["name"]))
    
$torrent unesc($_POST["name"]);

$tmpname $f["tmp_name"];
if (!
is_uploaded_file($tmpname))
    
bark("eek");
if (!
filesize($tmpname))
    
bark("Empty file!");

$dict bdec_file($tmpname$max_torrent_size);
if (!isset(
$dict))
    
bark("What the hell did you upload? This is not a bencoded file!");

function 
dict_check($d$s) {
    if (
$d["type"] != "dictionary")
        
bark("not a dictionary");
    
$a explode(":"$s);
    
$dd $d["value"];
    
$ret = array();
    foreach (
$a as $k) {
        unset(
$t);
        if (
preg_match('/^(.*)\((.*)\)$/'$k$m)) {
            
$k $m[1];
            
$t $m[2];
        }
        if (!isset(
$dd[$k]))
            
bark("dictionary is missing key(s)");
        if (isset(
$t)) {
            if (
$dd[$k]["type"] != $t)
                
bark("invalid entry in dictionary");
            
$ret[] = $dd[$k]["value"];
        }
        else
            
$ret[] = $dd[$k];
    }
    return 
$ret;
}

function 
dict_get($d$k$t) {
    if (
$d["type"] != "dictionary")
        
bark("not a dictionary");
    
$dd $d["value"];
    if (!isset(
$dd[$k]))
        return;
    
$v $dd[$k];
    if (
$v["type"] != $t)
        
bark("invalid dictionary entry type");
    return 
$v["value"];
}

list(
$ann$info) = dict_check($dict"announce(string):info");
list(
$dname$plen$pieces) = dict_check($info"name(string):piece length(integer):pieces(string)");

if (!
in_array($ann$announce_urls1))
    
bark("invalid announce url! must be <b>" $announce_urls[0] . "</b>");

if (isset(
$dict['value']['announce-list']))
bark("Multi-tracker torrents are NOT allowed!");

if (
strlen($pieces) % 20 != 0)
    
bark("invalid pieces");

$filelist = array();
$totallen dict_get($info"length""integer");
if (isset(
$totallen)) {
    
$filelist[] = array($dname$totallen);
    
$type "single";
}
else {
    
$flist dict_get($info"files""list");
    if (!isset(
$flist))
        
bark("missing both length and files");
    if (!
count($flist))
        
bark("no files");
    
$totallen 0;
    foreach (
$flist as $fn) {
        list(
$ll$ff) = dict_check($fn"length(integer):path(list)");
        
$totallen += $ll;
        
$ffa = array();
        foreach (
$ff as $ffe) {
            if (
$ffe["type"] != "string")
                
bark("filename error");
            
$ffa[] = $ffe["value"];
        }
        if (!
count($ffa))
            
bark("filename error");
        
$ffe implode("/"$ffa);
        
$filelist[] = array($ffe$ll);
    }
    
$type "multi";
}

$infohash pack("H*"sha1($info["string"]));


// Replace punctuation characters with spaces

$torrent str_replace("_"" "$torrent);

$nfo sqlesc(str_replace("\x0d\x0d\x0a""\x0d\x0a", @file_get_contents($nfofilename)));
$smalldescr $_POST["description"];
$ret mysql_query("INSERT INTO torrents (search_text, filename, owner, visible, info_hash, name, size, numfiles, type, descr, ori_descr, description, category, save_as, added, last_action, nfo, poster) VALUES (" .
        
implode(","array_map("sqlesc", array(searchfield("$shortfname $dname $torrent"), $fname$CURUSER["id"], "no"$infohash$torrent$totallencount($filelist), $type$descr$descr$smalldescr$_POST["type"], $dname))) .
        
", '" get_date_time() . "', '" get_date_time() . "', $nfo, '".$poster."')");
if (!
$ret) {
    if (
mysql_errno() == 1062)
        
bark("torrent already uploaded!");
    
bark("mysql puked: ".mysql_error());
}
$id mysql_insert_id();

@
mysql_query("DELETE FROM files WHERE torrent = $id");
foreach (
$filelist as $file) {
    @
mysql_query("INSERT INTO files (torrent, filename, size) VALUES ($id, ".sqlesc($file[0]).",".$file[1].")");
}

move_uploaded_file($tmpname"$torrent_dir/$id.torrent");

if (
$CURUSER["advertisename"]=='yes'){
write_log("Torrent $id ($torrent) was uploaded by Anonymous");
}
else
{
write_log("Torrent $id ($torrent) was uploaded by $CURUSER[username]");
}
//===notify people who voted on offer thanks CoLdFuSiOn :)
if (isset($_POST['offer'])) {
$res mysql_query("SELECT `userid` FROM `offervotes` WHERE `userid` != " $CURUSER["id"] . " AND `offerid` = ". ($_POST['offer'] + 0)) or sqlerr(__FILE____LINE__);
$pn_msg "The Offer you voted for: \"$torrent\" was uploaded by " $CURUSER["username"] . ".\nYou can Download the Torrent [url=$DEFAULTBASEURL/details.php?id=$id&hit=1]here[/url]";
$some_variable '';
while(
$row mysql_fetch_assoc($res)) {
//=== use this if you DO have subject in your PMs
$some_variable .= "(0, 0, 'Offer $torrent was just uploaded', $row[userid], '" get_date_time() . "', " sqlesc($pn_msg) . ")";
//=== use this if you DO NOT have subject in your PMs
//$some_variable .= "(0, 0, $row[userid], '" . get_date_time() . "', " . sqlesc($pn_msg) . ")";
}
//=== use this if you DO have subject in your PMs
mysql_query("INSERT INTO messages (poster, sender, subject, receiver, added, msg) VALUES ".$some_variable."") or sqlerr(__FILE____LINE__);
//=== use this if you do NOT have subject in your PMs
//mysql_query("INSERT INTO messages (poster, sender, receiver, added, msg) VALUES ".$some_variable."") or sqlerr(__FILE__, __LINE__);
//===end

//=== delete all offer stuff
@mysql_query("DELETE FROM `offers` WHERE `id` = ". ($_POST['offer'] + 0));
@
mysql_query("DELETE FROM `offervotes` WHERE `offerid` = ". ($_POST['offer'] + 0));
@
mysql_query("DELETE FROM `comments` WHERE `offer` = ". ($_POST['offer'] + 0). "");
}
//=== end notify people who voted on offer

/* RSS feeds */

if (($fd1 = @fopen("rss.xml""w")) && ($fd2 fopen("rssdd.xml""w")))
{
    
$cats "";
    
$res mysql_query("SELECT id, name FROM categories");
    while (
$arr mysql_fetch_assoc($res))
        
$cats[$arr["id"]] = $arr["name"];
    
$s "<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>\n<rss version=\"0.91\">\n<channel>\n" .
        
"<title>TorrentBits</title>\n<description>0-week torrents</description>\n<link>$DEFAULTBASEURL/</link>\n";
    @
fwrite($fd1$s);
    @
fwrite($fd2$s);
    
$r mysql_query("SELECT id,name,descr,filename,category FROM torrents ORDER BY added DESC LIMIT 15") or sqlerr(__FILE____LINE__);
    while (
$a mysql_fetch_assoc($r))
    {
        
$cat $cats[$a["category"]];
        
$s "<item>\n<title>" htmlspecialchars($a["name"] . " ($cat)") . "</title>\n" .
            
"<description>" htmlspecialchars($a["descr"]) . "</description>\n";
        @
fwrite($fd1$s);
        @
fwrite($fd2$s);
        @
fwrite($fd1"<link>$DEFAULTBASEURL/details.php?id=$a[id]&amp;hit=1</link>\n</item>\n");
        
$filename htmlspecialchars($a["filename"]);
        @
fwrite($fd2"<link>$DEFAULTBASEURL/download.php/$a[id]/$filename</link>\n</item>\n");
    }
    
$s "</channel>\n</rss>\n";
    @
fwrite($fd1$s);
    @
fwrite($fd2$s);
    @
fclose($fd1);
    @
fclose($fd2);
}

/* Email notifs */
/*******************

$res = mysql_query("SELECT name FROM categories WHERE id=$catid") or sqlerr();
$arr = mysql_fetch_assoc($res);
$cat = $arr["name"];
$res = mysql_query("SELECT email FROM users WHERE enabled='yes' AND notifs LIKE '%[cat$catid]%'") or sqlerr();
$uploader = $CURUSER['username'];

$size = mksize($totallen);
$description = ($html ? strip_tags($descr) : $descr);

$body = <<<EOD
A new torrent has been uploaded.

Name: $torrent
Size: $size
Category: $cat
Uploaded by: $uploader

Description
-------------------------------------------------------------------------------
$description
-------------------------------------------------------------------------------

You can use the URL below to download the torrent (you may have to login).

$DEFAULTBASEURL/details.php?id=$id&hit=1

-- 
$SITENAME
EOD;
$to = "";
$nmax = 100; // Max recipients per message
$nthis = 0;
$ntotal = 0;
$total = mysql_num_rows($res);
while ($arr = mysql_fetch_row($res))
{
  if ($nthis == 0)
    $to = $arr[0];
  else
    $to .= "," . $arr[0];
  ++$nthis;
  ++$ntotal;
  if ($nthis == $nmax || $ntotal == $total)
  {
    if (!mail("Multiple recipients <$SITEEMAIL>", "New torrent - $torrent", $body,
    "From: $SITEEMAIL\r\nBcc: $to", "-f$SITEEMAIL"))
      stderr("Error", "Your torrent has been been uploaded. DO NOT RELOAD THE PAGE!\n" .
        "There was however a problem delivering the e-mail notifcations.\n" .
        "Please let an administrator know about this error!\n");
    $nthis = 0;
  }
}
*******************/

header("Location: $BASEURL/details.php?id=$id&uploaded=1");

?>
can some1 help me?
Attached Files
File Type: php takeupload.php (11.6 KB, 3 views)
Reply With Quote
  #2  
Old 24th September 2008, 12:27
seb35 seb35 is offline
Senior Member
 
Join Date: Dec 2007
France
Posts: 32
Default test
Code:
<?
/*
// +--------------------------------------------------------------------------+
// | TorrentStrike X-Edition by Neptune                                       |
// +--------------------------------------------------------------------------+
// | This file is part of TorrentStrike X-Edtion. Is based on TBDev,          |
// | originally by RedBeard of TorrentBits, extensively modified by           |
// | Gartenzwerg.                                                             |
// |                                                                          |
// | TorrentStrike is free software; you can redistribute it and/or modify    |
// | it under the terms of the GNU General Public License as published by     |
// | the Free Software Foundation; either version 2 of the License, or        |
// | (at your option) any later version.                                      |
// |                                                                          |
// | TorrentStrike is distributed in the hope that it will be useful,         |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of           |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            |
// | GNU General Public License for more details.                             |
// |                                                                          |
// | You should have received a copy of the GNU General Public License        |
// | along with TorrentStrike; if not, write to the Free Software Foundation, |
// | Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA            |
// +--------------------------------------------------------------------------+
// |                                       TorrentStrike X-Edition by Neptune |
// +--------------------------------------------------------------------------+
*/
require_once("include/benc.php");
require_once("include/bittorrent.php");

ini_set("upload_max_filesize",$max_torrent_size);

function bark($msg) {
    genbark($msg, "Upload failed!");
}

 

loggedinorreturn();

if ($CURUSER["uploadpos"] == 'no')
die;  

foreach(explode(":","descr:type:name") as $v) {
    if (!isset($_POST[$v]))
        bark("missing form data");
}
if (!empty($_POST['poster']))
$poster = unesc($_POST['poster']);

if (!isset($_FILES["file"]))
    bark("missing form data");

$f = $_FILES["file"];
$fname = unesc($f["name"]);
if (empty($fname))
    bark("Empty filename!");
    
$nfofile = $_FILES['nfo'];
if ($nfofile['name'] != '')
{
    if ($nfofile['size'] == 0)
      bark("0-byte NFO");

    if ($nfofile['size'] > 65535)
      bark("NFO is too big! Max 65,535 bytes.");

    $nfofilename = $nfofile['tmp_name'];

    if (@!is_uploaded_file($nfofilename))
      bark("NFO upload failed");
}      

// Handle picture uploads
$picnum = 0;
if ($_FILES["pic1"]["name"] != "") {
    tr_msg("Vorschaubild ".($picnum+1)." verkleinern und ablegen");
    if (torrent_image_upload($_FILES["pic1"], $id, $picnum+1))
        $picnum++;
} 

if ($_FILES["pic2"]["name"] != "") {    
    tr_msg("Vorschaubild ".($picnum+1)." verkleinern und ablegen");
    if (torrent_image_upload($_FILES["pic2"], $id, $picnum+1))

        $picnum++;

$descr = unesc($_POST["descr"]);
if (!$descr)
  bark("You must enter a description!");

$catid = (0 + $_POST["type"]);
if (!is_valid_id($catid))
    bark("You must select a category to put the torrent in!");
    
if (!validfilename($fname))
    bark("Invalid filename!");
if (!preg_match('/^(.+)\.torrent$/si', $fname, $matches))
    bark("Invalid filename (not a .torrent).");
$shortfname = $torrent = $matches[1];
if (!empty($_POST["name"]))
    $torrent = unesc($_POST["name"]);

$tmpname = $f["tmp_name"];
if (!is_uploaded_file($tmpname))
    bark("eek");
if (!filesize($tmpname))
    bark("Empty file!");

$dict = bdec_file($tmpname, $max_torrent_size);
if (!isset($dict))
    bark("What the hell did you upload? This is not a bencoded file!");

function dict_check($d, $s) {
    if ($d["type"] != "dictionary")
        bark("not a dictionary");
    $a = explode(":", $s);
    $dd = $d["value"];
    $ret = array();
    foreach ($a as $k) {
        unset($t);
        if (preg_match('/^(.*)\((.*)\)$/', $k, $m)) {
            $k = $m[1];
            $t = $m[2];
        }
        if (!isset($dd[$k]))
            bark("dictionary is missing key(s)");
        if (isset($t)) {
            if ($dd[$k]["type"] != $t)
                bark("invalid entry in dictionary");
            $ret[] = $dd[$k]["value"];
        }
        else
            $ret[] = $dd[$k];
    }
    return $ret;
}

function dict_get($d, $k, $t) {
    if ($d["type"] != "dictionary")
        bark("not a dictionary");
    $dd = $d["value"];
    if (!isset($dd[$k]))
        return;
    $v = $dd[$k];
    if ($v["type"] != $t)
        bark("invalid dictionary entry type");
    return $v["value"];
}

list($ann, $info) = dict_check($dict, "announce(string):info");
list($dname, $plen, $pieces) = dict_check($info, "name(string):piece length(integer):pieces(string)");

if (!in_array($ann, $announce_urls, 1))
    bark("invalid announce url! must be <b>" . $announce_urls[0] . "</b>");

if (isset($dict['value']['announce-list']))
bark("Multi-tracker torrents are NOT allowed!");

if (strlen($pieces) % 20 != 0)
    bark("invalid pieces");

$filelist = array();
$totallen = dict_get($info, "length", "integer");
if (isset($totallen)) {
    $filelist[] = array($dname, $totallen);
    $type = "single";
}
else {
    $flist = dict_get($info, "files", "list");
    if (!isset($flist))
        bark("missing both length and files");
    if (!count($flist))
        bark("no files");
    $totallen = 0;
    foreach ($flist as $fn) {
        list($ll, $ff) = dict_check($fn, "length(integer):path(list)");
        $totallen += $ll;
        $ffa = array();
        foreach ($ff as $ffe) {
            if ($ffe["type"] != "string")
                bark("filename error");
            $ffa[] = $ffe["value"];
        }
        if (!count($ffa))
            bark("filename error");
        $ffe = implode("/", $ffa);
        $filelist[] = array($ffe, $ll);
    }
    $type = "multi";
}

$infohash = pack("H*", sha1($info["string"]));


// Replace punctuation characters with spaces

$torrent = str_replace("_", " ", $torrent);

$nfo = sqlesc(str_replace("\x0d\x0d\x0a", "\x0d\x0a", @file_get_contents($nfofilename)));
$smalldescr = $_POST["description"];
$ret = mysql_query("INSERT INTO torrents (search_text, filename, owner, visible, info_hash, name, size, numfiles, type, descr, ori_descr, description, category, save_as, added, last_action, nfo, poster) VALUES (" .
        implode(",", array_map("sqlesc", array(searchfield("$shortfname $dname $torrent"), $fname, $CURUSER["id"], "no", $infohash, $torrent, $totallen, count($filelist), $type, $descr, $descr, $smalldescr, 0 + $_POST["type"], $dname))) .
        ", '" . get_date_time() . "', '" . get_date_time() . "', $nfo, '".$poster."')");
if (!$ret) {
    if (mysql_errno() == 1062)
        bark("torrent already uploaded!");
    bark("mysql puked: ".mysql_error());
}
$id = mysql_insert_id();

@mysql_query("DELETE FROM files WHERE torrent = $id");
foreach ($filelist as $file) {
    @mysql_query("INSERT INTO files (torrent, filename, size) VALUES ($id, ".sqlesc($file[0]).",".$file[1].")");
}

move_uploaded_file($tmpname, "$torrent_dir/$id.torrent");

if ($CURUSER["advertisename"]=='yes'){
write_log("Torrent $id ($torrent) was uploaded by Anonymous");
}
else
{
write_log("Torrent $id ($torrent) was uploaded by $CURUSER[username]");
}
//===notify people who voted on offer thanks CoLdFuSiOn :)
if (isset($_POST['offer'])) {
$res = mysql_query("SELECT `userid` FROM `offervotes` WHERE `userid` != " . $CURUSER["id"] . " AND `offerid` = ". ($_POST['offer'] + 0)) or sqlerr(__FILE__, __LINE__);
$pn_msg = "The Offer you voted for: \"$torrent\" was uploaded by " . $CURUSER["username"] . ".\nYou can Download the Torrent here";
$some_variable = '';
while($row = mysql_fetch_assoc($res)) {
//=== use this if you DO have subject in your PMs
$some_variable .= "(0, 0, 'Offer $torrent was just uploaded', $row[userid], '" . get_date_time() . "', " . sqlesc($pn_msg) . ")";
//=== use this if you DO NOT have subject in your PMs
//$some_variable .= "(0, 0, $row[userid], '" . get_date_time() . "', " . sqlesc($pn_msg) . ")";
}
//=== use this if you DO have subject in your PMs
mysql_query("INSERT INTO messages (poster, sender, subject, receiver, added, msg) VALUES ".$some_variable."") or sqlerr(__FILE__, __LINE__);
//=== use this if you do NOT have subject in your PMs
//mysql_query("INSERT INTO messages (poster, sender, receiver, added, msg) VALUES ".$some_variable."") or sqlerr(__FILE__, __LINE__);
//===end

//=== delete all offer stuff
@mysql_query("DELETE FROM `offers` WHERE `id` = ". ($_POST['offer'] + 0));
@mysql_query("DELETE FROM `offervotes` WHERE `offerid` = ". ($_POST['offer'] + 0));
@mysql_query("DELETE FROM `comments` WHERE `offer` = ". ($_POST['offer'] + 0). "");
}
//=== end notify people who voted on offer

/* RSS feeds */

if (($fd1 = @fopen("rss.xml", "w")) && ($fd2 = fopen("rssdd.xml", "w")))
{
    $cats = "";
    $res = mysql_query("SELECT id, name FROM categories");
    while ($arr = mysql_fetch_assoc($res))
        $cats[$arr["id"]] = $arr["name"];
    $s = "<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>\n<rss version=\"0.91\">\n<channel>\n" .
        "<title>TorrentBits</title>\n<description>0-week torrents</description>\n<link>$DEFAULTBASEURL/</link>\n";
    @fwrite($fd1, $s);
    @fwrite($fd2, $s);
    $r = mysql_query("SELECT id,name,descr,filename,category FROM torrents ORDER BY added DESC LIMIT 15") or sqlerr(__FILE__, __LINE__);
    while ($a = mysql_fetch_assoc($r))
    {
        $cat = $cats[$a["category"]];
        $s = "<item>\n<title>" . htmlspecialchars($a["name"] . " ($cat)") . "</title>\n" .
            "<description>" . htmlspecialchars($a["descr"]) . "</description>\n";
        @fwrite($fd1, $s);
        @fwrite($fd2, $s);
        @fwrite($fd1, "<link>$DEFAULTBASEURL/details.php?id=$a[id]&amp;hit=1</link>\n</item>\n");
        $filename = htmlspecialchars($a["filename"]);
        @fwrite($fd2, "<link>$DEFAULTBASEURL/download.php/$a[id]/$filename</link>\n</item>\n");
    }
    $s = "</channel>\n</rss>\n";
    @fwrite($fd1, $s);
    @fwrite($fd2, $s);
    @fclose($fd1);
    @fclose($fd2);
}

/* Email notifs */
/*******************

$res = mysql_query("SELECT name FROM categories WHERE id=$catid") or sqlerr();
$arr = mysql_fetch_assoc($res);
$cat = $arr["name"];
$res = mysql_query("SELECT email FROM users WHERE enabled='yes' AND notifs LIKE '%[cat$catid]%'") or sqlerr();
$uploader = $CURUSER['username'];

$size = mksize($totallen);
$description = ($html ? strip_tags($descr) : $descr);

$body = <<<EOD
A new torrent has been uploaded.

Name: $torrent
Size: $size
Category: $cat
Uploaded by: $uploader

Description
-------------------------------------------------------------------------------
$description
-------------------------------------------------------------------------------

You can use the URL below to download the torrent (you may have to login).

$DEFAULTBASEURL/details.php?id=$id&hit=1

-- 
$SITENAME
EOD;
$to = "";
$nmax = 100; // Max recipients per message
$nthis = 0;
$ntotal = 0;
$total = mysql_num_rows($res);
while ($arr = mysql_fetch_row($res))
{
  if ($nthis == 0)
    $to = $arr[0];
  else
    $to .= "," . $arr[0];
  ++$nthis;
  ++$ntotal;
  if ($nthis == $nmax || $ntotal == $total)
  {
    if (!mail("Multiple recipients <$SITEEMAIL>", "New torrent - $torrent", $body,
    "From: $SITEEMAIL\r\nBcc: $to", "-f$SITEEMAIL"))
      stderr("Error", "Your torrent has been been uploaded. DO NOT RELOAD THE PAGE!\n" .
        "There was however a problem delivering the e-mail notifcations.\n" .
        "Please let an administrator know about this error!\n");
    $nthis = 0;
  }
}
*******************/

header("Location: $BASEURL/details.php?id=$id&uploaded=1");
}
?>
Reply With Quote
  #3  
Old 24th September 2008, 12:30
Keiichi Keiichi is offline
Senior Member
 
Join Date: Feb 2008
Brazil
Posts: 25
Default
Quote:
Originally Posted by sharpe View Post
I get this error: Parse error: syntax error: Parse error: syntax error, unexpected $end in /users/*****/www/takeupload.php on line 338

PHP Code:
<?
/*
// +--------------------------------------------------------------------------+
// | TorrentStrike X-Edition by Neptune                                       |
// +--------------------------------------------------------------------------+
// | This file is part of TorrentStrike X-Edtion. Is based on TBDev,          |
// | originally by RedBeard of TorrentBits, extensively modified by           |
// | Gartenzwerg.                                                             |
// |                                                                          |
// | TorrentStrike is free software; you can redistribute it and/or modify    |
// | it under the terms of the GNU General Public License as published by     |
// | the Free Software Foundation; either version 2 of the License, or        |
// | (at your option) any later version.                                      |
// |                                                                          |
// | TorrentStrike is distributed in the hope that it will be useful,         |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of           |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            |
// | GNU General Public License for more details.                             |
// |                                                                          |
// | You should have received a copy of the GNU General Public License        |
// | along with TorrentStrike; if not, write to the Free Software Foundation, |
// | Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA            |
// +--------------------------------------------------------------------------+
// |                                       TorrentStrike X-Edition by Neptune |
// +--------------------------------------------------------------------------+
*/
require_once("include/benc.php");
require_once(
"include/bittorrent.php");

ini_set("upload_max_filesize",$max_torrent_size);

function 
bark($msg) {
    
genbark($msg"Upload failed!");
}

 

loggedinorreturn();

if (
$CURUSER["uploadpos"] == 'no')
die;  

foreach(
explode(":","descr:type:name") as $v) {
    if (!isset(
$_POST[$v]))
        
bark("missing form data");
}
if (!empty(
$_POST['poster']))
$poster unesc($_POST['poster']);

if (!isset(
$_FILES["file"]))
    
bark("missing form data");

$f $_FILES["file"];
$fname unesc($f["name"]);
if (empty(
$fname))
    
bark("Empty filename!");
    
$nfofile $_FILES['nfo'];
if (
$nfofile['name'] != '')
{
    if (
$nfofile['size'] == 0)
      
bark("0-byte NFO");

    if (
$nfofile['size'] > 65535)
      
bark("NFO is too big! Max 65,535 bytes.");

    
$nfofilename $nfofile['tmp_name'];

    if (@!
is_uploaded_file($nfofilename))
      
bark("NFO upload failed");
}      

// Handle picture uploads
$picnum 0;
if (
$_FILES["pic1"]["name"] != "") {
    
tr_msg("Vorschaubild ".($picnum+1)." verkleinern und ablegen");
    if (
torrent_image_upload($_FILES["pic1"], $id$picnum+1))
        
$picnum++;


if (
$_FILES["pic2"]["name"] != "") {    
    
tr_msg("Vorschaubild ".($picnum+1)." verkleinern und ablegen");
    if (
torrent_image_upload($_FILES["pic2"], $id$picnum+1))

        
$picnum++;

$descr unesc($_POST["descr"]);
if (!
$descr)
  
bark("You must enter a description!");

$catid = ($_POST["type"]);
if (!
is_valid_id($catid))
    
bark("You must select a category to put the torrent in!");
    
if (!
validfilename($fname))
    
bark("Invalid filename!");
if (!
preg_match('/^(.+)\.torrent$/si'$fname$matches))
    
bark("Invalid filename (not a .torrent).");
$shortfname $torrent $matches[1];
if (!empty(
$_POST["name"]))
    
$torrent unesc($_POST["name"]);

$tmpname $f["tmp_name"];
if (!
is_uploaded_file($tmpname))
    
bark("eek");
if (!
filesize($tmpname))
    
bark("Empty file!");

$dict bdec_file($tmpname$max_torrent_size);
if (!isset(
$dict))
    
bark("What the hell did you upload? This is not a bencoded file!");

function 
dict_check($d$s) {
    if (
$d["type"] != "dictionary")
        
bark("not a dictionary");
    
$a explode(":"$s);
    
$dd $d["value"];
    
$ret = array();
    foreach (
$a as $k) {
        unset(
$t);
        if (
preg_match('/^(.*)\((.*)\)$/'$k$m)) {
            
$k $m[1];
            
$t $m[2];
        }
        if (!isset(
$dd[$k]))
            
bark("dictionary is missing key(s)");
        if (isset(
$t)) {
            if (
$dd[$k]["type"] != $t)
                
bark("invalid entry in dictionary");
            
$ret[] = $dd[$k]["value"];
        }
        else
            
$ret[] = $dd[$k];
    }
    return 
$ret;
}

function 
dict_get($d$k$t) {
    if (
$d["type"] != "dictionary")
        
bark("not a dictionary");
    
$dd $d["value"];
    if (!isset(
$dd[$k]))
        return;
    
$v $dd[$k];
    if (
$v["type"] != $t)
        
bark("invalid dictionary entry type");
    return 
$v["value"];
}

list(
$ann$info) = dict_check($dict"announce(string):info");
list(
$dname$plen$pieces) = dict_check($info"name(string):piece length(integer):pieces(string)");

if (!
in_array($ann$announce_urls1))
    
bark("invalid announce url! must be <b>" $announce_urls[0] . "</b>");

if (isset(
$dict['value']['announce-list']))
bark("Multi-tracker torrents are NOT allowed!");

if (
strlen($pieces) % 20 != 0)
    
bark("invalid pieces");

$filelist = array();
$totallen dict_get($info"length""integer");
if (isset(
$totallen)) {
    
$filelist[] = array($dname$totallen);
    
$type "single";
}
else {
    
$flist dict_get($info"files""list");
    if (!isset(
$flist))
        
bark("missing both length and files");
    if (!
count($flist))
        
bark("no files");
    
$totallen 0;
    foreach (
$flist as $fn) {
        list(
$ll$ff) = dict_check($fn"length(integer):path(list)");
        
$totallen += $ll;
        
$ffa = array();
        foreach (
$ff as $ffe) {
            if (
$ffe["type"] != "string")
                
bark("filename error");
            
$ffa[] = $ffe["value"];
        }
        if (!
count($ffa))
            
bark("filename error");
        
$ffe implode("/"$ffa);
        
$filelist[] = array($ffe$ll);
    }
    
$type "multi";
}

$infohash pack("H*"sha1($info["string"]));


// Replace punctuation characters with spaces

$torrent str_replace("_"" "$torrent);

$nfo sqlesc(str_replace("\x0d\x0d\x0a""\x0d\x0a", @file_get_contents($nfofilename)));
$smalldescr $_POST["description"];
$ret mysql_query("INSERT INTO torrents (search_text, filename, owner, visible, info_hash, name, size, numfiles, type, descr, ori_descr, description, category, save_as, added, last_action, nfo, poster) VALUES (" .
        
implode(","array_map("sqlesc", array(searchfield("$shortfname $dname $torrent"), $fname$CURUSER["id"], "no"$infohash$torrent$totallencount($filelist), $type$descr$descr$smalldescr$_POST["type"], $dname))) .
        
", '" get_date_time() . "', '" get_date_time() . "', $nfo, '".$poster."')");
if (!
$ret) {
    if (
mysql_errno() == 1062)
        
bark("torrent already uploaded!");
    
bark("mysql puked: ".mysql_error());
}
$id mysql_insert_id();

@
mysql_query("DELETE FROM files WHERE torrent = $id");
foreach (
$filelist as $file) {
    @
mysql_query("INSERT INTO files (torrent, filename, size) VALUES ($id, ".sqlesc($file[0]).",".$file[1].")");
}

move_uploaded_file($tmpname"$torrent_dir/$id.torrent");

if (
$CURUSER["advertisename"]=='yes'){
write_log("Torrent $id ($torrent) was uploaded by Anonymous");
}
else
{
write_log("Torrent $id ($torrent) was uploaded by $CURUSER[username]");
}
//===notify people who voted on offer thanks CoLdFuSiOn :)
if (isset($_POST['offer'])) {
$res mysql_query("SELECT `userid` FROM `offervotes` WHERE `userid` != " $CURUSER["id"] . " AND `offerid` = ". ($_POST['offer'] + 0)) or sqlerr(__FILE____LINE__);
$pn_msg "The Offer you voted for: \"$torrent\" was uploaded by " $CURUSER["username"] . ".\nYou can Download the Torrent [url=$DEFAULTBASEURL/details.php?id=$id&hit=1]here[/url]";
$some_variable '';
while(
$row mysql_fetch_assoc($res)) {
//=== use this if you DO have subject in your PMs
$some_variable .= "(0, 0, 'Offer $torrent was just uploaded', $row[userid], '" get_date_time() . "', " sqlesc($pn_msg) . ")";
//=== use this if you DO NOT have subject in your PMs
//$some_variable .= "(0, 0, $row[userid], '" . get_date_time() . "', " . sqlesc($pn_msg) . ")";
}
//=== use this if you DO have subject in your PMs
mysql_query("INSERT INTO messages (poster, sender, subject, receiver, added, msg) VALUES ".$some_variable."") or sqlerr(__FILE____LINE__);
//=== use this if you do NOT have subject in your PMs
//mysql_query("INSERT INTO messages (poster, sender, receiver, added, msg) VALUES ".$some_variable."") or sqlerr(__FILE__, __LINE__);
//===end

//=== delete all offer stuff
@mysql_query("DELETE FROM `offers` WHERE `id` = ". ($_POST['offer'] + 0));
@
mysql_query("DELETE FROM `offervotes` WHERE `offerid` = ". ($_POST['offer'] + 0));
@
mysql_query("DELETE FROM `comments` WHERE `offer` = ". ($_POST['offer'] + 0). "");
}
//=== end notify people who voted on offer

/* RSS feeds */

if (($fd1 = @fopen("rss.xml""w")) && ($fd2 fopen("rssdd.xml""w")))
{
    
$cats "";
    
$res mysql_query("SELECT id, name FROM categories");
    while (
$arr mysql_fetch_assoc($res))
        
$cats[$arr["id"]] = $arr["name"];
    
$s "<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>\n<rss version=\"0.91\">\n<channel>\n" .
        
"<title>TorrentBits</title>\n<description>0-week torrents</description>\n<link>$DEFAULTBASEURL/</link>\n";
    @
fwrite($fd1$s);
    @
fwrite($fd2$s);
    
$r mysql_query("SELECT id,name,descr,filename,category FROM torrents ORDER BY added DESC LIMIT 15") or sqlerr(__FILE____LINE__);
    while (
$a mysql_fetch_assoc($r))
    {
        
$cat $cats[$a["category"]];
        
$s "<item>\n<title>" htmlspecialchars($a["name"] . " ($cat)") . "</title>\n" .
            
"<description>" htmlspecialchars($a["descr"]) . "</description>\n";
        @
fwrite($fd1$s);
        @
fwrite($fd2$s);
        @
fwrite($fd1"<link>$DEFAULTBASEURL/details.php?id=$a[id]&amp;hit=1</link>\n</item>\n");
        
$filename htmlspecialchars($a["filename"]);
        @
fwrite($fd2"<link>$DEFAULTBASEURL/download.php/$a[id]/$filename</link>\n</item>\n");
    }
    
$s "</channel>\n</rss>\n";
    @
fwrite($fd1$s);
    @
fwrite($fd2$s);
    @
fclose($fd1);
    @
fclose($fd2);
}

/* Email notifs */
/*******************

$res = mysql_query("SELECT name FROM categories WHERE id=$catid") or sqlerr();
$arr = mysql_fetch_assoc($res);
$cat = $arr["name"];
$res = mysql_query("SELECT email FROM users WHERE enabled='yes' AND notifs LIKE '%[cat$catid]%'") or sqlerr();
$uploader = $CURUSER['username'];

$size = mksize($totallen);
$description = ($html ? strip_tags($descr) : $descr);

$body = <<<EOD
A new torrent has been uploaded.

Name: $torrent
Size: $size
Category: $cat
Uploaded by: $uploader

Description
-------------------------------------------------------------------------------
$description
-------------------------------------------------------------------------------

You can use the URL below to download the torrent (you may have to login).

$DEFAULTBASEURL/details.php?id=$id&hit=1

-- 
$SITENAME
EOD;
$to = "";
$nmax = 100; // Max recipients per message
$nthis = 0;
$ntotal = 0;
$total = mysql_num_rows($res);
while ($arr = mysql_fetch_row($res))
{
  if ($nthis == 0)
    $to = $arr[0];
  else
    $to .= "," . $arr[0];
  ++$nthis;
  ++$ntotal;
  if ($nthis == $nmax || $ntotal == $total)
  {
    if (!mail("Multiple recipients <$SITEEMAIL>", "New torrent - $torrent", $body,
    "From: $SITEEMAIL\r\nBcc: $to", "-f$SITEEMAIL"))
      stderr("Error", "Your torrent has been been uploaded. DO NOT RELOAD THE PAGE!\n" .
        "There was however a problem delivering the e-mail notifcations.\n" .
        "Please let an administrator know about this error!\n");
    $nthis = 0;
  }
}
*******************/

header("Location: $BASEURL/details.php?id=$id&uploaded=1");

?>
can some1 help me?
o erro 77 / 87 line ok
original
PHP Code:
// Handle picture uploads
$picnum 0;
if (
$_FILES["pic1"]["name"] != "") {
    
tr_msg("Vorschaubild ".($picnum+1)." verkleinern und ablegen");
    if (
torrent_image_upload($_FILES["pic1"], $id$picnum+1))
        
$picnum++;


if (
$_FILES["pic2"]["name"] != "") {    
    
tr_msg("Vorschaubild ".($picnum+1)." verkleinern und ablegen");
    if (
torrent_image_upload($_FILES["pic2"], $id$picnum+1))

        
$picnum++;

$descr unesc($_POST["descr"]);
if (!
$descr)
  
bark("You must enter a description!"); 
o ok
PHP Code:
// Handle picture uploads
$picnum 0;
if (
$_FILES["pic1"]["name"] != "") {
    
tr_msg("Vorschaubild ".($picnum+1)." verkleinern und ablegen");
    if (
torrent_image_upload($_FILES["pic1"], $id$picnum+1))
        
$picnum++;


if (
$_FILES["pic2"]["name"] != "") {    
    
tr_msg("Vorschaubild ".($picnum+1)." verkleinern und ablegen");
    if (
torrent_image_upload($_FILES["pic2"], $id$picnum+1))

        
$picnum++;
}
$descr unesc($_POST["descr"]);
if (!
$descr)
  
bark("You must enter a description!"); 
Reply With Quote
  #4  
Old 24th September 2008, 12:34
sharpe's Avatar
sharpe sharpe is offline
Senior Member
 
Join Date: Sep 2008
Posts: 52
Default
thx but now i get this:

Fatal error: Call to undefined function tr_msg() in /users/****/www/takeupload.php on line 76
Reply With Quote
  #5  
Old 24th September 2008, 12:41
seb35 seb35 is offline
Senior Member
 
Join Date: Dec 2007
France
Posts: 32
Default re
tr_msg = bark
Reply With Quote
  #6  
Old 24th September 2008, 12:47
sharpe's Avatar
sharpe sharpe is offline
Senior Member
 
Join Date: Sep 2008
Posts: 52
Default
MUWAHAHAHAHAHA!!!

Upload failed!!

Reply With Quote
  #7  
Old 24th September 2008, 12:57
seb35 seb35 is offline
Senior Member
 
Join Date: Dec 2007
France
Posts: 32
Default re
Post script completed
Even if I can help you on the errors of syntax i am not a soothsayer
Reply With Quote
  #8  
Old 24th September 2008, 13:10
sharpe's Avatar
sharpe sharpe is offline
Senior Member
 
Join Date: Sep 2008
Posts: 52
Default
ok
then again
takeupload.php:
PHP Code:
<?
/*
// +--------------------------------------------------------------------------+
// | TorrentStrike X-Edition by Neptune                                       |
// +--------------------------------------------------------------------------+
// | This file is part of TorrentStrike X-Edtion. Is based on TBDev,          |
// | originally by RedBeard of TorrentBits, extensively modified by           |
// | Gartenzwerg.                                                             |
// |                                                                          |
// | TorrentStrike is free software; you can redistribute it and/or modify    |
// | it under the terms of the GNU General Public License as published by     |
// | the Free Software Foundation; either version 2 of the License, or        |
// | (at your option) any later version.                                      |
// |                                                                          |
// | TorrentStrike is distributed in the hope that it will be useful,         |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of           |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            |
// | GNU General Public License for more details.                             |
// |                                                                          |
// | You should have received a copy of the GNU General Public License        |
// | along with TorrentStrike; if not, write to the Free Software Foundation, |
// | Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA            |
// +--------------------------------------------------------------------------+
// |                                       TorrentStrike X-Edition by Neptune |
// +--------------------------------------------------------------------------+
*/
require_once("include/benc.php");
require_once(
"include/bittorrent.php");

ini_set("upload_max_filesize",$max_torrent_size);

function 
bark($msg) {
    
genbark($msg"Upload failed!");
}

 

loggedinorreturn();

if (
$CURUSER["uploadpos"] == 'no')
die;  

foreach(
explode(":","descr:type:name") as $v) {
    if (!isset(
$_POST[$v]))
        
bark("missing form data");
}
if (!empty(
$_POST['poster']))
$poster unesc($_POST['poster']);

if (!isset(
$_FILES["file"]))
    
bark("missing form data");

$f $_FILES["file"];
$fname unesc($f["name"]);
if (empty(
$fname))
    
bark("Empty filename!");
    
$nfofile $_FILES['nfo'];
if (
$nfofile['name'] != '')
{
    if (
$nfofile['size'] == 0)
      
bark("0-byte NFO");

    if (
$nfofile['size'] > 65535)
      
bark("NFO is too big! Max 65,535 bytes.");

    
$nfofilename $nfofile['tmp_name'];

    if (@!
is_uploaded_file($nfofilename))
      
bark("NFO upload failed");
}      

// Handle picture uploads
$picnum 0;
if (
$_FILES["pic1"]["name"] != "") {
    
bark("Vorschaubild ".($picnum+1)." verkleinern und ablegen");
    if (
torrent_image_upload($_FILES["pic1"], $id$picnum+1))
        
$picnum++;


if (
$_FILES["pic2"]["name"] != "") {    
    
bark("Vorschaubild ".($picnum+1)." verkleinern und ablegen");
    if (
torrent_image_upload($_FILES["pic2"], $id$picnum+1))
        
$picnum++;

$descr unesc($_POST["descr"]);
if (!
$descr)
  
bark("You must enter a description!");  

$catid = ($_POST["type"]);
if (!
is_valid_id($catid))
    
bark("You must select a category to put the torrent in!");
    
if (!
validfilename($fname))
    
bark("Invalid filename!");
if (!
preg_match('/^(.+)\.torrent$/si'$fname$matches))
    
bark("Invalid filename (not a .torrent).");
$shortfname $torrent $matches[1];
if (!empty(
$_POST["name"]))
    
$torrent unesc($_POST["name"]);

$tmpname $f["tmp_name"];
if (!
is_uploaded_file($tmpname))
    
bark("eek");
if (!
filesize($tmpname))
    
bark("Empty file!");

$dict bdec_file($tmpname$max_torrent_size);
if (!isset(
$dict))
    
bark("What the hell did you upload? This is not a bencoded file!");

function 
dict_check($d$s) {
    if (
$d["type"] != "dictionary")
        
bark("not a dictionary");
    
$a explode(":"$s);
    
$dd $d["value"];

    
$ret = array();
    foreach (
$a as $k) {
        unset(
$t);
        if (
preg_match('/^(.*)\((.*)\)$/'$k$m)) {
            
$k $m[1];
            
$t $m[2];
        }
        if (!isset(
$dd[$k]))
            
bark("dictionary is missing key(s)");
        if (isset(
$t)) {
            if (
$dd[$k]["type"] != $t)
                
bark("invalid entry in dictionary");
            
$ret[] = $dd[$k]["value"];
        }
        else
            
$ret[] = $dd[$k];
    }
    return 
$ret;
}

function 
dict_get($d$k$t) {
    if (
$d["type"] != "dictionary")
        
bark("not a dictionary");
    
$dd $d["value"];
    if (!isset(
$dd[$k]))
        return;
    
$v $dd[$k];
    if (
$v["type"] != $t)
        
bark("invalid dictionary entry type");
    return 
$v["value"];
}

list(
$ann$info) = dict_check($dict"announce(string):info");
list(
$dname$plen$pieces) = dict_check($info"name(string):piece length(integer):pieces(string)");

if (!
in_array($ann$announce_urls1))
    
bark("invalid announce url! must be <b>" $announce_urls[0] . "</b>");

if (isset(
$dict['value']['announce-list']))
bark("Multi-tracker torrents are NOT allowed!");

if (
strlen($pieces) % 20 != 0)
    
bark("invalid pieces");

$filelist = array();
$totallen dict_get($info"length""integer");
if (isset(
$totallen)) {
    
$filelist[] = array($dname$totallen);
    
$type "single";
}
else {
    
$flist dict_get($info"files""list");
    if (!isset(
$flist))
        
bark("missing both length and files");
    if (!
count($flist))
        
bark("no files");
    
$totallen 0;
    foreach (
$flist as $fn) {
        list(
$ll$ff) = dict_check($fn"length(integer):path(list)");
        
$totallen += $ll;
        
$ffa = array();
        foreach (
$ff as $ffe) {
            if (
$ffe["type"] != "string")
                
bark("filename error");
            
$ffa[] = $ffe["value"];
        }
        if (!
count($ffa))
            
bark("filename error");
        
$ffe implode("/"$ffa);
        
$filelist[] = array($ffe$ll);
    }
    
$type "multi";
}

$infohash pack("H*"sha1($info["string"]));


// Replace punctuation characters with spaces

$torrent str_replace("_"" "$torrent);

$nfo sqlesc(str_replace("\x0d\x0d\x0a""\x0d\x0a", @file_get_contents($nfofilename)));
$smalldescr $_POST["description"];
$ret mysql_query("INSERT INTO torrents (search_text, filename, owner, visible, info_hash, name, size, numfiles, type, descr, ori_descr, description, category, save_as, added, last_action, nfo, poster) VALUES (" .
        
implode(","array_map("sqlesc", array(searchfield("$shortfname $dname $torrent"), $fname$CURUSER["id"], "no"$infohash$torrent$totallencount($filelist), $type$descr$descr$smalldescr$_POST["type"], $dname))) .
        
", '" get_date_time() . "', '" get_date_time() . "', $nfo, '".$poster."')");
if (!
$ret) {
    if (
mysql_errno() == 1062)
        
bark("torrent already uploaded!");
    
bark("mysql puked: ".mysql_error());
}
$id mysql_insert_id();

@
mysql_query("DELETE FROM files WHERE torrent = $id");
foreach (
$filelist as $file) {
    @
mysql_query("INSERT INTO files (torrent, filename, size) VALUES ($id, ".sqlesc($file[0]).",".$file[1].")");
}

move_uploaded_file($tmpname"$torrent_dir/$id.torrent");

if (
$CURUSER["advertisename"]=='yes'){
write_log("Torrent $id ($torrent) was uploaded by Anonymous");
}
else
{
write_log("Torrent $id ($torrent) was uploaded by $CURUSER[username]");
}
//===notify people who voted on offer thanks CoLdFuSiOn :)
if (isset($_POST['offer'])) {
$res mysql_query("SELECT `userid` FROM `offervotes` WHERE `userid` != " $CURUSER["id"] . " AND `offerid` = ". ($_POST['offer'] + 0)) or sqlerr(__FILE____LINE__);
$pn_msg "The Offer you voted for: \"$torrent\" was uploaded by " $CURUSER["username"] . ".\nYou can Download the Torrent here";
$some_variable '';
while(
$row mysql_fetch_assoc($res)) {
//=== use this if you DO have subject in your PMs
$some_variable .= "(0, 0, 'Offer $torrent was just uploaded', $row[userid], '" get_date_time() . "', " sqlesc($pn_msg) . ")";
//=== use this if you DO NOT have subject in your PMs
//$some_variable .= "(0, 0, $row[userid], '" . get_date_time() . "', " . sqlesc($pn_msg) . ")";
}
//=== use this if you DO have subject in your PMs
mysql_query("INSERT INTO messages (poster, sender, subject, receiver, added, msg) VALUES ".$some_variable."") or sqlerr(__FILE____LINE__);
//=== use this if you do NOT have subject in your PMs
//mysql_query("INSERT INTO messages (poster, sender, receiver, added, msg) VALUES ".$some_variable."") or sqlerr(__FILE__, __LINE__);
//===end

//=== delete all offer stuff
@mysql_query("DELETE FROM `offers` WHERE `id` = ". ($_POST['offer'] + 0));
@
mysql_query("DELETE FROM `offervotes` WHERE `offerid` = ". ($_POST['offer'] + 0));
@
mysql_query("DELETE FROM `comments` WHERE `offer` = ". ($_POST['offer'] + 0). "");
}
//=== end notify people who voted on offer

/* RSS feeds */

if (($fd1 = @fopen("rss.xml""w")) && ($fd2 fopen("rssdd.xml""w")))
{
    
$cats "";
    
$res mysql_query("SELECT id, name FROM categories");
    while (
$arr mysql_fetch_assoc($res))
        
$cats[$arr["id"]] = $arr["name"];
    
$s "<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>\n<rss version=\"0.91\">\n<channel>\n" .
        
"<title>TorrentBits</title>\n<description>0-week torrents</description>\n<link>$DEFAULTBASEURL/</link>\n";
    @
fwrite($fd1$s);
    @
fwrite($fd2$s);
    
$r mysql_query("SELECT id,name,descr,filename,category FROM torrents ORDER BY added DESC LIMIT 15") or sqlerr(__FILE____LINE__);
    while (
$a mysql_fetch_assoc($r))
    {
        
$cat $cats[$a["category"]];
        
$s "<item>\n<title>" htmlspecialchars($a["name"] . " ($cat)") . "</title>\n" .
            
"<description>" htmlspecialchars($a["descr"]) . "</description>\n";
        @
fwrite($fd1$s);
        @
fwrite($fd2$s);
        @
fwrite($fd1"<link>$DEFAULTBASEURL/details.php?id=$a[id]&amp;hit=1</link>\n</item>\n");
        
$filename htmlspecialchars($a["filename"]);
        @
fwrite($fd2"<link>$DEFAULTBASEURL/download.php/$a[id]/$filename</link>\n</item>\n");
    }
    
$s "</channel>\n</rss>\n";
    @
fwrite($fd1$s);
    @
fwrite($fd2$s);
    @
fclose($fd1);
    @
fclose($fd2);
}

/* Email notifs */
/*******************

$res = mysql_query("SELECT name FROM categories WHERE id=$catid") or sqlerr();
$arr = mysql_fetch_assoc($res);
$cat = $arr["name"];
$res = mysql_query("SELECT email FROM users WHERE enabled='yes' AND notifs LIKE '%[cat$catid]%'") or sqlerr();
$uploader = $CURUSER['username'];

$size = mksize($totallen);
$description = ($html ? strip_tags($descr) : $descr);

$body = <<<EOD
A new torrent has been uploaded.

Name: $torrent
Size: $size
Category: $cat
Uploaded by: $uploader

Description
-------------------------------------------------------------------------------
$description
-------------------------------------------------------------------------------

You can use the URL below to download the torrent (you may have to login).

$DEFAULTBASEURL/details.php?id=$id&hit=1

-- 
$SITENAME
EOD;
$to = "";
$nmax = 100; // Max recipients per message
$nthis = 0;
$ntotal = 0;
$total = mysql_num_rows($res);
while ($arr = mysql_fetch_row($res))
{
  if ($nthis == 0)
    $to = $arr[0];
  else
    $to .= "," . $arr[0];
  ++$nthis;
  ++$ntotal;
  if ($nthis == $nmax || $ntotal == $total)
  {
    if (!mail("Multiple recipients <$SITEEMAIL>", "New torrent - $torrent", $body,
    "From: $SITEEMAIL\r\nBcc: $to", "-f$SITEEMAIL"))
      stderr("Error", "Your torrent has been been uploaded. DO NOT RELOAD THE PAGE!\n" .
        "There was however a problem delivering the e-mail notifcations.\n" .
        "Please let an administrator know about this error!\n");
    $nthis = 0;
  }
}
*******************/

header("Location: $BASEURL/details.php?id=$id&uploaded=1");
}
?>

Last edited by sharpe; 24th September 2008 at 13:29.
Reply With Quote
  #9  
Old 24th September 2008, 15:10
sharpe's Avatar
sharpe sharpe is offline
Senior Member
 
Join Date: Sep 2008
Posts: 52
Default
Well thanks anyway i've got that code from a friend of mine and it works for him.
I just have 2 delete these settings and stay at 1 image.
pitty.

THANKS ALL OF U!!
Reply With Quote
Reply

Tags
error , parse , syntax , urgent

Thread Tools

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
syntax error from functions_announce.php radio Yuna Scatari Edition (YSE) 2 11th September 2009 10:45
help error, http error and invalid passkey thereal Torrent Strike 0 9th April 2009 02:07
Upload error, Fatal error TKO Template Shares 5 14th February 2009 02:23
Parse Error oem TBDev 2 13th June 2008 21:21
Error [Parse error] koolfire Free Torrent Source 1 9th June 2008 13:39



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