File: //home/httpd/mech_ftp/baretube.com/admin/paysites.php
<?php
require "db.php";
if ($_POST['list']) {
foreach ($_POST['list'] as $i) {
if (is_numeric($i)) {
dbQuery("DELETE FROM `paysites` WHERE `record_num` = '$i'");
}
}
setMessage('Selected paysites removed');
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="paysites.php">Manage Paysites</a></span>
</div>
</div>
<div class="content-outer">
<h2>Manage<strong>Paysites</strong></h2>
<div class="notification info">Below is a listing of all the paysites currently in the system. The listing of ad spots next to the paysite name display in green if an ad has been entered in that spot for that site, or red if there is no ad. The content column represents how many *published* videos are assigned to that paysite.</div>
<div class="content-inner">
<? echo getMessages(); ?>
<form method="POST" action="" class="form" novalidate autocomplete="off">
<table class="pagetable">
<thead>
<tr>
<th class="thumb">Thumbnail</th>
<th>Paysite Name</th>
<th>Ad Spots</th>
<th>Content</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 $result = dbQuery("SELECT *, (SELECT COUNT(*) FROM `content` WHERE `paysite` = `paysites`.`record_num` AND `enabled` = 1 AND `approved` = 2) AS `content__amount` FROM `paysites` ORDER BY `name`", false); ?>
<?php if (count($result) == 0) { ?>
<tr><td colspan="6"><div class="notification alert">No paysites found</div></td></tr>
<?php } else { ?>
<?php foreach ($result as $row) { ?>
<tr>
<td class="thumb">
<?php if (file_exists($misc_path . '/paysite' . $row['record_num'] . '.jpg')) { ?>
<img src="<?php echo $misc_url; ?>/paysite<?php echo $row['record_num']; ?>.jpg" alt="<?php echo $row['name']; ?>" />
<?php } else { ?>
<img src="<?php echo $basehttp; ?>/core/images/catdefault.jpg" alt="<?php echo $row['name']; ?>">
<?php } ?>
</td>
<td><?php echo $row['name']; ?></td>
<td>
<table>
<tr>
<td class="no-padding">
<?php $how_many_ads = 10; ?>
<?php for ($i = 0; $i < $how_many_ads; ++$i) { ?>
<div class="td-box<?php echo ($row["ad$i"] != '') ? ' active' : ''; ?>"><?php echo "AD$i"; ?></div>
<?php } ?>
</td>
</tr>
</table>
</td>
<td><?php echo $row['content__amount']; ?></td>
<td class="options">
<a href="edit_paysite.php?id=<?php echo $row['record_num']; ?>" class="btn btn-xs btn-orange" title="Edit paysite"><i class="ion ion-edit icon-edit"></i></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 } ?>
<tr class="item submit">
<td colspan="6">
<button type="submit" class="btn action-delete">Delete Selected</button>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</form>
</div>
</div>
</div>
<?php require "footer.php"; ?>