File: //home/httpd/mech_ftp/baretube.com/admin/csv_import_failures.php
<?php
require "db.php";
if ($_POST['list']) {
$count = 0;
foreach ($_POST['list'] as $i) {
if (is_numeric($i)) {
if (dbQuery("DELETE FROM `csv_failures` WHERE `record_num` = '$i'")) {
$count++;
}
}
}
setMessage("$count rows deleted from CSV Import Failures");
header("Location: $_SERVER[REQUEST_URI]");
exit();
}
?>
<? require "header.php"; ?>
<div class="content-page">
<div class="header-area">
<div class="breadcrumbs">
<a href="index.php">Admin Home</a>
<span><a href="csv_import_queue.php">CSV Import Failures</a></span>
</div>
</div>
<div class="content-outer">
<h2>CSVImport<strong>Failures</strong></h2>
<div class="content-inner">
<? echo getMessages(); ?>
<form method="POST" action="" class="form" novalidate autocomplete="off">
<?php
$page = (isset($_GET['page']) && is_numeric($_GET['page'])) ? (int) $_GET['page'] : 1;
$max_results = (isset($_GET['setmax']) && $_GET['setmax'] > 0) ? (int) $_GET['setmax'] : 100;
$from = ($page * $max_results) - $max_results;
$results = dbQuery("SELECT * FROM `csv_failures` LIMIT $from, $max_results", false);
$total_results = dbValue("SELECT COUNT(`record_num`) AS `count` FROM `csv_failures`", 'count');
$total_pages = ceil($total_results / $max_results);
?>
<table class="pagetable">
<thead>
<tr>
<th>Data</th>
<th>Reason</th>
<th>Date</th>
<th style="width:50px">
<label for="check-select-all-1" class="checkbox">
<input type="checkbox" name="select_all" value="1" data-items="list[]" id="check-select-all-1">
<i></i>
</label>
</th>
</tr>
</thead>
<tbody>
<?php if (!is_array($results)) { ?>
<tr><td colspan="5"><div class="notification alert">No entries found</div></td></tr>
<?php
} else {
foreach ($results as $row) {
?>
<tr>
<td style='font-size: 10px;'><?php echo nl2br(print_r(json_decode($row['data'],true),true)); ?></td>
<td><?php echo $row['failure']; ?></td>
<td><? echo htmlentities($row['date']); ?></td>
<td>
<label class="checkbox">
<input type="checkbox" name="list[]" value="<?php echo $row['record_num']; ?>" id="ids-<?php echo $row['record_num']; ?>"><i></i>
</label>
</td>
</tr>
<?php } ?>
<?php } ?>
<tr class="item submit">
<td colspan="4">
<?php if (is_array($results)) { ?>
<button type="submit" class="btn action-delete">Delete Selected</button>
<?php } ?>
</td>
</tr>
</tbody>
</table>
</form>
<div id="adminPagination"><? echo showAdminPagination($total_pages); ?></div>
</div>
</div>
</div>
<?php require "footer.php"; ?>