Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
User Posts

Go to Profile

TraderScrape (beta). As sites out there evolve, so so their need for accurate and stable stats. I never had this working before, while relying on the old mega-scrape.php, which was awful most of the time, so I scrapped it and utilized a fairly new class updated just 7 months ago via Github. Toss out mega-scrape.

It checks the torrent ID against the torrent's announce URL in torrent table, scrapes that URL & upon success => stores to database.

Supports UDP, HTTP, HTTPS, IP trackers.

What it's doing:

[color=rgb(226, 80, 65)]yoursite.com/[/color][color=rgb(0, 168, 133)]trader-scrape.php?id=[/color][color=rgb(41, 105, 176)]ID_OF_CURRENT_TORRENT_PAGE[/color]

Create trader-scrape.php and upload to root /

POST - AJAX call - Scrape class, DB update : id

<?
// AJAX Torrent Scrape - Update Stats - BETA - May 19, 2020
// Public torrents only / UDP, HTTPS, HTTP
// Takes POST by torrent ID via AJAX call, scrapes announce in torrent table
// with much better class and logic, and updates seeders/leechers in database by ID

require_once 'backend/functions.php';
$torrentid = isset($_GET['id'])?intval($_GET['id']):0; // Get torrent ID ?id=
$limit     = 1;
$dsn       = 'mysql:dbname=database;host=localhost;charset=utf8';
$user      = 'username';
$password  = 'password';
$torrentid = $_GET['id'];
try {
   $conn = new PDO($dsn, $user, $password);
   $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
   $conn->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
}
catch (PDOException $e) {
   die('Unable to connect to database');
}
$stmt = $conn->prepare("SELECT id, announce, info_hash FROM torrents WHERE external = 'yes' AND id = :torrentid LIMIT 1");
$stmt->bindValue(':torrentid', $torrentid, PDO::PARAM_INT);
$stmt->execute();
class ScraperException extends Exception
{
   private $connectionerror;
   public function __construct($message, $code = 0, $connectionerror = false)
   {
       $this->connectionerror = $connectionerror;
       parent::__construct($message, $code);
   }
   public function isConnectionError()
   {
       return ($this->connectionerror);
   }
}
abstract class tscraper
{
   protected $timeout;
   public function __construct($timeout = 2)
   {
       $this->timeout = $timeout;
   }
}
class udptscraper extends tscraper
{
   public function scrape($url, $infohash)
   {
       if (!is_array($infohash)) {
           $infohash = array(
               $infohash
           );
       }
       foreach ($infohash as $hash) {
           if (!preg_match('#^[a-f0-9]{40}$#i', $hash)) {
               throw new ScraperException('Invalid infohash: ' . $hash . '.');
           }
       }
       if (count($infohash) > 74) {
           throw new ScraperException('Too many infohashes provided.');
       }
       if (!preg_match('%udp://([^:/]*)(?::([0-9]*))?(?:/)?%si', $url, $m)) {
           throw new ScraperException('Invalid tracker url.');
       }
       $tracker        = 'udp://' . $m[1];
       $port           = isset($m[2]) ? $m[2] : 80;
       $transaction_id = mt_rand(0, 65535);
       $fp             = fsockopen($tracker, $port, $errno, $errstr);
       if (!$fp) {
           throw new ScraperException('Could not open UDP connection: ' . $errno . ' - ' . $errstr, 0, true);
       }
       stream_set_timeout($fp, $this->timeout);
       $current_connid = "\x00\x00\x04\x17\x27\x10\x19\x80";
       $packet         = $current_connid . pack("N", 0) . pack("N", $transaction_id);
       fwrite($fp, $packet);
       $ret = fread($fp, 16);
       if (strlen($ret) < 1) {
           throw new ScraperException('No connection response.', 0, true);
       }
       if (strlen($ret) < 16) {
           throw new ScraperException('Too short connection response.');
       }
       $retd = unpack("Naction/Ntransid", $ret);
       if ($retd['action'] != 0 || $retd['transid'] != $transaction_id) {
           throw new ScraperException('Invalid connection response.');
       }
       $current_connid = substr($ret, 8, 8);
       $hashes         = '';
       foreach ($infohash as $hash) {
           $hashes .= pack('H*', $hash);
       }
       $packet = $current_connid . pack("N", 2) . pack("N", $transaction_id) . $hashes;
       fwrite($fp, $packet);
       $readlength = 8 + (12 * count($infohash));
       $ret        = fread($fp, $readlength);
       if (strlen($ret) < 1) {
           throw new ScraperException('No scrape response.', 0, true);
       }
       if (strlen($ret) < 8) {
           throw new ScraperException('Too short scrape response.');
       }
       $retd = unpack("Naction/Ntransid", $ret);
       if ($retd['action'] != 2 || $retd['transid'] != $transaction_id) {
           throw new ScraperException('Invalid scrape response.');
       }
       if (strlen($ret) < $readlength) {
           throw new ScraperException('Too short scrape response.');
       }
       $torrents = array();
       $index    = 8;
       foreach ($infohash as $hash) {
           $retd             = unpack("Nseeders/Ncompleted/Nleechers", substr($ret, $index, 12));
           $retd['infohash'] = $hash;
           $torrents[$hash]  = $retd;
           $index            = $index + 12;
       }
       return ($torrents);
   }
}
try {
   $timeout = 2;
   $scraper = new udptscraper($timeout);
   while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
       $ret = $scraper->scrape($row['announce'], $row['info_hash']);
   }
   foreach ($ret as $key => $value) {
       $stmt = $conn->prepare("UPDATE torrents SET leechers='" . $value['leechers'] . "', seeders='" . $value['seeders'] . "', times_completed='" . $value['completed'] . "', last_action='" . get_date_time() . "', visible='yes' WHERE id = :torrentid");
       $stmt->bindValue(':torrentid', $torrentid, PDO::PARAM_INT);
       $stmt->execute();
   }
}
catch (ScraperException $e) {
   echo ('Error: ' . $e->getMessage() . "<br />\n");
   echo ('Connection error: ' . ($e->isConnectionError() ? 'yes' : 'no') . "<br />\n");
}
?>


Create get-torrent-stats.php and upload to root /

GET (JSON) - AJAX call [seeders], [leechers] : id

<?
// AJAX Torrent Scrape - Get Stats - BETA - May 19, 2020
// Include database
$dsn       = 'mysql:dbname=database;host=localhost;charset=utf8';
$user      = 'username';
$password  = 'password';
$torrentid = isset($_GET['id'])?intval($_GET['id']):0; // Get torrent ID ?id=
try {
   $conn = new PDO($dsn, $user, $password);
   $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
   $conn->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
}
catch (PDOException $e) {
   die('Unable to connect to database');
}
$limit = 1;
$stmt = $conn->prepare("SELECT id, seeders, leechers FROM torrents WHERE id = :torrentid LIMIT :datalimit");
$stmt->bindParam(":datalimit", $limit, PDO::PARAM_INT);
$stmt->bindParam(":torrentid", $torrentid, PDO::PARAM_INT);
$stmt->execute();
$userData = array();
if ($stmt->rowCount() > 0) {
   $usersactive = $stmt->fetchAll(PDO::FETCH_ASSOC);
   foreach ($usersactive as $row => $data) {
       $data['seeders']      = $row['seeders'];
       $data['leechers']     = $row['leechers'];
       array_push($userData, $usersactive);
   }
}
echo json_encode($usersactive, JSON_UNESCAPED_SLASHES);
?>


add to header.php after jQuery


<? if (stripos($_SERVER['PHP_SELF'],'torrents-details.php') && $CURUSER) { ?>
<script>
// Get peer data
function fetchPeerData() {
   $(document).ready(function () {
       $.ajax({
           url: "get-torrent-stats.php?id=<?=$id; ?>",
           method: "GET",
           dataType: 'JSON',
           success: function (data) {
               var html_to_append = '';
               $.each(data, function (i, item) {
                   html_to_append +=
                       '<div style="float:right"><span id="peers-updated"></span><span style="text-align:right;font-size:25px;color:#2E8B57">' +
                       item.seeders +
                       '</span><span style="text-align:right;font-size:25px;color:#C0C0C0;padding-left:10px;padding-right:5px">/</span><span style="text-align:right;font-size:18.75pt;color:#DC143C">' +
                       item.leechers +
                       '</span></div>';
               });
               $("#updated-stats").html(html_to_append);
               $("#animate").toggleClass('flip');
               $("#peers-updated").html("Peers updated").delay(1000).fadeIn().delay(2000).fadeOut();
           }
       });
   });

// Update peer data
$(document).ready(function() {
       $.ajax({
           url: "trader-scrape.php?id=<?=$id; ?>",
           method: "POST",
           success: function (data) {
               $("#peers-updated").html("Peers updated").delay(1000).fadeIn().delay(2000).fadeOut();
           }
       });
});

}
fetchPeerData();
setInterval(function () {
   fetchPeerData()
}, 15000); // Update peer data every 15 sec on viewing torrent

<?
   }
?>
</script>


Now place this anywhere you want on torrents-details.php - seed & peer data automatically scrapes and updates while browsing torrent-details.php and shows the dynamic count in the HTML below.

Leaves all the guess work out, and keep stats up to date on public trackers, it updates itself every 15 seconds or as any user views a torrent and their duration for that ID. If you don't have a good server, enough of these taxing calls on the CPU will get the best of you, just a notice.

<div id="updated-stats"></div>
You can insert a dummy INT into it, as its only determining file count (not a big deal for debugging query). These can be changed all the time in torrents table, its just the upload step.
Assuming your using the updated mega-upload, follow query similar to:

SELECT * FROM table_name WHERE id >= 3 ORDER BY id ASC

Go to the desired page, note the first ID and the last ID on page.
try before your query

var_dump($filecount);


$filecount is not returning a correct int value to SQL query.
Memcached? Pager not working as results are dynamic.
"m-jay, post: 68578, member: 20288":

Nice mod m8, some would advise to escape but at a glance I dont think its necessary.
You should be able to trust the bots input it's just collecting data from cleanup


Much of the code has been reduced and improved. Once a final touch and a day to see it collect and post, I should know its all working as expected, then post ZIP.
Just a place to compile changes and release to "completed mods".

What this does:

It utilizes /backend/cleanup.php to trigger message events to the Shoutbox. While cleanup performs the same, it pushes updates to the Shoutbox too, such as:

- Total seeders today (private torrents)
- We have 27 comments on 33 torrents today
- Cleaning peers. Stale for 15 minutes.
- Auto Leech has been warned for Username
- Auto Leech ban has been lifted for Username
- There are 16 peers on the tracker today

Thats what I have so far, keeping in mind this is important so your shoutbox doesn't become bombed:

$site_config['autoclean_interval']         = '300'; // 300 = 5 minutes (seconds)


Seems to be "okay", but still too often. Adjust this config to reduce the hammering of tracker updates. Set to 5 minutes. Use google to calculate minutes to seconds.

So I assigned the "user" of shout to be a Bot account made and restricted for just this. Works well. Another UNIT3D rip.
I'm surprised this wasn't default functionality. Seems to be the way on modern sites.

Open /backend/cleanup.php

Find:

$res = SQL_Query_exec("SELECT torrent, seeder, COUNT(*) AS c FROM peers GROUP BY torrent, seeder");

Add under:

// Send to Shoutbox - Total seeders today
$getcount = mysql_fetch_assoc($res);
$seeders = $getcount["c"];
$event = "There are $seeders Private Seeders Today!";
SQL_Query_exec("INSERT INTO shoutbox (msgid, user, message, date, userid) VALUES (NULL, 'NerbBot', '$event', NOW(), 0)");

Find:

$res = SQL_Query_exec("SELECT torrent, COUNT(torrent) as c FROM comments WHERE torrent > 0 GROUP BY torrent");

Add under:

// Send to Shoutbox - Total comments posted
$getcount = SQL_Query_exec("SELECT COUNT(torrent) as c FROM comments");
$restotal = mysql_fetch_assoc($getcount);
$commcount = $restotal["c"];
$event = "Currently there are $commcount comments posted";
SQL_Query_exec("INSERT INTO shoutbox (msgid, user, message, date, userid) VALUES (NULL, 'NerbBot', '$event', NOW(), 0)");

Find:

SQL_Query_exec("UPDATE torrents SET visible='no' WHERE visible='yes' AND last_action < FROM_UNIXTIME($deadtime) AND seeders = '0' AND leechers = '0' AND external !='yes'");

Add under:

// Send to Shoutbox Bot - May 15, 2020
$thedate = time_ago($site_config["max_dead_torrent_time"]);
$logged = str_replace('ago', '', $thedate);
$event = "Torrent dead for $logged Sending to graveyard.";
SQL_Query_exec("INSERT INTO shoutbox (msgid, user, message, date, userid) VALUES (NULL, 'NerbBot', '$event', NOW(), 0)");

Find:

SQL_Query_exec("INSERT INTO messages (sender, receiver, added, msg, poster, subject) VALUES ('0', '".$arr["id"]."', '".$timenow."', '".$reason."', '0', 'Warning: Poor Ratio')");

Add under:

// Send to Shoutbox - Low ratio warning
$warneduser = $arr["username"];
$event = "Auto Leech warning has been added for $warneduser";
SQL_Query_exec("INSERT INTO shoutbox (msgid, user, message, date, userid) VALUES (NULL, 'NerbBot', '$event', NOW(), 0)");


I believe SQL escape is in order - advise?

Now you need to make an account dedicated for this, use the username you want and modify the INSERT statements --- or just register with NerbBot as username.
@testers - changes coming to script. Also, its pending usability updates.

Current issue: redirect to torrents-details.php breaks layout and cascaded the page over itself. I've tried every routine, and the closed I've been is a naked form from torrents-details.php & its still less than ideal. It is fixed to the centre of the page and scrolling is a nightmare, its been repeated visits to stack overflow.

Solution above works but no true redirect in url. window.open _parent outside of response condition is as close as this gets, and you get no ID.
Script does not parse file size correctly, bytes are wrong, reads metafile size instead.
Script does not retrieve primary/backup trackers from .torrent - big issue

Only so much i can do on my end, can someone port this into their project and post torrents? What is your success? Speed? Parsing?
Long Load time — 2020-05-13 21:36:14 in M-BiTsy Support
That’s still slow as far as UX goes. 3 seconds?

that my.cnf is crafted by IT smarties, I wouldn’t modify existing #UPD values, either unpredictable performance or mysqld will fail to start.

Everything else will point to web hosting latency or latency on local host. XAMPP has caused me issues that my server has never reproduced so that’s something to consider as well.

Packages like XAMPP, are heavily modified for portability and compatibility.
Long Load time — 2020-05-12 13:47:34 in M-BiTsy Support
Check your logs, there are many many different variables at play here. I know my box really well, but only due to things like this so I can just suggest solutions to my own trials.

Things to note:

SSL takes a lot of CPU per every 2 way request handshake. I see it daily on my end, but is necessary.

Apache is also a bloat. Often, without option (hosting, etc).

Review your MPM worker. Probably prefork (default installation), which processes requests a lot slower.

If not, you really should switch to PHP-FPM (FastCGI), automate the service daemon. I enabled this a week ago and the parsing performance does not even compare too before (before new hardware). Threads are your friend (CPU/OS).

It uses a closed local proxy to send requests to the event workers. Very fast execution of PHP.
I could go on and on.. lol
Anyone know flutter? — 2020-05-12 13:25:17 in General Chat
Something I’m considering eventually, what ever came of this?
— 2020-05-12 07:44:14 in
border-radius is awesome. I use a default of 5px all around on things. box-shadow and border-radius are my two favourites lol
Long Load time — 2020-05-12 07:37:02 in M-BiTsy Support
Try backing up your current my.cnf (locate on server), copy it over to client side for safe keeping, next give this a go. I wouldn't rely on index.php (root) reports if that is using DNS (your domain), as it is simply a channel to reach functions.php and from there everything happens. I would assume some report intelligence using localhost / ports - XAMPP, etc

[URL unfurl="true"]https://gist.github.com/fevangelou/fb72f36bbe333e059b66[/url]

I switched to that exclusively after replacing MySQL 5.7 to MariaDB 12.4, performance was a big win. Everything else required personal hardware investment.
Long Load time — 2020-05-12 03:13:32 in M-BiTsy Support
Do you have SSH access? run top -P

look for mysqld process, what is the CPU and threads for that process? Using FastCGI (aka PHP-FPM / event-MPM)? Look for the php-fpm processes. Static or shared modules?

Unless Apache saw a new conf/modifications recently, it will always be mysqld that will suck your CPU like a 5 dollar prostitute. This is was a 2 week battle just ending last Friday, so I know this issue well. I don't use these releases, but they all follow the same path so with no issues so check your OS and whats going on there first.

Next, will be your queries, and quite honestly it could be loaded modules too that are unused.
"shadows, post: 68555, member: 20311":

After successful ajax request, include window.location.href = '/torrents-edit.php?id=<?= mysqli_insert_id() ?>';
Set redirect in json to be true.

 success: function(data) {
       if (data.redirect == true) {
           // data.redirect contains the string URL to redirect to
           window.location.href = '/torrents-edit.php?id=<?= mysqli_insert_id() ?>';
       }


Wow thank you, that worked perfect! Both security and redirect changes.  :LOL:
— 2020-05-11 23:00:38 in
.list-group-item - you may want to imply list-style property for nested child/parent elements, like <ul><li> to respect viewport/mobile within container.

border: 10px solid - Will translate to border: 0 a lot of the time on different browsers, try 10px solid transparent
to satisfy different engines (Webkit, Gecko, etc).

Things can be crunched down a bit, like


.newtd {
   background:  linear-gradient(to bottom, #072F5F, #3895D3), -webkit-linear-gradient(top, #072F5F, #3895D3) rgba(255, 255, 255, 1) repeat-x
}


Each CSS rule block, with the last one ending before } does not need to be closed ever with ;
Only the previous rule following the next one, single rules can also be ignored for closing, as it visually improves CSS. RGBA is always better, its picked up better on mobile as well.

Try this to convert hex values to RGBA - http://hex2rgba.devoth.com

You can also group things like above separating by a comma, as the scripting engine already knows. Stuff for who may want to develop themes for this.
"shadows, post: 68551, member: 20311":

Looks fancy and way better organized than the default torrent upload, but this requires serious sanitization and security checks.

Here's some suggestions:
1. Use $_SERVER['REQUEST_METHOD'] === 'POST' to verify that request is indeed a post.
2. Use require instead of require_once.
3. if (is_array($_FILES['torrent'])) should be moved as a separate if/else security measure.

$error = '';
// If/else checkings
if (!is_array($_FILES['torrent']))
{
    $error = 'The file contains no array';
}
elseif (empty($_FILES['torrent']))
{
    $error = 'You did not select a torrent file';
}
//Proceed with uploading if no errors are met.
if ($error === '')
{
$insert = $db->query("INSERT INTO torrents (filename, owner, name, descr,  image1, image2, category, added, info_hash, size, numfiles, save_as, announce, external, nfo, torrentlang, anon, last_action)
       VALUES ('" . $torr_saveas . "', " . sqlesc($userid) . ", '" . $torr_name . "', 'Torrent POST description', 'image1', 'image2', 1, '" . get_date_time() . "', '" . $torr_hash . "', '" . $torr_size . "', 3, '" . $torr_name . "', '" . $torr_announce . "', '" . $torr_private . "', 'no', 1, 'no', '" . get_date_time() . "')");
die;
}
else
{
die($error);
}



Great, will make those changes. The script has now a header redirect in the PHP code, which grabs the inserted ID using mysqli_insert_id(), but the problem is its difficult getting the browser to follow redirect response codes from PHP over to JS to tell the browser what to do. So a redirect to torrents-edit.php?id=5 to continue filling the rest of the fields out isn't possible atm.
I'll be adding this to jQuery pretty quick, but put this here as I improve (add form fields, etc).

So when called by AJAX/POST, this  will upload a .torrent from browse, and automatically parse & after parsing passes, inserts the data to the database.
Same idea as torrents-upload.php but not at all. Similar in some ways in terms of the parsing routines. This is a very good PHP class, and should be used by my opinion.

Works really well for me, and has worked on every torrent file I've thrown at it so far.

Testers
Send a file POST request to /ajax/ajax_ajax_torrent_upload.php

<form id="form-torupload" action="/ajax/ajax_torrent_upload.php" method="post" enctype="multipart/form-data">
   <input type="file" accept=".torrent" name="torrent" />
<input type="hidden" name="userid" value="<?php echo $CURUSER["id"]; ?>" required />
</form>
<!-- Status -->
<div id="err"></div>
<!-- Feedback -->
<div id="preview-torrent"></div>

[color=rgb(226, 80, 65)]<form id="form-torupload"[/color] will call jQuery and make the request. Otherwise, will post through form.
[color=rgb(226, 80, 65)]<div id="preview-torrent"></div>[/color] will return the message response (data : success, else .. ) via FadeIn(), FadeOut() using set intervals.
[color=rgb(226, 80, 65)]<div id="err"></div>[/color] will return the POST response (data : success, else .. ) via FadeIn(), FadeOut() using set intervals.
Instructions
Create as /ajax/ajax_torrent_upload.php

<?php
/*
AJAX Torrent Uploading - Using Parsing class - Torrent()->object()
Replaces old torrents-upload.php and related classes: BDecode(), BEncode()
Triggered by AJAX call. Accepts .torrent, parses data and builds array, inserts to DB.

https://www.phpclasses.org/package/4896-PHP-Create-and-parse-Torrent-files.html
*/
error_reporting(E_ALL);
if ($_SERVER['REQUEST_METHOD'] === 'POST' && !empty($_FILES['torrent'])) {
   $uploadedFile = $_FILES['torrent']['tmp_name'];
   $dirPath      = "../uploads/";
   $ext          = pathinfo($_FILES['torrent']['name'], PATHINFO_EXTENSION);
   move_uploaded_file($uploadedFile, '../uploads/' . $_FILES["torrent"]['name']);
   $dbHost     = 'localhost';
   $dbUsername = 'username';
   $dbPassword = 'password';
   $dbName     = 'database';
   $db         = new mysqli($dbHost, $dbUsername, $dbPassword, $dbName);
   $userid     = isset($_POST['userid']) ? intval($_POST['userid']) : 0;
   $name       = $_FILES["torrent"]['name'];
   require('../backend/functions.php');
   require('parse.class.php');
   $torrent       = new Torrent("../uploads/$name");
   $torr_hash     = $torrent->hash_info();
   $torr_announce = $torrent->announce('http://tracker2.itzmx.com:6961/announce'); // Alternative tracker
   $torr_size     = $torrent->size();
   $torr_saveas   = $torrent->name();
   $torr_private  = $torrent->is_private() ? 'yes' : 'no';
   // Prep for form fields - input type = text, name = "torrentname"
   if (!empty($_POST['torrentname'])) {
       $torr_name = $_POST['torrentname'];
   } else {
       $torr_name = str_replace('.torrent', '', $torrent->name());
   }
   $error = '';
   // Check upload
   if (!is_array($_FILES['torrent'])) {
       $error = 'The file contains no array';
   } elseif (empty($_FILES['torrent'])) {
       $error = 'You did not select a torrent file';
   }
   // Proceed if no error
   if ($error === '') {
       $insert  = $db->query("INSERT INTO torrents (filename, owner, name, descr, image1, image2, category, added, info_hash, size, numfiles, save_as, announce, external, nfo, torrentlang, anon, last_action)
       VALUES ('" . $torr_saveas . "', " . sqlesc($userid) . ", '" . $torr_name . "', 'Torrent Description.', ''image1', 'image2', 1, '" . get_date_time() . "', '" . $torr_hash . "', '" . $torr_size . "', 3, '" . $torr_name . "', '" . $torr_announce . "', '" . $torr_private . "', 'no', 1, 'no', '" . get_date_time() . "')");
       $edit_id = mysqli_insert_id($db);
       mysqli_close($db);
       header("Location: " . $site_config["SITEURL"] . "/torrents-edit.php?id=" . $edit_id);
       die;
   } else {
       die($error);
   }
} else {
   echo 'Invalid request.';
}
?>


(jQuery) add to header.php

$(document).ready(function (e) {
   $("#form-torupload").on('change', (function (e) {
       e.preventDefault();
       $.ajax({
           url: "/ajax/ajax_torrent_upload.php",
           type: "POST",
           data: new FormData(this),
           contentType: false,
           cache: false,
           processData: false,
           beforeSend: function () {
               $("#preview-torrent").html("Uploading torrent...").delay(4000).fadeOut().delay(4000).fadeIn();
               $("#preview-torrent").fadeIn();
               $("#err").fadeOut();
           },
           success: function (data) {    
               if (data.redirect == true) {        
                  // Redirect to torrent editor
                  window.location.href = '/torrents-edit.php?id=<?= mysqli_insert_id(); ?>';
               }
               if (data == 'invalid') {
                   // Invalid format
                   $("#err").html("Invalid torrent!").fadeIn();
               } else {
                   $("#preview-torrent").fadeOut();
                   $("#updated-torrent").html("Torrent has been uploaded. Refresh to see all changes.").delay(1000).fadeIn().delay(2000).fadeOut();
               }
           },
           error: function (e) {
               $("#err").html(e).fadeIn();
           }
       });
   }));
});


Upload parse.class.php to /ajax/

Now in full working state, I will begin to push to jQuery and rework code to PDO.

** Note: Due to lack of <form> fully designed yet, things like category and language are at a default value of 1

In action on my end

[ATTACH type="full" alt="Tooltip.png"]5516[/ATTACH]


Green button triggers hidden file input that brings up the browse, and upon "onchange" the torrent is uploaded and torrent appears in same moment on homepage no refresh. Lots of things you can do with it. This is using Tooltipsy plugin.
Do you want me to merge into a new file using that code you posted? As you are custom HTML as myself

function where($where)
{
   $where                          = substr($where, 1);
   $files['torrents-upload.php/']  = 'Uploading Torrent';
   $files['torrents-details.php/'] = 'Viewing Torrent ID ' . $_GET["id"];
   $files['account.php/']          = 'Viewing Account';
   $files['torrents-search.php/']  = 'Searching Torrents: ' . $_GET["search"];
   $files['forums.php/']           = 'Browsing Forums';
   $files['mailbox.php/']          = 'Viewing Messages';
   $files['comments.php']          = 'Viewing Comments';
   $files['bookmarks.php']         = 'Viewing Bookmarks';
   $files['download.php/']         = 'Downloaded Torrent ' . $_GET["name"];
   $files['faq.php/']              = 'Reading FAQ';
   $files['friends.php/']          = 'Viewing Friends';
   $files['admincp.php']           = 'Managing Admin Panel';
   $files['torrents.php/']         = 'Browsing Torrents';
   $files['tags/']                 = 'Browsing Tags: ' . $_GET["search"];
   $result                         = null;
   foreach ($files as $file => $descr) {
       if (0 === strpos($where, $file)) {
           $result = urldecode($descr);
           break;
}
}
   if ($result === null) {
       $result = sprintf('Browsing Homepage %s', $where);
   }
   return $result;
   SQL_Query_exec("UPDATE users SET last_access='" . get_date_time() . "', page=" . sqlesc($where) . " WHERE id=" . $userid);
}


Update loggedinonly()

function loggedinonly() {
   global $CURUSER;
   if (!$CURUSER) {
       header("Refresh: 0; url=" . $site_config["SITEURL"] . "/account-login.php?returnto=" . urlencode($_SERVER["REQUEST_URI"]));
       exit();
   }
}
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 3
  • Members: 0
  • Guests online: 3
  • Comments: 3
  • Messages: 1,728