File: /home/httpd/html/freecams1.com/public_html/admin/edit_feed.php
<?
require "db.php";
if (!is_numeric($_GET['id'])) {
exit();
}
$id = (int) $_GET['id'];
$row = dbRow("SELECT * FROM `xml_feeds` WHERE `record_num` = '$id'");
if (!is_array($row)) {
setMessage("XML Feed ID $id does not exist!", 'error');
pageNotFound(true);
}
if (isset($_POST['formSubmit'])) {
$_POST = array_map_array('trim', $_POST);
if ($_POST['name'] == "") {
setMessage('Feed "Name" is required!', 'error');
}
if ($_POST['url'] == "") {
setMessage('Feed "URL" is required!', 'error');
}
if (!getMessages(false, 'error')) {
dbUpdate('xml_feeds', array(
'name' => $_POST['name'],
'url' => $_POST['url'],
'hotlink' => $_POST['hotlink'],
'paysite' => $_POST['paysite'],
'record_num' => $id,
));
setMessage('Feed saved successfully. <a href="xml_feeds.php">Click here to go back</a>');
header("Location: $_SERVER[REQUEST_URI]");
exit;
}
}
$_POST += $row;
entities_walk($_POST);
?>
<? require "header.php"; ?>
<div class="content-page">
<div class="header-area">
<div class="breadcrumbs">
<a href="index.php">Admin Home</a>
<span><a href="xml_feeds.php">XML Feeds</a></span>
</div>
</div>
<div class="content-outer">
<h2>Edit<strong>Feed</strong></h2>
<div class="content-inner">
<? echo getMessages(); ?>
<form method="POST" action="" enctype="multipart/form-data" class="form" novalidate autocomplete="off">
<table class="pagetable">
<thead>
<tr>
<th colspan="2">Edit Feed - <? echo $_POST['name']; ?></th>
</tr>
</thead>
<tbody>
<tr>
<td>Name</td>
<td><input name="name" type="text" value="<? echo $_POST['name']; ?>" required /></td>
</tr>
<tr>
<td>URL</td>
<td><input name="url" type="text" value="<? echo $_POST['url']; ?>" required /></td>
</tr>
<tr>
<td>Is Hotlink?</td>
<td>
<select name="hotlink">
<option<? echo ($_POST['hotlink'] == '0') ? ' selected' : ''; ?> value="0">Hosted</option>
<option<? echo ($_POST['hotlink'] == '1') ? ' selected' : ''; ?> value="1">Hotlinked</option>
</select>
</td>
</tr>
<tr>
<td>Paysite</td>
<td>
<select name="paysite">
<? $paysites = dbQuery("SELECT `record_num`, `name` FROM `paysites` ORDER BY `name`", false); ?>
<? if(is_array($paysites)) { ?>
<? foreach ($paysites as $paysite) { ?>
<option value="<? echo $paysite['record_num']; ?>"<? echo $paysite['record_num'] == $_POST['paysite'] ? ' selected' : ''; ?>><? echo $paysite['name']; ?></option>
<? } ?>
<? } ?>
</select>
</td>
</tr>
<tr class="item submit">
<td colspan="2">
<input type="hidden" name="id" value="<? echo $id; ?>" />
<input type="hidden" name="formSubmit" value="1" />
<button type="submit" class="btn action-save">Save</button>
</td>
</tr>
</tbody>
</table>
</form>
</div>
</div>
</div>
<? require "footer.php"; ?>