<h2>View/Delete Searches</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(id) AS TOTAL FROM searches;');
$e->total = mysql_result($g_total, 0);
if($_POST['sub'] == 'Remove from Searches' && 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 searches.</p>';
$idList = implode(',', $_POST['list']);
dbcom("DELETE FROM searches WHERE id IN ($idList);");
}
$get = dbcom("SELECT id, UNIX_TIMESTAMP(timestamp) AS theDate, views, query FROM searches 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">Searches, ordered by Views. Delete any that don`t seem appropriate for your Top Searches or Sponsored Link list.</td>
</tr>
<tr style="text-align: left;" height="30">
<td width="75%"><b>Query</b></td>
<td width="15%"><b>Date</b></td>
<td width="10%"><b>Views</b></td>
</tr>
</thead>
<tbody>' . "\n";
echo '<form action="ddl.php?go=editsearches" 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="75%"> <input type="checkbox" name="list[]" value="' . $row['id'] . '" id="list"> <label>' . $row['query'] . '</label></td>' . "\n";
echo '<td width="15%">' . date($date_format, $row['theDate']) . '</td>' . "\n";
echo '<td width="10%">' . $row['views'] . '</td>' . "\n";
echo '</tr>' . "\n";
}
echo '</tbody></table><br>';
$e->paginate('ddl.php?go=editsearches&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 Searches" class="formbuttonwide">' . "\n";
echo '</td>' . "\n";
echo '</tr>' . "\n";
echo '</table>' . "\n";
echo '</form>' . "\n";
}
else
{
echo '<p>No searches!</p>' . "\n";
}
?>