File: /home/httpd/html/freecams1.com/public_html/admin/models.php
<?php
require "header.php";
if ($_POST['list']) {
foreach ($_POST['list'] as $i) {
if (is_numeric($i)) {
dbQuery("DELETE FROM `content_pornstars` WHERE `pornstar` = '$i'");
dbQuery("DELETE FROM `comments` WHERE `content` = '$i' AND `type` = 1");
dbQuery("DELETE FROM `pornstars_languages` WHERE `pornstar` = '$i'");
dbQuery("DELETE FROM `pornstars` WHERE `record_num` = '$i'");
}
}
}
$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;
?>
<div class="content-page">
<div class="header-area">
<div class="breadcrumbs">
<a href="index.php">Admin Home</a>
<span><a href="models.php">Manage Models</a></span>
</div>
</div>
<div class="content-outer">
<h2>Manage<strong>Models</strong></h2>
<div class="content-inner">
<? echo getMessages(); ?>
<form method="POST" action="" class="form" novalidate autocomplete="off">
<table class="pagetable">
<thead>
<tr>
<th colspan="2">Search</th>
</tr>
</thead>
<tr>
<td>Name</td>
<td><input type="text" name="q" /></td>
</tr>
<tr class="item submit">
<td colspan="2">
<button type="submit" class="btn action-search">Search</button>
</td>
</tr>
</table>
</form>
<form method="POST" action="" class="form" novalidate autocomplete="off">
<table class="pagetable">
<thead>
<tr>
<th class="thumb">Thumbnail</th>
<th>Name</th>
<th class="options"></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 ($_POST['q']) {
$q = mysqli_real_escape_string($dblink,$_POST['q']);
$query = "AND (`name` LIKE '%$q%' OR aka LIKE '%$q%')";
}
$result_count = dbQuery("SELECT `record_num` FROM `pornstars` WHERE 1=1 $query",false);
$result = dbQuery("SELECT * FROM `pornstars` WHERE 1=1 $query ORDER BY `name` LIMIT $from,$max_results",false);
$total_results = count($result_count);
$total_pages = ceil($total_results / $max_results);
?>
<?php if (count($result) == 0) { ?>
<tr><td colspan="4"><div class="notification alert">No models found</div></td></tr>
<?php } else { ?>
<?php foreach($result as $row) { ?>
<tr>
<td class="thumb">
<?php if ($row['thumb']) { ?>
<img src="<?php echo $misc_url; ?>/<?php echo $row['thumb']; ?>" alt="<?php echo $row['name']; ?>" />
<?php } else { ?>
<img src="<?php echo $basehttp; ?>/core/images/placeholder.jpg" alt="<?php echo $row['name']; ?>" />
<?php } ?></td>
<td><?php echo $row['name']; ?></td>
<td class="options">
<a href="edit_model.php?id=<?php echo $row[record_num]; ?>" class="btn btn-xs btn-orange" title="Edit model"><i class="ion ion-edit icon-edit"</a>
</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="5">
<button type="submit" class="btn action-delete">Delete Selected</button>
</td>
</tr>
</tbody>
</table>
</form>
<div id="adminPagination"><?php echo showAdminPagination($total_pages); ?></div>
</div>
</div>
</div>
<?php require "footer.php"; ?>