function DISPLAY_show_torrent($torrent) { if (!($link = db_init(true))) { break; } $result = mysqli_query($link, 'SELECT * FROM `users` WHERE `id`=' . mysqli_real_escape_string($link, $torrent['uploader']) . ';'); $uploader = @mysqli_fetch_all($result, MYSQLI_ASSOC)[0]; $uploader = is_array($uploader) ? $uploader['username'] : '******'; mysqli_free_result($result); mysqli_close($link); unset($link); echo '<tr>'; echo '<td><a href="info.php?id=' . $torrent['id'] . '"><b>' . $torrent['torrentname'] . '</b></a></td>'; echo '<td><a href="user.php?id=' . $torrent['uploader'] . '"><i>' . $uploader . '</a></i></td>'; echo '<td>' . getHumanDate(new DateTime($torrent['created']), new DateTime(date('Y-n-d H:i:s', time()))) . '</td>'; echo '<td>' . getHumanFilesize(getTorrent(unserialize(_CONFIG)['torrents']['dir'] . DIRECTORY_SEPARATOR . $torrent['filename'] . '.torrent')->size()) . '</td>'; echo '<td>' . $torrent['downloads'] . '</td>'; echo '<td><font color="green">TBD</font></td>'; echo '<td><font color="blue">TBD</font></td>'; echo '</tr>'; }
break; } mysqli_free_result($result); $result = mysqli_query($link, 'SELECT * FROM `users` WHERE `id`=' . mysqli_real_escape_string($link, $torrent['uploader']) . ';'); $user = @mysqli_fetch_all($result, MYSQLI_ASSOC)[0]; if (!empty($result)) { mysqli_free_result($result); } $result = mysqli_query($link, 'SELECT * FROM `comments` WHERE `on`=' . mysqli_real_escape_string($link, $id) . ' ORDER BY `id` DESC, `created` DESC;'); $comments = @mysqli_fetch_all($result, MYSQLI_ASSOC); if (!empty($result)) { mysqli_free_result($result); } mysqli_close($link); unset($link); $explode = getTorrent(unserialize(_CONFIG)['torrents']['dir'] . DIRECTORY_SEPARATOR . $torrent['filename'] . '.torrent'); $CURRENT_PAGE = 'Info'; $PAGE_TITLE = PAGE_DEFAULT_TITLE . ' | ' . $explode->name(); require_once 'header.php'; ?> <div class="card-panel"> <h4><?php echo $explode->name(); ?> </h4> <small><?php echo getHumanDate(new DateTime($torrent['created']), new DateTime(date('Y-n-d H:i:s', time()))); ?> <small><?php echo $torrent['created']; ?>
$result = mysqli_query($link, 'SELECT `id` FROM `torrents` ORDER BY `id` DESC LIMIT 1;'); if (!$result) { print_error('MySQL error | ' . mysqli_error($link) . '<br>'); break; } $id = (int) mysqli_fetch_all($result, MYSQLI_ASSOC)[0]['id'] + 1; mysqli_free_result($result); if (strlen($_POST['description']) == 0) { print_error('Description empty!'); break; } if (strlen(mysqli_real_escape_string($link, $_POST['description'])) > (int) unserialize(_CONFIG)['descriptions']['max']) { print_error('Description too long!'); break; } $torrent = getTorrent($_FILES['torrent']['tmp_name']); $db_torrentid = '\'' . mysqli_real_escape_string($link, $id) . '\''; $db_filename = '\'' . mysqli_real_escape_string($link, $filename) . '\''; $db_torrentname = '\'' . mysqli_real_escape_string($link, htmlspecialchars($torrent->name())) . '\''; $db_uploader = '\'' . mysqli_real_escape_string($link, htmlspecialchars($_SESSION['USER_ID'])) . '\''; $db_date = time(); $db_downloads = 0; $handle = fopen(unserialize(_CONFIG)['descriptions']['dir'] . DIRECTORY_SEPARATOR . $filename, 'w'); fwrite($handle, htmlspecialchars($_POST['description'])); fclose($handle); if (!mysqli_query($link, 'INSERT INTO `torrents` (`id`, `filename`, `torrentname`, `uploader`, `created`, `downloads`) VALUES(' . $db_torrentid . ', ' . $db_filename . ', ' . $db_torrentname . ', ' . $db_uploader . ', FROM_UNIXTIME(' . $db_date . '), ' . $db_downloads . ');')) { print_error('MySQL error! | ' . mysqli_error($link)); break; } $result = mysqli_query($link, 'SELECT * FROM `users` WHERE `id`=' . $_SESSION['USER_ID'] . ';'); $db_uploader_uploads = (array) unserialize(mysqli_fetch_all($result, MYSQLI_ASSOC)[0]['uploads']);