Файл: EROCMS 11.2 ДЛЯ ADULT/Script/pages/control/advertising.php
Строк: 198
<?php
/*
Автор скрипта https://bymas.ru/id85823
Скрипты, программы на заказ.
Быстро, качественно, недорого.
*/
if ($user['access'] < 1) {
header('location: /');
exit;
}
if (isset($_GET['deletion'])){
$mysqli -> query("delete from ero_advertising where id = '".abs(intval($_GET['deletion']))."'");
logs($user['id'], 'Удалил реклманую площадку.', 0);
header('location: /control.html?func=advertising');
exit;
}
$quantity = $mysqli -> query("select count(*) from ero_advertising") -> fetch_row();
$k_page = k_page($quantity[0], 10);
$page = page($k_page);
$start = 10*$page-10;
if (isset($_GET['edit'])){
$editAdv = $mysqli -> query("select * from ero_advertising where id = '".abs(intval($_GET['edit']))."'") -> fetch_assoc();
if (!$editAdv){
header('location: /');
exit;
}
if (isset($_POST['name'])){
$term = strtotime($_POST['term']);
$name = mysqli_real_escape_string($mysqli, filter($_POST['name']));
$colour = mysqli_real_escape_string($mysqli, filter($_POST['colour']));
$site = mysqli_real_escape_string($mysqli, filter($_POST['site']));
$mysqli -> query("update ero_advertising set name = '$name', colour = '$colour', site = '$site', term = '$term' where id = '$editAdv[id]'");
$mysqli -> query("INSERT INTO ero_logs SET id_user = '$user[id]', act = 'Изменил рекламную площадку $editAdv[name].', date = '".time()."'");
header('location: /control.html?func=advertising');
exit;
}
?>
<form method="post">
<p>Название</p>
<p><input name="name" class="injected" type="text" value="<?=$editAdv['name']?>"></p>
<p>Сайт</p>
<p><input name="site" class="injected" type="text" value="<?=$editAdv['site']?>"></p>
<p>Цвет</p>
<p>
<input name="colour" type="radio" value="DarkBlue"> <font color="DarkBlue">DarkBlue</font>
<input name="colour" type="radio" value="LawnGreen"> <font color="LawnGreen">LawnGreen</font>
<input name="colour" type="radio" value="BlueViolet"> <font color="BlueViolet">BlueViolet</font>
<input name="colour" type="radio" value="Crimson"> <font color="Crimson">Crimson</font><br />
<input name="colour" type="radio" value="Red"> <font color="Red">Red</font>
<input name="colour" type="radio" value="Fuchsia" checked> <font color="Fuchsia">Fuchsia</font>
<input name="colour" type="radio" value="Yellow"> <font color="Yellow">Yellow</font>
<input name="colour" type="radio" value="Orange"> <font color="Orange">Orange</font>
<input name="colour" type="radio" value="DeepPink"> <font color="DeepPink">DeepPink</font>
</p>
<p>Срок до</p>
<p><input class="injected" name="term" type="date" value="<?=date('Y-m-d', $editAdv['term'])?>" min="2019-01-18" max="2020-12-31"></p>
<input type="submit" class="byecos" value="Изменить">
</form>
<?
}
if (isset($_GET['add'])){
if (isset($_POST['name'])){
$term = strtotime($_POST['term']);
$name = mysqli_real_escape_string($mysqli, filter($_POST['name']));
$colour = mysqli_real_escape_string($mysqli, filter($_POST['colour']));
$site = mysqli_real_escape_string($mysqli, filter($_POST['site']));
$mysqli -> query("INSERT INTO ero_advertising SET name = '$name', colour = '$colour', site = '$site', term = '$term'");
$mysqli -> query("INSERT INTO ero_logs SET id_user = '$user[id]', act = 'Добавил рекламную площадку $name.', date = '".time()."'");
header('location: /control.html?func=advertising');
exit;
}
?>
<form method="post">
<p>Название</p>
<p><input name="name" class="injected" type="text"></p>
<p>Сайт</p>
<p><input name="site" class="injected" type="text"></p>
<p>Цвет</p>
<p>
<input name="colour" type="radio" value="DarkBlue"> <font color="DarkBlue">DarkBlue</font>
<input name="colour" type="radio" value="LawnGreen"> <font color="LawnGreen">LawnGreen</font>
<input name="colour" type="radio" value="BlueViolet"> <font color="BlueViolet">BlueViolet</font>
<input name="colour" type="radio" value="Crimson"> <font color="Crimson">Crimson</font><br />
<input name="colour" type="radio" value="Red"> <font color="Red">Red</font>
<input name="colour" type="radio" value="Fuchsia" checked> <font color="Fuchsia">Fuchsia</font>
<input name="colour" type="radio" value="Yellow"> <font color="Yellow">Yellow</font>
<input name="colour" type="radio" value="Orange"> <font color="Orange">Orange</font>
<input name="colour" type="radio" value="DeepPink"> <font color="DeepPink">DeepPink</font>
</p>
<p>Срок до</p>
<p><input class="injected" name="term" type="date" value="<?=date('Y-m-d', time())?>" min="2019-01-18" max="2020-12-31"></p>
<input type="submit" class="byecos" value="Добавить">
</form>
<?
}
?>
<a href="/control.html?func=advertising&add" class="tach">Добавить площадку</a>
<?
if ($quantity[0] == 0) echo '<div class="err">Площадок не найдено</div>';
$query = $mysqli -> query("select * from ero_advertising order by term desc limit $start, 10");
while($row = $query -> fetch_assoc()){
?>
<p class="functions_data">
Сайт: <a href="<?= $row['site']?>"><b><?= $row['site']?></b></a>
<a href="/control.html?func=advertising&edit=<?=$row['id'];?>"><img src="/designs/icons/view/edit.png" width="16" height="16" /></a>
<a href="/control.html?func=advertising&deletion=<?=$row['id'];?>"><img src="/designs/icons/view/remove.png" width="16" height="16" /></a> <br />
Срок до: <b><?= date('Y-m-d H:i:s', $row['term']);?> </b><br />
Цвет: <b><font color="<?= $row['colour'];?>"><?= $row['colour'];?></font></b> <br />
Добавил: <b><?= $row['owner'];?></b> <br />
</p>
<?
}
if ($k_page > 1) str('/control.html?func=advertising&', $k_page, $page);
$query -> free();