/dpanel/adt.new.banner.php
PHP | 87 lines | 71 code | 16 blank | 0 comment | 12 complexity | 392ecd120e9d87bc57a1a364d17876a4 MD5 | raw file
- <?php
-
- include_once '../sys/inc/start.php';
- dpanel::check_access();
- $advertisement = new adt();
- $doc = new document(5);
- $doc->title = __('????? ??????');
-
- if (!isset($_GET['id'])) {
- header('Refresh: 1; url=adt.php');
- $doc->ret(__('??????? ? ???????'), 'adt.php');
- $doc->ret(__('???????'), '/dpanel/');
- $doc->err(__('?????? ?????? ???????'));
-
- exit;
- }
- $id_space = (string) $_GET['id'];
-
- if (!$name = $advertisement->getNameById($id_space)) {
- header('Refresh: 1; url=?');
- $doc->err(__('???????? ??????? ???????????'));
- exit;
- }
-
- if (isset($_POST['create'])) {
- $code_main = text::input_text(@$_POST['code_main']);
- $code_other = text::input_text(@$_POST['code_other']);
- $pattern = '#<a +href\="(.+?)"><img +src\="(.+?)" +alt\="(.+?)" ?/></a>#ui';
-
- if (empty($_POST['captcha']) || empty($_POST['captcha_session']) || !captcha::check($_POST['captcha'], $_POST['captcha_session'])) {
- $design->err(__('??????????? ????? ??????? ???????'));
- } else {
- if (preg_match($pattern, $code_main, $main)) {
- $dcms->log('???????', '????????? ??????? [url=/dpanel/adt.php?id=' . $id_space . ']' . $main[1] . '[/url]');
-
- if ($code_main == $code_other) {
- mysql_query("INSERT INTO `advertising` (`space`, `url_link`, `name`, `url_img`, `page_main`, `page_other`, `time_create`, `time_start`, `time_end`, `bold`)
- VALUES ('" . my_esc($id_space) . "', '" . my_esc($main[1]) . "', '" . my_esc($main[3]) . "', '" . my_esc($main[2]) . "', '1', '1', '" . TIME . "', '0', '0', '0')");
- header('Refresh: 1; url=adt.settings.php?id=' . $id_space);
-
- $doc->msg(__('?????? ??????? ??????????'));
- $doc->ret(__('?????????'), "adt.php?id=$id_space");
- $doc->ret(__('????????? ???????'), 'adt.php');
- $doc->ret(__('???????'), '/dpanel/');
- exit;
- } else {
- mysql_query("INSERT INTO `advertising` (`space`, `url_link`, `name`, `url_img`, `page_main`, `page_other`, `time_create`, `time_start`, `time_end`, `bold`)
- VALUES ('" . my_esc($id_space) . "', '" . my_esc($main[1]) . "', '" . my_esc($main[3]) . "', '" . my_esc($main[2]) . "', '1', '0', '" . TIME . "', '0', '0', '0')");
- $doc->msg(__('?????? ??? ??????? ???????? ??????? ??????????'));
-
- if (preg_match($pattern, $code_other, $other)) {
- mysql_query("INSERT INTO `advertising` (`space`, `url_link`, `name`, `url_img`, `page_main`, `page_other`, `time_create`, `time_start`, `time_end`, `bold`)
- VALUES ('" . my_esc($id_space) . "', '" . my_esc($other[1]) . "', '" . my_esc($other[3]) . "', '" . my_esc($other[2]) . "', '0', '1', '" . TIME . "', '0', '0', '0')");
- $doc->msg(__('?????? ??? ????????? ??????? ??????? ??????????'));
- }
-
- header('Refresh: 1; url=adt.php?id=' . $id_space);
-
- $doc->ret(__('?????????'), "adt.php?id=$id_space");
- $doc->ret(__('????????? ???????'), 'adt.php');
- $doc->ret(__('???????'), '/dpanel/');
- exit;
- }
- }else
- $doc->err(__('?????????? ????????? ???'));
- }
- }
-
- $form = new design();
- $form->assign('method', 'post');
- $form->assign('action', "?id=$id_space&" . passgen());
- $elements = array();
-
- $elements[] = array('type' => 'textarea', 'title' => __('HTML - ??? (??? ???????)'), 'br' => 1, 'info' => array('name' => 'code_main'));
- $elements[] = array('type' => 'textarea', 'title' => __('HTML - ??? (??? ?????????)'), 'br' => 1, 'info' => array('name' => 'code_other'));
-
- $elements[] = array('type' => 'captcha', 'session' => captcha::gen(), 'br' => 1);
-
- $elements[] = array('type' => 'text', 'value' => '* ' . __('???????????? ???? ????????? waplog.net ? ????????'), 'br' => 1);
- $elements[] = array('type' => 'submit', 'br' => 0, 'info' => array('name' => 'create', 'value' => __('???????'))); // ??????
- $form->assign('el', $elements);
- $form->display('input.form.tpl');
-
- $doc->ret(__('?????????'), "adt.php?id=$id_space");
- $doc->ret(__('????????? ???????'), 'adt.php');
- $doc->ret(__('???????'), '/dpanel/');
- ?>