Bravo List
Register
Go Back   > Bravo List > P2P > Forum > Community Cafe
Reply
  #1  
Old 14th October 2008, 23:26
wMan wMan is offline
Banned
 
Join Date: Feb 2008
P2P
Posts: 1,433
Default upload error
ok this is takeupload every time we try to upload we get a error extra brace } but when removing it we get another error

Code:
Parse error: syntax error, unexpected T_STRING in /home/tehrootc/public_html/takeupload.php on line 185

takeupload.php
:

PHP Code:
<?

require_once("include/benc.php");
require_once(
"include/bittorrent.php");

ini_set("upload_max_filesize",$max_torrent_size);
$max_public_torrent_size 800*1024*1024;

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

dbconn(); 

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 (!empty(
$_POST['trailers']))
$trailersunesc($_POST['trailers']);  

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'] == '')
bark("No NFO!");

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");

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

if(
$_POST['strip'] == 'strip')
{
include 
'include/strip.php';
$descr preg_replace("/[^\\x20-\\x7e\\x0a\\x0d]/"" "$descr);
strip($descr);
}

$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!");

if (
$dict['value']['info']['value']['private']['value'] != 1)
{
bark('Multi-tracker/DHT torrents not allowed.');
}

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";
}
$info['value']['source']['type'] = "string";
$info['value']['source']['value'] = $SITENAME;
$info['value']['source']['strlen'] = strlen($info['value']['source']['value']);
$info['value']['private']['type'] = "integer";
$info['value']['private']['value'] = 1;
$dict['value']['info'] = $info;
$dict benc($dict);
$dict bdec($dict);
list(
$ann$info) = dict_check($dict"announce(string):info");

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


// Replace punctuation characters with spaces
if (($totallen $max_public_torrent_size) && (get_user_class() <  UC_USER)
stderr('Error - Maximum size of the upload for the class of user and power user is 800 mb','You want to become to uploader use this form .<br/><br/> <a href="uploadapp.php">Status of uploader here</a>.');
}

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

$pub = (get_user_class()<UC_UPLOADER) ? 'yes' 'no';

$nfo sqlesc(str_replace("\x0d\x0d\x0a""\x0d\x0a", @file_get_contents($nfofilename)));
$ret mysql_query("INSERT INTO torrents (search_text, filename, owner, visible, info_hash, name, size, numfiles, type, descr, ori_descr, category, save_as, added, last_action, nfo, trailers, poster) VALUES (" .
implode(","array_map("sqlesc", array(searchfield("$shortfname $dname $torrent"), $fname$CURUSER["id"], "no"$infohash$torrent$totallencount($filelist), $type$descr$descr$_POST["type"], $dname))) .
", '" get_date_time() . "', '" get_date_time() . "', $nfo, '".$trailers."', '".$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");

write_log("Torrent $id ($torrent) was uploaded by " $CURUSER["username"]);



/* 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>$SITENAME</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;
}
}
*******************/
$fp fopen("$torrent_dir/$id.torrent""w");
if (
$fp)
{
@
fwrite($fpbenc($dict), strlen(benc($dict)));
fclose($fp);
}
////////new torrent upload detail sent to shoutbox//////////
$text "New Torrent Uploaded ".htmlspecialchars($torrent)." please thank the uploader!!";
$userid "253";
$username "Tehroot Bot";
$date=time();
mysql_query("INSERT INTO shoutbox (userid, username, date, text) VALUES (" sqlesc($userid) . ", " sqlesc($username) . ", $date, " sqlesc($text) . ")") or sqlerr(__FILE____LINE__);

/////////////////////////////END///////////////////////////////////
mysql_query("UPDATE users SET uploaded = uploaded + 3221225472   WHERE id = "$CURUSER['id']);
header("Location: $BASEURL/details.php?id=".htmlspecialchars($id)."&uploaded=1");

?>
Reply With Quote
  #2  
Old 14th October 2008, 23:36
3v0 3v0 is offline
Senior Member
 
Join Date: Feb 2008
Netherlands
Posts: 88
Default
Try this on line 185

Code:
stdmsg("Sorry...", "Maximum size of the upload for the class of user and power user is 800 mb.<br>  You want to become to uploader use this form .<br><br> <a href="uploadapp.php">Status of uploader here</a>.)");
Reply With Quote
  #3  
Old 14th October 2008, 23:50
wMan wMan is offline
Banned
 
Join Date: Feb 2008
P2P
Posts: 1,433
Default
same thing
Code:
Parse error: syntax error, unexpected T_STRING in /home/tehrootc/public_html/takeupload.php on line 185

this nickys code is toss wtf

Upload failed!
Multi-tracker/DHT torrents not allowed.

Last edited by wMan; 14th October 2008 at 23:57.
Reply With Quote
  #4  
Old 14th October 2008, 23:57
pdq pdq is offline
TBDev BANNED Warrior
 
Join Date: Sep 2008
P2P
Posts: 46
Default
PHP Code:
if (($totallen $max_public_torrent_size) && (get_user_class() < UC_USER
should be
PHP Code:
if (($totallen $max_public_torrent_size) && (get_user_class() < UC_USER)) 
yay for syntax highlighting :)

=]
Reply With Quote
  #5  
Old 14th October 2008, 23:57
Dragan3591's Avatar
Dragan3591 Dragan3591 is offline
Senior Member
 
Join Date: Oct 2008
United States
Posts: 168
Default
Try this on line 185
PHP Code:
stderr("Error - Maximum size of the upload for the class of user and power user is 800 mb","You want to become to uploader use this form .<br/><br/> <a href="uploadapp.php">Status of uploader here</a>."); 
T_STRING is a language stuff
__________________
CLICK HERE FOR IMPORTANT NEWS FROM BVLIST!!

"Always do sober what you said you'd do drunk. That will teach you to keep your mouth shut."
Ernest Hemingway.

"A positive attitude will not solve all your problems, but it will annoy enough people to make it worth the effort."
Herm Albright.

Last edited by Dragan3591; 15th October 2008 at 00:00.
Reply With Quote
  #6  
Old 15th October 2008, 00:09
wMan wMan is offline
Banned
 
Join Date: Feb 2008
P2P
Posts: 1,433
Default
Code:
Parse error: syntax error, unexpected T_STRING in /home/tehrootc/public_html/takeupload.php on line 182

PHP Code:
<?

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!");
}

dbconn(); 

loggedinorreturn();

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

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

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


$f $_FILES["file"];
$fname unesc($f["name"]);
if (empty(
$fname))
    
bark("Empty filename!");

if (
$_POST['uplver'] == 'yes') {
$anonymous "yes";
$anon "Anonymous";
}
else {
$anonymous "no";
$anon $CURUSER["username"];
}

if (!empty(
$_POST['tube']))
$tube unesc($_POST['tube']);

$url $_POST["url"];

if (!empty(
$_POST['poster']))
$poster unesc($_POST['poster']);
$nfo '';
/////////////////////// NFO FILE ////////////////////////    
if(isset($_FILES['nfo']) && !empty($_FILES['nfo']['name'])) {
$nfofile $_FILES['nfo'];
if (
$nfofile['name'] == '')
  
bark("No NFO!");

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");

$nfo sqlesc(str_replace("\x0d\x0d\x0a""\x0d\x0a", @file_get_contents($nfofilename)));
}
/////////////////////// NFO FILE END /////////////////////


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

if(
$_POST['strip'] == 'strip')
{
    include 
'include/strip.php';
        
$descr preg_replace("/[^\\x20-\\x7e\\x0a\\x0d]/"" "$descr);
    
strip($descr);
}


$scene = ($_POST["scene"] != "no" "yes" "no");
$request = ($_POST["request"] != "no" "yes" "no");
$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_urls, 1))
//    bark("invalid announce url! must be <b>" . $announce_urls[0] . "</b>");

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";
}
$dict['value']['announce']=bdec(benc_str$announce_urls[0]));  // change announce url to local
$dict['value']['info']['value']['private']=bdec('i1e');  // add private tracker flag
$dict['value']['info']['value']['source']=bdec(benc_str"[$DEFAULTBASEURL$SITENAME")); // add link for bitcomet users
unset($dict['value']['announce-list']); // remove multi-tracker capability
unset($dict['value']['nodes']); // remove cached peers (Bitcomet & Azareus)
$dict=bdec(benc($dict)); // double up on the becoding solves the occassional misgenerated infohash
list($ann$info) = dict_check($dict"announce(string):info");
$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)));
$ret mysql_query("INSERT INTO torrents (search_text, filename, owner, visible, anonymous, request, scene, info_hash, name, url, tube, size, numfiles, type, descr, ori_descr, category, save_as, added, last_action, nfo, poster) VALUES (" .
        
implode(","array_map("sqlesc", array(searchfield("$shortfname $dname $torrent"), $fname$CURUSER["id"], "no"$anonymous$request$scene$infohash$torrent$url$tube$totallencount($filelist), $type$descr$descr$_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();
if (
$catid == '17')
  {
    
$dt sqlesc(get_date_time());
    
$comment sqlesc("Please do not request or post links to cracks or serials. Doing so will get you warned! Thank You //Staff\n");
    
mysql_query("INSERT INTO comments (user, torrent, added, text) VALUES(0, $id$dt$comment)") or sqlerr(__FILE____LINE__);
  }
@
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].")");
}

$fp fopen("$torrent_dir/$id.torrent""w");
if (
$fp)
{
        @
fwrite($fpbenc($dict), strlen(benc($dict)));
    
fclose($fp);
}
//===add karma
mysql_query("UPDATE users SET seedbonus = seedbonus+15.0 WHERE id = $CURUSER[id]") or sqlerr(__FILE____LINE__);
//===end
write_log("Torrent $id ($torrent) was uploaded by " $CURUSER["username"]);



/* 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>Super-inferno.com</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;
  }
}
*******************/
////////new torrent upload detail sent to shoutbox//////////
$text "New Torrent Uploaded ".htmlspecialchars($torrent)." please thank the uploader!!";
$userid "253";
$username "Tehroot Bot";
$date=time();
mysql_query("INSERT INTO shoutbox (userid, username, date, text) VALUES (" sqlesc($userid) . ", " sqlesc($username) . ", $date, " sqlesc($text) . ")") or sqlerr(__FILE____LINE__);

/////////////////////////////END///////////////////////////////////
mysql_query("UPDATE users SET uploaded = uploaded + 3221225472   WHERE id = "$CURUSER['id']);
header("Location: $BASEURL/oki.php?action=signup&id=".htmlspecialchars($id)."");


?>
Reply With Quote
  #7  
Old 15th October 2008, 00:19
Dragan3591's Avatar
Dragan3591 Dragan3591 is offline
Senior Member
 
Join Date: Oct 2008
United States
Posts: 168
Default
OK, either I copied this wrong or something is bad but my line 182 is }
__________________
CLICK HERE FOR IMPORTANT NEWS FROM BVLIST!!

"Always do sober what you said you'd do drunk. That will teach you to keep your mouth shut."
Ernest Hemingway.

"A positive attitude will not solve all your problems, but it will annoy enough people to make it worth the effort."
Herm Albright.
Reply With Quote
  #8  
Old 15th October 2008, 00:27
Subzero's Avatar
Subzero Subzero is offline
Coder
 
Join Date: Jul 2008
P2P
Posts: 190
Default
try this clock man
Code:
<?

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!");
}

dbconn();

loggedinorreturn();

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

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

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


$f = $_FILES["file"];
$fname = unesc($f["name"]);
if (empty($fname))
bark("Empty filename!");

/*if ($_POST['uplver'] == 'yes') {
$anonymous = "yes";
$anon = "Anonymous";
}
else {
$anonymous = "no";
$anon = $CURUSER["username"];
}
*/
if (!empty($_POST['tube']))
$tube = unesc($_POST['tube']);

$url = $_POST["url"];

if (!empty($_POST['poster']))
$poster = unesc($_POST['poster']);
$nfo = '';
/////////////////////// NFO FILE ////////////////////////
if(isset($_FILES['nfo']) && !empty($_FILES['nfo']['name'])) {
$nfofile = $_FILES['nfo'];
if ($nfofile['name'] == '')
bark("No NFO!");

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");

$nfo = sqlesc(str_replace("\x0d\x0d\x0a", "\x0d\x0a", @file_get_contents($nfofilename)));
}
/////////////////////// NFO FILE END /////////////////////


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

if($_POST['strip'] == 'strip')
{
include 'include/strip.php';
$descr = preg_replace("/[^\\x20-\\x7e\\x0a\\x0d]/", " ", $descr);
strip($descr);
}


$scene = ($_POST["scene"] != "no" ? "yes" : "no");
$request = ($_POST["request"] != "no" ? "yes" : "no");
$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 (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";

$dict['value']['announce']=bdec(benc_str( $announce_urls[0])); // change announce url to local
$dict['value']['info']['value']['private']=bdec('i1e'); // add private tracker flag
$dict['value']['info']['value']['source']=bdec(benc_str( "[$DEFAULTBASEURL] $SITENAME")); // add link for bitcomet users
unset($dict['value']['announce-list']); // remove multi-tracker capability
unset($dict['value']['nodes']); // remove cached peers (Bitcomet & Azareus)
$dict=bdec(benc($dict)); // double up on the becoding solves the occassional misgenerated infohash
list($ann, $info) = dict_check($dict, "announce(string):info");
$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)));
$ret = mysql_query("INSERT INTO torrents (search_text, filename, owner, visible, anonymous, request, scene, info_hash, name, url, tube, size, numfiles, type, descr, ori_descr, category, save_as, added, last_action, nfo, poster) VALUES (" .
implode(",", array_map("sqlesc", array(searchfield("$shortfname $dname $torrent"), $fname, $CURUSER["id"], "no", $anonymous, $request, $scene, $infohash, $torrent, $url, $tube, $totallen, count($filelist), $type, $descr, $descr, 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();
if ($catid == '17')
{
$dt = sqlesc(get_date_time());
$comment = sqlesc("Please do not request or post links to cracks or serials. Doing so will get you warned! Thank You //Staff\n");
mysql_query("INSERT INTO comments (user, torrent, added, text) VALUES(0, $id, $dt, $comment)") or sqlerr(__FILE__, __LINE__);
}
@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].")");
}

$fp = fopen("$torrent_dir/$id.torrent", "w");
if ($fp)
{
@fwrite($fp, benc($dict), strlen(benc($dict)));
fclose($fp);
}
//===add karma
mysql_query("UPDATE users SET seedbonus = seedbonus+15.0 WHERE id = $CURUSER[id]") or sqlerr(__FILE__, __LINE__);
//===end
write_log("Torrent $id ($torrent) was uploaded by " . $CURUSER["username"]);



/* 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>Super-inferno.com</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;
}
}
*******************/
////////new torrent upload detail sent to shoutbox//////////
$text = "New Torrent Uploaded ".htmlspecialchars($torrent)." please thank the uploader!!";
$userid = "253";
$username = "Tehroot Bot";
$date=time();
mysql_query("INSERT INTO shoutbox (userid, username, date, text) VALUES (" . sqlesc($userid) . ", " . sqlesc($username) . ", $date, " . sqlesc($text) . ")") or sqlerr(__FILE__, __LINE__);

/////////////////////////////END///////////////////////////////////
mysql_query("UPDATE users SET uploaded = uploaded + 3221225472 WHERE id = ". $CURUSER['id']);
header("Location: $BASEURL/oki.php?action=signup&id=".htmlspecialchars($id)." ");


?>

Last edited by Subzero; 15th October 2008 at 00:31.
Reply With Quote
  #9  
Old 15th October 2008, 16:47
wMan wMan is offline
Banned
 
Join Date: Feb 2008
P2P
Posts: 1,433
Default
Code:
Parse error: syntax error, unexpected $end in /home/tehrootc/public_html/takeupload.php on line 330
still pants
Reply With Quote
  #10  
Old 11th June 2009, 02:56
ratza ratza is offline
Senior Member
 
Join Date: Jun 2009
P2P
Posts: 21
Default i know
sorry for my english...i had the same problem today ....you must pu "#" .This is the corect code:
#if (!in_array($ann, $announce_urls, 1))
#bark("invalid announce url! must be <b>" . $announce_urls[0] . "</b>");

you don't have the # before the bark code ;)) at me is puted before the "if" word to,but i saw that it doesn't matter there ,just the begining of the bark word.hope that i helped you
Reply With Quote
Reply

Tags
error , upload

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
Upload error bob2012 Template Shares 1 29th January 2010 21:49
Upload Error Extreme86 TBDev 2 11th January 2010 00:48
Upload error, Fatal error TKO Template Shares 5 14th February 2009 02:23
TS 1.3.9 upload error... matrixismyname Template Shares 12 4th January 2009 00:35
Upload error HelixiR BT.Manager (phpMyBitTorrent) 3 22nd December 2008 12:21



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