File: /home/httpd/html/xdudes.com_bk/admin/modules/custom_links/index.php
<?php
require "../../header.php";
if ($_POST['list']) {
foreach ($_POST['list'] as $i) {
if (is_numeric($i)) {
dbQuery("DELETE FROM custom_links WHERE record_num = '$i'");
}
}
}
if ($_POST['url'] && $_POST['query_string']) {
$_POST = mysqli_real_escape_array($_POST);
$result = dbQuery("SELECT * FROM custom_links WHERE url LIKE '{$_POST['url']}'",false);
if (!is_array($result)) {
dbQuery("INSERT INTO custom_links SET url = '{$_POST['url']}', query_string = '{$_POST['query_string']}', title = '{$_POST['title']}', headertitle = '{$_POST['headertitle']}', meta_kw = '{$_POST['metakw']}', meta_desc = '{$_POST['meta_desc']}', meta_robots = '{$_POST['meta_robots']}', custom_text = '{$_POST['custom_text']}', custom_text_alt = '{$_POST['custom_text_alt']}'");
} else {
$error = 'Error: That URL already exists!';
}
}
?>
<div class="content-page">
<div class="header-area">
<div class="breadcrumbs">
<a href="index.php">Admin Home</a>
<span><a href="index.php">Custom URLs</a></span>
</div>
</div>
<div class="content-outer">
<h2>Custom<strong>URLs</strong></h2>
<div class="notification info">This page lets you create custom URLs within the script, to use as landers that fetch cams with specific filters. The easiest place to get the query string required for your custom URL is to browse to it using the front end and copying the URL. Query string should not start with a "?". You can also use notTags[] to prevent partial word matches, like caucasian matching on asian tag so you would use "tags[]=asian&notTags[]=caucasian"</div>
<div class="content-inner">
<form method="POST" action="" class="form" novalidate autocomplete="off">
<?php if ($error) { ?><div class="notification error"><?php echo $error; ?></div><?php } ?>
<table class="pagetable">
<thead>
<tr>
<th colspan="2">Add URL</th>
</tr>
</thead>
<tbody>
<tr>
<td>URL</td>
<td><input required name="url" placeholder="blonde-girls" type="text" /></td>
</tr>
<tr>
<td>Query String</td>
<td><input required name="query_string" type="text" placeholder="hair[]=blonde&gender[]=f" /></td>
</tr>
<tr>
<td>Title</td>
<td><input required name="title" type="text" placeholder="<title> tag" /></td>
</tr>
<tr>
<td>Header Title</td>
<td><input required name="headertitle" type="text" placeholder="Page Header text" /></td>
</tr>
<tr>
<td>Meta Keywords Tag</td>
<td><input name="meta_kw" type="text" placeholder="" /></td>
</tr>
<tr>
<td>Meta Description Tag</td>
<td><input name="meta_desc" type="text" placeholder="" /></td>
</tr>
<tr>
<td>Meta Robots Tag</td>
<td><input name="meta_robots" type="text" placeholder="" /></td>
</tr>
<tr>
<td>Custom Text</td>
<td><textarea name="custom_text" type="text" placeholder=""></textarea></td>
</tr>
<tr>
<td>Secondary Custom Text</td>
<td><textarea name="custom_text_alt" type="text" placeholder=""></textarea></td>
</tr>
<tr class="item submit">
<td colspan="2">
<button type="submit" class="btn action-save">Submit</button>
</td>
</tr>
</tbody>
</table>
</form>
<form method="POST" action="" class="form" novalidate autocomplete="off">
<table class="pagetable">
<thead>
<tr>
<th>URL</td>
<th>Query String</td>
<th></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>
<?
$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;
$result_count = dbQuery("SELECT COUNT(*) AS `count` FROM `custom_links`",false);
$result_count = $result_count[0];
$result = dbQuery("SELECT * FROM custom_links ORDER BY url ASC LIMIT $from,$max_results",false);
$total_pages = ceil($result_count['count'] / $max_results);
?>
<? if (!is_array($result) || count($result) == 0) { ?>
<tr><td colspan="4"><div class="notification alert">No entries found</div></td></tr>
<? } else { ?>
<? foreach($result as $row) { ?>
<tr>
<td><a href="<? echo $basehttp; ?>/<? echo $row['url']; ?>" target="_blank"><? echo $row['url']; ?></a></td>
<td><? echo $row['query_string']; ?></td>
<td class="options">
<a href="edit.php?id=<? echo $row['record_num']; ?>" title="Edit" class="btn btn-xs btn-orange"><i class="ion ion-edit icon-edit"></i></a>
</td>
<td>
<label class="checkbox">
<input type="checkbox" name="list[]" value="<? echo $row['record_num']; ?>" id="ids-<? echo $row['record_num']; ?>"><i></i>
</label>
</td>
</tr>
<? } ?>
<? } ?>
<tr class="item submit">
<td colspan="4">
<? if (is_array($result) ) { ?>
<button type="submit" class="btn action-delete">Delete Selected</button>
<? } ?>
</td>
</tr>
</tbody>
</table>
</form>
<div id="adminPagination"><? echo showAdminPagination($total_pages); ?></div>
</div>
</div>
</div>
<?php require "../../footer.php"; ?>