File: /home/httpd/html/baretube.com.new/admin/add_paysite.php
<?php
require "db.php";
if (is_numeric($_REQUEST['id']) && $_POST['user'] != "") {
$_POST['user'] = $sponsor_id = (int) $_REQUEST['id'];
}
if (isset($_POST['formSubmit'])) {
$_POST = array_map_array('trim', $_POST);
$_POST['name'] = strip_tags($_POST['name']);
if ($_POST['name'] == "") {
setMessage('"Paysite Name" is required!', 'error');
}
if ($_FILES['postroll']['tmp_name']) {
$ext = explode(".", strtolower($_FILES['postroll']['name']));
$ext = array_reverse($ext);
if (!in_array($ext[0], array('jpg', 'jpeg'))) {
setMessage('You may only upload image files for "Paysite Image"', 'error');
}
}
$getUser = dbRow("SELECT `record_num` FROM `users` WHERE `username` = '" . mysqli_real_escape_string($dblink, $_POST['user']) . "'");
$_POST['user'] = is_array($getUser) ? $getUser['record_num'] : 0;
if (!getMessages(false, 'error')) {
$insert_id = dbInsert('paysites', array(
'name' => $_POST['name'],
'url' => $_POST['url'],
'description' => $_POST['description'],
'ad0' => $_POST['ad0'],
'ad1' => $_POST['ad1'],
'ad2' => $_POST['ad2'],
'ad3' => $_POST['ad3'],
'ad4' => $_POST['ad4'],
'ad5' => $_POST['ad5'],
'ad6' => $_POST['ad6'],
'ad7' => $_POST['ad7'],
'ad8' => $_POST['ad8'],
'ad9' => $_POST['ad9'],
'user' => $_POST['user'],
'inline_xml_url' => $_POST['inline_xml_url'],
'pre_xml_url' => $_POST['pre_xml_url'],
'pause_xml_url' => $_POST['pause_xml_url'],
'post_xml_url' => $_POST['post_xml_url'],
));
if (is_numeric($insert_id)) {
if ($_FILES['postroll']['tmp_name']) {
$paysite_thumb = "paysite{$insert_id}.jpg";
move_uploaded_file($_FILES['postroll']['tmp_name'], "$misc_path/$paysite_thumb");
}
if ($_FILES['postroll-2']['tmp_name']) {
$paysite_thumb = "paysite-bg{$insert_id}.jpg";
move_uploaded_file($_FILES['postroll-2']['tmp_name'], "$misc_path/$paysite_thumb");
}
if (is_array($_POST['lang'])) {
foreach ($_POST['lang'] as $k => $v) {
dbInsert('paysites_languages', array(
'paysite' => $insert_id,
'language' => $k,
'data' => serialize($v),
));
}
}
setMessage('Paysite has been added!');
header("Location: $_SERVER[REQUEST_URI]");
exit();
}
} else {
entities_walk($_POST);
}
}
?>
<? require "header.php"; ?>
<script>
$().ready(function () {
$('.lang-selection a').on('click', function (e) {
e.preventDefault();
$('.lang-selection').find('a.active').removeClass('active');
$(this).addClass('active');
var activeItems = $(this).attr('href').replace("#", "");
$('#languages').find('.langInput').hide();
$('#languages').find('.' + activeItems).show();
return false;
});
});
</script>
<div class="content-page">
<div class="header-area">
<div class="breadcrumbs">
<a href="index.php">Admin Home</a>
<span><a href="paysites.php">Paysites</a></span>
</div>
</div>
<div class="content-outer">
<h2>Add<strong>Paysite</strong></h2>
<div class="notification info">Please enter the paysite name, url, and ads below. The ad0 through ad9 boxes can contain any html, and will display on the video player pages for videos assigned to this paysite. The ads can be called on the video templates using a special code. For example, to call ad0, you would put: <br /><br /> <? echo $ads[ad0]; ?></div>
<div class="content-inner">
<? echo getMessages(); ?>
<form action="" method="POST" enctype="multipart/form-data" class="form" novalidate autocomplete="off">
<table class="pagetable" id="languages">
<thead>
<tr>
<th colspan="2">Add New Paysite</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="2" class="lang-selection">
<ul class="tabs custom">
<li><a href="#baseLang" class="tab active">Default</a></li>
<?php foreach ($languages as $l) { ?>
<li><a href="#<?php echo $l['iso']; ?>" class="tab"><i class="flag-icon flag-icon-<?php echo strtolower($l['iso']); ?>"></i><?php echo $l['iso']; ?></a></li>
<?php } ?>
</ul>
</td>
</tr>
<tr>
<td>Paysite Name</td>
<td><input name="name" type="text" required value="<? echo $_POST['name']; ?>" /></td>
</tr>
<tr>
<td>Paysite URL</td>
<td><input name="url" type="text" value="<? echo $_POST['url']; ?>" /></td>
</tr>
<tr class="baseLang langInput">
<td>Description</td>
<td><textarea name="description" cols="35" rows="4"><? echo $_POST['description']; ?></textarea></td>
</tr>
<?php foreach ($languages as $l) { ?>
<tr class="<?php echo $l['iso']; ?> langInput" style="display: none;">
<td><i class="flag-icon flag-icon-<?php echo strtolower($l['iso']); ?>"></i>Description (<?php echo $l['name']; ?>/<?php echo $l['iso']; ?>)</td>
<td><textarea name="lang[<?php echo $l['iso']; ?>][description]" cols="35" rows="4"><? echo $_POST['lang'][$l['iso']]['description']; ?></textarea></td>
</tr>
<?php } ?>
<tr>
<td>AD0</td>
<td><textarea name="ad0" cols="60" rows="5"><? echo $_POST['ad0']; ?></textarea></td>
</tr>
<tr>
<td>AD1</td>
<td><textarea name="ad1" cols="60" rows="5"><? echo $_POST['ad1']; ?></textarea></td>
</tr>
<tr>
<td>AD2</td>
<td><textarea name="ad2" cols="60" rows="5"><? echo $_POST['ad2']; ?></textarea></td>
</tr>
<tr>
<td>AD3</td>
<td><textarea name="ad3" cols="60" rows="5"><? echo $_POST['ad3']; ?></textarea></td>
</tr>
<tr>
<td>AD4</td>
<td><textarea name="ad4" cols="60" rows="5"><? echo $_POST['ad4']; ?></textarea></td>
</tr>
<tr>
<td>AD5</td>
<td><textarea name="ad5" cols="60" rows="5"><? echo $_POST['ad5']; ?></textarea></td>
</tr>
<tr>
<td>AD6</td>
<td><textarea name="ad6" cols="60" rows="5"><? echo $_POST['ad6']; ?></textarea></td>
</tr>
<tr>
<td>AD7</td>
<td><textarea name="ad7" cols="60" rows="5"><? echo $_POST['ad7']; ?></textarea></td>
</tr>
<tr>
<td>AD8</td>
<td><textarea name="ad8" cols="60" rows="5"><? echo $_POST['ad8']; ?></textarea></td>
</tr>
<tr>
<td>AD9</td>
<td><textarea name="ad9" cols="60" rows="5"><? echo $_POST['ad9']; ?></textarea></td>
</tr>
<tr>
<td>Partner Account</td>
<td>
<?php $getUser = dbRow("SELECT `username` FROM `users` WHERE `record_num` = '{$_POST['user']}'", false); ?>
<input type="text" name="user" id="contentAutocomplete" value="<?php echo (!empty($getUser)) ? $getUser['username'] : ""; ?>"/>
<script type="text/javascript">
$(document).ready(function () {
$("#contentAutocomplete").autocomplete({
source: "<?php echo $basehttp; ?>/admin/search_content.php?type=2",
minLength: 2
});
});
</script>
</td>
</tr>
<tr>
<td>Paysite Image</td>
<td><input type="file" name="postroll" data-extensions="jpg,jpeg" /></td>
</tr>
<tr>
<td>Paysite Background Image</td>
<td><input type="file" name="postroll-2" data-extensions="jpg,jpeg" /></td>
</tr>
<tr class="item submit">
<td colspan="2">
<button name='formSubmit' type="submit" class="btn action-save">Submit</button>
</td>
</tr>
</tbody>
</table>
</form>
</div>
</div>
</div>
<?php require "footer.php"; ?>