<h2>View/Delete Recent Downloads</h2>
<?php
if(isset($_GET) && is_array($_GET) && count($_GET) > 0 && array_key_exists('page', $_GET) && ctype_digit($_GET['page']))
{
$page = $_GET['page'];
}
else
{
$page = 1;
}
$e->page = $page;
$e->page *= $pagelimit;
$e->page -= $pagelimit;
$g_total = dbcom('SELECT COUNT(recentid) AS TOTAL FROM recents;');
$e->total = mysql_result($g_total, 0);
if($_POST['sub'] == 'Remove from Recents' && checkPostForm('deletePartner', $_POST) === TRUE)
{
echo '<p>' . "\n";
echo '<b>' . count($_POST['list']) . '</b> entr';
if(count($_POST['list']) != 1)
{
echo 'ies';
}
else
{
echo 'y';
}
echo ' removed from recents.</p>';
$idList = implode(',', $_POST['list']);
dbcom("DELETE FROM recents WHERE recentid IN ($idList);");
}
$get = dbcom("SELECT recentid, type, title, UNIX_TIMESTAMP(date) AS theDate, views FROM recents ORDER BY views DESC LIMIT $e->page, $pagelimit;");
if(mysql_num_rows($get) > 0)
{
echo '<table border="0" cellpadding="0" cellspacing="0" width="100%">
<thead>
<tr style="text-align: left;" height="30">
<td colspan="3">Recent Downloads, ordered by Views. Delete any that don`t seem appropriate for your Recent Downloads list.</td>
</tr>
<tr style="text-align: left;" height="30">
<td width="50%"><b>Title</b></td>
<td width="25%"><b>Date</b></td>
<td width="15%"><b>Type</b></td>
<td width="10%"><b>Views</b></td>
</tr>
</thead>
<tbody>' . "\n";
echo '<form action="ddl.php?go=editrecents" method="post"><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr>' . "\n";
while($row = mysql_fetch_array($get))
{
echo "<tr onmouseover=\"this.style.backgroundColor='$hovercolor'; window.status='$title'; return true;\" onmouseout=\"this.style.backgroundColor=''; window.status=''\">" . "\n";
echo '<td width="50%"> <input type="checkbox" name="list[]" value="' . $row['recentid'] . '" id="list"> <a href="' . $site_url . '/free-direct-download-' . $row['recentid'] . '-' . $row['title'] . '.htm" target="_blank">' . $row['title'] . '</a></td>' . "\n";
echo '<td width="25%">' . date($date_format, $row['theDate']) . '</td>' . "\n";
echo '<td width="15%">' . $row['type'] . '</td>' . "\n";
echo '<td width="10%">' . $row['views'] . '</td>' . "\n";
echo '</tr>' . "\n";
}
echo '</tbody></table><br>';
$e->paginate('ddl.php?go=editrecents&page=');
echo '<table>' . "\n";
echo '<tr>' . "\n";
echo '<td>' . "\n";
echo '<br><input type="button" value="Check All" class="form" onClick="this.value=check(this.form.list)">' . "\n";
echo '</td>' . "\n";
echo '</tr>' . "\n";
echo '<tr>' . "\n";
echo '<td>' . "\n";
echo '<br><input type="Submit" name="sub" value="Remove from Recents" class="formbuttonwide">' . "\n";
echo '</td>' . "\n";
echo '</tr>' . "\n";
echo '</table>' . "\n";
echo '</form>' . "\n";
}
else
{
echo '<p>No recents!</p>' . "\n";
}
?>