get_row("SELECT * FROM ".$icdb->prefix."sessions WHERE session_id = '".$session_id."' AND registered + valid_period > '".time()."'"); if ($session_details) { $icdb->query("UPDATE ".$icdb->prefix."sessions SET registered = '".time()."', ip = '".$_SERVER['REMOTE_ADDR']."' WHERE session_id = '".$session_id."'"); $is_logged = true; } } get_options(); handle_version(); $currency_list = array_unique(array_merge($paypal_currency_list, $payza_currency_list, $interkassa_currency_list, $egopay_currency_list, $perfect_currency_list, $skrill_currency_list, $bitpay_currency_list)); sort($currency_list); $currency_list = array_unique(array_merge(array("USD"), $currency_list)); $url_base = ((empty($_SERVER["HTTPS"]) || $_SERVER["HTTPS"] == 'off') ? 'http://' : 'https://').$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]; $filename = basename(__FILE__); if (($pos = strpos($url_base, $filename)) !== false) $url_base = substr($url_base, 0, $pos); if (isset($_SESSION['error'])) { $error_message = $_SESSION['error']; unset($_SESSION['error']); } else $error_message = ''; if (isset($_SESSION['ok'])) { $ok_message = $_SESSION['ok']; unset($_SESSION['ok']); } else $ok_message = ''; $pages = array ( 'settings' => array('title' => 'Settings', 'menu' => true), 'types' => array('title' => 'Banner Types', 'menu' => true), 'banners' => array('title' => 'Banners', 'menu' => true), 'embed' => array('title' => 'Embedding', 'menu' => true), 'edit' => array('title' => 'Edit Banner', 'menu' => false), 'edittype' => array('title' => 'Edit Banner Type', 'menu' => false) ); $deafult_page = 'types'; if ($is_logged) { if (isset($_GET['action'])) { switch ($_GET['action']) { case 'logout': if (!empty($session_id)) { $icdb->query("UPDATE ".$icdb->prefix."sessions SET valid_period = '0' WHERE session_id = '".$session_id."'"); } header('Location: admin.php'); exit; break; case 'update-options': if (DEMO_MODE) { $_SESSION['error'] = 'Demo mode. This operation is disabled.'; header('Location: admin.php?page=settings'); exit; } if (empty($_POST["login"])) { $_SESSION['error'] = 'Invalid login value. Empty admin login value is not allowed.'; header('Location: admin.php?page=settings'); exit; } if (isset($_POST['action']) && $_POST['action'] == 'update-options') { populate_options(); if (isset($_POST["enable_approval"])) $options['enable_approval'] = "on"; else $options['enable_approval'] = "off"; if (isset($_POST["enable_paypal"])) $options['enable_paypal'] = "on"; else $options['enable_paypal'] = "off"; if (isset($_POST["enable_payza"])) $options['enable_payza'] = "on"; else $options['enable_payza'] = "off"; if (isset($_POST["payza_sandbox"])) $options['payza_sandbox'] = "on"; else $options['payza_sandbox'] = "off"; if (isset($_POST["enable_skrill"])) $options['enable_skrill'] = "on"; else $options['enable_skrill'] = "off"; if (isset($_POST["enable_interkassa"])) $options['enable_interkassa'] = "on"; else $options['enable_interkassa'] = "off"; if (isset($_POST["enable_authnet"])) $options['enable_authnet'] = "on"; else $options['enable_authnet'] = "off"; if (isset($_POST["authnet_sandbox"])) $options['authnet_sandbox'] = "on"; else $options['authnet_sandbox'] = "off"; if (isset($_POST["enable_egopay"])) $options['enable_egopay'] = "on"; else $options['enable_egopay'] = "off"; if (isset($_POST["enable_perfect"])) $options['enable_perfect'] = "on"; else $options['enable_perfect'] = "off"; if (isset($_POST["enable_bitpay"])) $options['enable_bitpay'] = "on"; else $options['enable_bitpay'] = "off"; if (isset($_POST["enable_stripe"])) $options['enable_stripe'] = "on"; else $options['enable_stripe'] = "off"; $errors = check_options(); if (isset($_POST['password'])) $password = trim(stripslashes($_POST['password'])); else $password = ''; if (isset($_POST['confirm_password'])) $confirm_password = trim(stripslashes($_POST['confirm_password'])); else $confirm_password = ''; if (!empty($password)) { if ($password == $confirm_password) { $options['password'] = md5($password); } else { if ($errors === true) $errors = array('Password and its confirmation are not equal'); else $errors[] = 'Password and its confirmation are not equal'; } } update_options(); if (is_array($errors)) { $_SESSION['error'] = 'The following error(s) exists:'; } else { $_SESSION['ok'] = 'Settings successfully saved!'; } } header('Location: admin.php?page=settings'); exit; break; case 'update-type': if (DEMO_MODE) { $_SESSION['error'] = 'Demo mode. This operation is disabled.'; header('Location: admin.php?page=types'); exit; } if (isset($_POST['action']) && $_POST['action'] == 'update-type') { unset($id); if (isset($_POST["id"]) && !empty($_POST["id"])) { $id = intval($_POST["id"]); $type_details = $icdb->get_row("SELECT t1.*, t2.total_banners, t2.total_amount FROM ".$icdb->prefix."types t1 LEFT JOIN (SELECT type_id, SUM(amount) AS total_amount, COUNT(*) AS total_banners FROM ".$icdb->prefix."banners WHERE status != '".STATUS_DRAFT."' AND deleted = '0' GROUP BY type_id) t2 ON t2.type_id = t1.id WHERE t1.id = '".$id."' AND t1.deleted = '0'"); if (!$type_details) unset($id); } $title = trim(stripslashes($_POST['title'])); $type = intval(trim($_POST["type"])); $slots = intval(trim($_POST["slots"])); if ($type != 0) { foreach($types as $type_tmp) { if ($type_tmp["id"] == $type) { $width = $type_tmp["width"]; $height = $type_tmp["height"]; break; } } } else { $width = intval(trim($_POST["width"])); $height = intval(trim($_POST["height"])); } $error = array(); if (empty($title)) $errors[] = 'Title is too short'; else if (strlen($title) > 128) $errors[] = 'Title is too long'; if ($slots <= 0) $errors[] = 'Number of slots must be higher then zero'; if ($width < 20) $errors[] = 'Width must be 20 or higher'; if ($height < 20) $errors[] = 'Height must be 20 or higher'; if (!empty($id) && $type_details["total_banners"] > 0 && ($width != $type_details["width"] || $height != $type_details["height"])) $errors[] = 'Banner size must be the same, because you have banners of this type'; if (!empty($errors)) { $_SESSION['error'] = 'The following error(s) exists:'; $_SESSION['title'] = $title; $_SESSION['width'] = $width; $_SESSION['height'] = $height; $_SESSION['slots'] = $slots; header('Location: admin.php?page=edittype'.(empty($id) ? '' : '&id='.$id)); exit; } else { if (!empty($id)) { $icdb->query("UPDATE ".$icdb->prefix."types SET title = '".$icdb->escape_string($title)."', width = '".$width."', height = '".$height."', slots = '".$slots."' WHERE id = '".$id."'"); $_SESSION['ok'] = 'Banner Type details successfully updated!'; } else { $icdb->query("INSERT INTO ".$icdb->prefix."types (title, width, height, slots, status, details, registered, deleted) VALUES ( '".$icdb->escape_string($title)."', '".$width."', '".$height."', '".$slots."', '".STATUS_ACTIVE."', '', '".time()."', '0')"); $_SESSION['ok'] = 'New Banner Type successfully added!'; } } } header('Location: admin.php?page=types'); exit; break; case 'delete-type': if (DEMO_MODE) { $_SESSION['error'] = 'Demo mode. This operation is disabled.'; header('Location: admin.php?page=types'); exit; } $id = intval($_GET["id"]); $type_details = $icdb->get_row("SELECT * FROM ".$icdb->prefix."types WHERE id = '".$id."' AND deleted = '0'"); if (intval($type_details["id"]) == 0) { $_SESSION['error'] = 'Record not found!'; header('Location: admin.php?page=types'); exit; } $sql = "UPDATE ".$icdb->prefix."types SET deleted = '1' WHERE id = '".$id."'"; if ($icdb->query($sql) !== false) { $_SESSION['ok'] = 'Record successfully deleted!'; } else { $_SESSION['error'] = 'Record can not be deleted!'; } header('Location: admin.php?page=types'); exit; break; case 'delete-all-types': if (DEMO_MODE) { $_SESSION['error'] = 'Demo mode. This operation is disabled.'; header('Location: admin.php?page=types'); exit; } $sql = "UPDATE ".$icdb->prefix."types SET deleted = '1' WHERE deleted != '1'"; if ($icdb->query($sql) !== false) { $_SESSION['ok'] = 'Records successfully deleted!'; } else { $_SESSION['error'] = 'Records can not be deleted!'; } header('Location: admin.php?page=types'); exit; break; case 'block-type': if (DEMO_MODE) { $_SESSION['error'] = 'Demo mode. This operation is disabled.'; header('Location: admin.php?page=types'); exit; } $id = intval($_GET["id"]); $type_details = $icdb->get_row("SELECT * FROM ".$icdb->prefix."types WHERE id = '".$id."' AND deleted = '0'"); if (intval($type_details["id"]) == 0) { $_SESSION['error'] = 'Record not found!'; header('Location: admin.php?page=types'); exit; } $sql = "UPDATE ".$icdb->prefix."types SET status = '".STATUS_PENDING."' WHERE id = '".$id."'"; if ($icdb->query($sql) !== false) { $_SESSION['ok'] = 'Banner Type successfully blocked!'; } else { $_SESSION['error'] = 'Banner Type can not be blocked!'; } header('Location: admin.php?page=types'); exit; break; case 'unblock-type': if (DEMO_MODE) { $_SESSION['error'] = 'Demo mode. This operation is disabled.'; header('Location: admin.php?page=types'); exit; } $id = intval($_GET["id"]); $type_details = $icdb->get_row("SELECT * FROM ".$icdb->prefix."types WHERE id = '".$id."' AND deleted = '0'"); if (intval($type_details["id"]) == 0) { $_SESSION['error'] = 'Record not found!'; header('Location: admin.php?page=types'); exit; } $sql = "UPDATE ".$icdb->prefix."types SET status = '".STATUS_ACTIVE."' WHERE id = '".$id."'"; if ($icdb->query($sql) !== false) { $_SESSION['ok'] = 'Banner Type successfully unblocked!'; } else { $_SESSION['error'] = 'Banner Type can not be unblocked!'; } header('Location: admin.php?page=types'); exit; break; case 'update-banner': if (DEMO_MODE) { $_SESSION['error'] = 'Demo mode. This operation is disabled.'; header('Location: admin.php?page=banners'); exit; } if (isset($_POST['action']) && $_POST['action'] == 'update-banner') { if (isset($_POST["cid"])) $cid = intval(trim(stripslashes($_POST["cid"]))); else $cid = 0; unset($id); if (isset($_POST["id"]) && !empty($_POST["id"])) { $id = intval($_POST["id"]); $banner_details = $icdb->get_row("SELECT * FROM ".$icdb->prefix."banners WHERE id = '".$id."' AND deleted = '0'"); if (!$banner_details) unset($id); } $type_id = intval($_POST['type_id']); $type_details = $icdb->get_row("SELECT * FROM ".$icdb->prefix."types WHERE id = '".$type_id."' AND deleted = '0'"); if (!$type_details) { if (isset($id)) { $type_id = $banner_details['type_id']; } else { $_SESSION['error'] = 'Banner Type not found!'; header('Location: admin.php?page=edit'.($cid == 0 ? '' : '&cid='.$cid)); exit; } } $title = trim(stripslashes($_POST['title'])); $email = trim(stripslashes($_POST['email'])); $url = trim(stripslashes($_POST['url'])); $days_purchased = trim(stripslashes($_POST['days_purchased'])); $source = intval($_POST['source']); $content = trim(stripslashes($_POST['content'])); $errors = array(); if (!preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/i", $email) && strlen($email) > 0) $errors[] = 'E-mail must be valid e-mail address'; if (!preg_match('|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $url) && strlen($url) > 0) $errors[] = 'URL must be valid URL'; if (!is_numeric($days_purchased) || intval($days_purchased) <= 0) $errors[] = 'Invalid rotation period'; if (isset($_POST['filename'])) $file = trim($_POST['filename']); else if (!empty($id)) $file = $banner_details["file"]; else $file = ''; if ($source == SOURCE2_IMAGE) { if (is_uploaded_file($_FILES["file"]["tmp_name"])) { $ext = ""; if (($pos = strrpos($_FILES["file"]["name"], ".")) !== false) { $ext = strtolower(substr($_FILES["file"]["name"], $pos)); } if ($ext != ".jpg" && $ext != ".jpeg" && $ext != ".gif" && $ext != ".png") $errors[] = 'Banner image must be JPEG, GIF or PNG file'; else { list($width, $height, $imagetype, $attr) = getimagesize($_FILES["file"]["tmp_name"]); if ($width != $type_details["width"] || $height != $type_details["height"]) $errors[] = 'Banner image size must be '.$type_details["width"].'x'.$type_details["height"]; else { $file = "banner_".random_string(16).$ext; if (!move_uploaded_file($_FILES["file"]["tmp_name"], ABSPATH."/files/".$file)) { $errors[] = 'Can not save uploaded banner image'; $file = ""; } else { if (!empty($banner_details["file"]) && empty($errors)) { if (file_exists(ABSPATH."/files/".$banner_details["file"]) && is_file(ABSPATH."/files/".$banner_details["file"])) unlink(ABSPATH."/files/".$banner_details["file"]); } } } } } else if (!file_exists(ABSPATH."/files/".$file) || !is_file(ABSPATH."/files/".$file)) $errors[] = 'Banner image must be uploaded'; } else if ($source == SOURCE2_CONTENT) { } else $errors[] = 'Invalid banner source'; if (!empty($errors)) { $_SESSION['error'] = 'The following error(s) exists:'; $_SESSION['title'] = $title; $_SESSION['email'] = $email; $_SESSION['url'] = $url; $_SESSION['days_purchased'] = $days_purchased; $_SESSION['type_id'] = $type_id; $_SESSION['file'] = $file; $_SESSION['source'] = $source; $_SESSION['content'] = $content; header('Location: admin.php?page=edit'.(empty($id) ? '' : '&id='.$id).($cid == 0 ? '' : '&cid='.$cid)); exit; } else { if (!empty($id)) { $status = $banner_details['status']; if ($status == STATUS_EXPIRED) { if ($banner_details['registered']+24*3600*intval($days_purchased) >= time()) $status = STATUS_ACTIVE; } $icdb->query("UPDATE ".$icdb->prefix."banners SET type_id = '".$type_id."', title = '".$icdb->escape_string($title)."', email = '".$icdb->escape_string($email)."', url = '".$icdb->escape_string($url)."', days_purchased = '".intval($days_purchased)."', status = '".$status."', source = '".$source."', content = '".$icdb->escape_string($content)."', file = '".$icdb->escape_string($file)."' WHERE id = '".$id."'"); $_SESSION['ok'] = 'Banner details successfully updated!'; } else { $icdb->query("INSERT INTO ".$icdb->prefix."banners ( type_id, title, email, url, file, days_purchased, amount, currency, shows_displayed, clicks, id_str, status, details, echo, source, content, registered, blocked, deleted ) VALUES ( '".$type_id."', '".$icdb->escape_string($title)."', '".$icdb->escape_string($email)."', '".$icdb->escape_string($url)."', '".$icdb->escape_string($file)."', '".$icdb->escape_string($days_purchased)."', '0.00', 'USD', '0', '0', '".random_string(16)."', '".STATUS_ACTIVE."', '', '', '".$source."', '".$icdb->escape_string($content)."', '".time()."', '0', '0')"); $_SESSION['ok'] = 'New banner successfully added!'; } } } header('Location: admin.php?page=banners'.($cid == 0 ? '' : '&cid='.$type_id)); exit; break; case 'delete-banner': if (DEMO_MODE) { $_SESSION['error'] = 'Demo mode. This operation is disabled.'; header('Location: admin.php?page=banners'); exit; } if (isset($_GET["cid"])) $cid = intval($_GET["cid"]); else $cid = 0; $id = intval($_GET["id"]); $banner_details = $icdb->get_row("SELECT * FROM ".$icdb->prefix."banners WHERE id = '".$id."' AND deleted = '0'"); if (intval($banner_details["id"]) == 0) { $_SESSION['error'] = 'Record not found!'; header('Location: admin.php?page=banners'.($cid == 0 ? '' : '&cid='.$cid)); exit; } $sql = "UPDATE ".$icdb->prefix."banners SET deleted = '1' WHERE id = '".$id."'"; if ($icdb->query($sql) !== false) { $_SESSION['ok'] = 'Record successfully deleted!'; if ($banner_details["blocked"] == $banner_details["registered"] && !empty($banner_details["email"]) && $options['enable_approval'] == 'on') { $tags = array("{banner_title}"); $vals = array($banner_details["title"]); $body = str_replace($tags, $vals, $options['rejected_email_body']); $mail_headers = "Content-Type: text/plain; charset=utf-8\r\n"; $mail_headers .= "From: ".$options['from_name']." <".$options['from_email'].">\r\n"; $mail_headers .= "X-Mailer: PHP/".phpversion()."\r\n"; mail($banner_details["email"], $banner_details["title"], $body, $mail_headers); $_SESSION['ok'] = 'Record successfully deleted and advertiser notified about rejection!'; } } else { $_SESSION['error'] = 'Record can not be deleted!'; } header('Location: admin.php?page=banners'.($cid == 0 ? '' : '&cid='.$cid)); exit; break; case 'delete-all-banners': if (DEMO_MODE) { $_SESSION['error'] = 'Demo mode. This operation is disabled.'; header('Location: admin.php?page=banners'); exit; } if (isset($_GET["cid"])) $cid = intval($_GET["cid"]); else $cid = 0; $sql = "UPDATE ".$icdb->prefix."banners SET deleted = '1' WHERE deleted != '1'".($cid == 0 ? '' : " AND type_id = '".$cid."'"); if ($icdb->query($sql) !== false) { $_SESSION['ok'] = 'Records successfully deleted!'; } else { $_SESSION['error'] = 'Records can not be deleted!'; } header('Location: admin.php?page=banners'.($cid == 0 ? '' : '&cid='.$cid)); exit; break; case 'block-banner': if (DEMO_MODE) { $_SESSION['error'] = 'Demo mode. This operation is disabled.'; header('Location: admin.php?page=banners'); exit; } if (isset($_GET["cid"])) $cid = intval($_GET["cid"]); else $cid = 0; $id = intval($_GET["id"]); $banner_details = $icdb->get_row("SELECT * FROM ".$icdb->prefix."banners WHERE id = '".$id."' AND deleted = '0'"); if (intval($banner_details["id"]) == 0) { $_SESSION['error'] = 'Record not found!'; header('Location: admin.php?page=banners'.($cid == 0 ? '' : '&cid='.$cid)); exit; } if ($banner_details['status'] != STATUS_ACTIVE) { $_SESSION['error'] = 'Banner can not be blocked!'; header('Location: admin.php?page=banners'.($cid == 0 ? '' : '&cid='.$cid)); exit; } $sql = "UPDATE ".$icdb->prefix."banners SET status = '".STATUS_PENDING."', blocked = '".time()."' WHERE id = '".$id."'"; if ($icdb->query($sql) !== false) { $_SESSION['ok'] = 'Banner successfully blocked!'; } else { $_SESSION['error'] = 'Banner can not be blocked!'; } header('Location: admin.php?page=banners'.($cid == 0 ? '' : '&cid='.$cid)); exit; break; case 'unblock-banner': if (DEMO_MODE) { $_SESSION['error'] = 'Demo mode. This operation is disabled.'; header('Location: admin.php?page=banners'); exit; } if (isset($_GET["cid"])) $cid = intval($_GET["cid"]); else $cid = 0; $id = intval($_GET["id"]); $banner_details = $icdb->get_row("SELECT * FROM ".$icdb->prefix."banners WHERE id = '".$id."' AND deleted = '0'"); if (intval($banner_details["id"]) == 0) { $_SESSION['error'] = 'Record not found!'; header('Location: admin.php?page=banners'.($cid == 0 ? '' : '&cid='.$cid)); exit; } if ($banner_details['status'] != STATUS_PENDING) { $_SESSION['error'] = 'Banner is already unblocked!'; header('Location: admin.php?page=banners'.($cid == 0 ? '' : '&cid='.$cid)); exit; } if (intval($banner_details["blocked"]) >= $banner_details["registered"]) { $registered = time() - $banner_details["blocked"] + $banner_details["registered"]; } else $registered = $banner_details["registered"]; $sql = "UPDATE ".$icdb->prefix."banners SET status = '".STATUS_ACTIVE."', registered = '".$registered."' WHERE id = '".$id."'"; if ($icdb->query($sql) !== false) { $_SESSION['ok'] = 'Banner successfully unblocked!'; if ($banner_details["blocked"] == $banner_details["registered"] && !empty($banner_details["email"]) && $options['enable_approval'] == 'on') { $tags = array("{banner_title}"); $vals = array($banner_details["title"]); $body = str_replace($tags, $vals, $options['approved_email_body']); $mail_headers = "Content-Type: text/plain; charset=utf-8\r\n"; $mail_headers .= "From: ".$options['from_name']." <".$options['from_email'].">\r\n"; $mail_headers .= "X-Mailer: PHP/".phpversion()."\r\n"; mail($banner_details["email"], $banner_details["title"], $body, $mail_headers); $_SESSION['ok'] = 'Banner successfully unblocked and advertiser notified about approval!'; } } else { $_SESSION['error'] = 'Banner can not be unblocked!'; } header('Location: admin.php?page=banners'.($cid == 0 ? '' : '&cid='.$cid)); exit; break; case 'delete-transaction': if (DEMO_MODE) { $_SESSION['error'] = 'Demo mode. This operation is disabled.'; header('Location: admin.php?page=transactions'); exit; } $id = intval($_GET["id"]); $transaction_details = $icdb->get_row("SELECT * FROM ".$icdb->prefix."transactions WHERE id = '".$id."' AND deleted = '0'"); if (intval($transaction_details["id"]) == 0) { $_SESSION['error'] = 'Record not found!'; header('Location: admin.php?page=transactions'); exit; } $sql = "UPDATE ".$icdb->prefix."transactions SET deleted = '1' WHERE id = '".$id."'"; if ($icdb->query($sql) !== false) { $_SESSION['ok'] = 'Record successfully deleted!'; } else { $_SESSION['error'] = 'Record can not be deleted!'; } header('Location: admin.php?page=transactions'); exit; break; default: break; } header('Location: admin.php'); exit; } if (isset($_GET['page'])) { $page = preg_replace('/[^a-zA-Z0-9]/', '', $_GET['page']); if (!array_key_exists($_GET['page'], $pages)) $page = $deafult_page; } else $page = $deafult_page; } else { if (isset($_GET['action'])) { switch ($_GET['action']) { case 'login': if (isset($_POST['password'])) $password = trim(stripslashes($_POST['password'])); else $password = ''; if (isset($_POST['login'])) $login = trim(stripslashes($_POST['login'])); else $login = ''; if ($login == $options['login'] && md5($password) == $options['password']) { $session_id = random_string(16); $icdb->query("INSERT INTO ".$icdb->prefix."sessions (ip, session_id, registered, valid_period) VALUES ('".$_SERVER['REMOTE_ADDR']."', '".$session_id."', '".time()."', '900')"); setcookie('ubm-auth', $session_id, time()+3600*24*180); $_SESSION['ok'] = 'Welcome to admin panel!'.(DEMO_MODE ? ' Admin Panel operates in demo mode for security reasons.' : ''); } else $_SESSION['error'] = 'Invalid login or password!'; header('Location: admin.php'); exit; break; default: break; } header('Location: admin.php'); exit; } $page = 'login'; } ?> <?php echo (array_key_exists($page, $pages) ? $pages[$page]['title'] : 'Login').' - '; ?>Ads Manager
The following error(s) exists:
'; else if (!empty($ok_message)) $message = '
'.$ok_message.'
'; else if (DEMO_MODE) $message = '
Demo mode. Real e-mails and payment details are hidden.
'; else $message = ''; } else $message = '
'.$error_message.'
'; echo $message; if (DEMO_MODE) { $hidden_options = array ( "owner_email" => "", "from_email" => "", "paypal_id" => "", "payza_id" => "", "interkassa_checkout_id" => "", "interkassa_secret_key" => "", "authnet_login" => "", "authnet_key" => "", "authnet_md5hash" => "", "skrill_id" => "", "skrill_secret_word" => "", "egopay_store_id" => "", "egopay_store_pass" => "", "perfect_account_id" => "", "perfect_payee_name" => "", "perfect_passphrase" => "", "bitpay_key" => "", "stripe_secret" => "", "stripe_publishable" => "" ); $options = array_merge($options, $hidden_options); } ?>

General Settings

E-mail for notifications:

All eventual script alerts are sent to this e-mail address.
Sender name:

All statistics messages to advertisers are sent using this name as "FROM:" header value.
Sender e-mail:

All statistics messages to advertisers are sent using this e-mail as "FROM:" header value. It is recommended to set an existing e-mail address.
Statistics e-mail subject:

All set advertisers receive statistics via email when the campaign is ended. This is the subject field of the message.
Statistics e-mail body:

Statistics e-mail body. You can use the following keywords: {banner_title}, {statistics}, {signup_page}.
Sign up page:

URL of the page where where paid advertisers can buy ads space.
Minimum days:

Enter the minimum number of days this type of ad should stay active for.

Admin Settings

Login:

Please set admin access login.
Password:

Please set admin access password. Leave this field blank if you don't want to change current password.
Confirm password:

Please confirm admin access password.

'.$ok_message.''; else $message = ''; } else $message = '
'.$error_message.'
'; echo $message; if (isset($_GET["s"])) $search_query = trim(stripslashes($_GET["s"])); else $search_query = ""; $tmp = $icdb->get_row("SELECT COUNT(*) AS total FROM ".$icdb->prefix."types WHERE deleted = '0'".((strlen($search_query) > 0) ? " AND title LIKE '%".addslashes($search_query)."%'" : "")); $total = $tmp["total"]; $totalpages = ceil($total/RECORDS_PER_PAGE); if ($totalpages == 0) $totalpages = 1; if (isset($_GET["p"])) $page = intval($_GET["p"]); else $page = 1; if ($page < 1 || $page > $totalpages) $page = 1; $switcher = page_switcher("admin.php?page=types".((strlen($search_query) > 0) ? "&s=".rawurlencode($search_query) : ""), $page, $totalpages); $sql = "SELECT t1.*, t2.total_banners, t2.total_amount FROM ".$icdb->prefix."types t1 LEFT JOIN (SELECT type_id, SUM(amount) AS total_amount, COUNT(*) AS total_banners FROM ".$icdb->prefix."banners WHERE status != '".STATUS_DRAFT."' && deleted = '0' GROUP BY type_id) t2 ON t2.type_id = t1.id WHERE t1.deleted = '0'".((strlen($search_query) > 0) ? " AND t1.title LIKE '%".addslashes($search_query)."%'" : "")." ORDER BY registered DESC LIMIT ".(($page-1)*RECORDS_PER_PAGE).", ".RECORDS_PER_PAGE; $rows = $icdb->get_rows($sql); ?>

Banner Types

0 ? '' : ''); ?>
0) { foreach ($rows as $row) { print (' '); } } else { print (' '); } ?>
Title Shortcode Size Slots
'.htmlspecialchars($row['title'], ENT_QUOTES).(!empty($row['preview_url']) ? '
Preview: '.htmlspecialchars(cut_string($row['preview_url'], 30), ENT_QUOTES).'' : '').'
'.htmlspecialchars('', ENT_QUOTES).' '.$row['width'].' x '.$row['height'].' '.$row['slots'].' Edit type details Banners '.($row["status"] == STATUS_ACTIVE ? 'Block type' : '').' '.($row["status"] == STATUS_PENDING ? 'Unblock type' : '').' Delete record
'.((strlen($search_query) > 0) ? 'No results found for "'.htmlspecialchars($search_query, ENT_QUOTES).'"' : 'List is empty.').'

'.$ok_message.''; else $message = ''; } else $message = '
'.$error_message.'
'; echo $message; unset($id); if (isset($_GET["id"]) && !empty($_GET["id"])) { $id = intval($_GET["id"]); $type_details = $icdb->get_row("SELECT * FROM ".$icdb->prefix."types WHERE id = '".$id."' AND deleted = '0'"); if (!$type_details) unset($id); } $values = array(); foreach (array('title', 'slots', 'width', 'height') as $value) { if (isset($_SESSION[$value])) { $values[$value] = $_SESSION[$value]; unset($_SESSION[$value]); } else if (!empty($id)) $values[$value] = $type_details[$value]; else $values[$value] = ''; } ?>

Title:

Please enter banner type title.
Banner size:
" style="text-align: right;"> x " style="text-align: right;">
Select banner size. You can choose standard banner sizes or specify your custom size.
Slots:

Enter number of available slots for this banner type.
'); ?>

'.$ok_message.''; else if (DEMO_MODE) $message = '
Demo mode. Real e-mails are hidden.
'; else $message = ''; } else $message = '
'.$error_message.'
'; echo $message; if (isset($_GET["s"])) $search_query = trim(stripslashes($_GET["s"])); else $search_query = ""; if (isset($_GET["cid"])) { $type_id = intval($_GET["cid"]); $type_details = $icdb->get_row("SELECT * FROM ".$icdb->prefix."types WHERE deleted = '0' AND id = '".$type_id."'"); if (!$type_details) $type_id = 0; } else $type_id = 0; $tmp = $icdb->get_row("SELECT COUNT(*) AS total FROM ".$icdb->prefix."types WHERE deleted = '0'"); $total_types = $tmp["total"]; $tmp = $icdb->get_row("SELECT COUNT(*) AS total FROM ".$icdb->prefix."banners WHERE deleted = '0' AND status != '".STATUS_DRAFT."'".($type_id > 0 ? " AND type_id = '".$type_id."'" : "").((strlen($search_query) > 0) ? " AND (title LIKE '%".addslashes($search_query)."%' OR email LIKE '%".addslashes($search_query)."%')" : "")); $total = $tmp["total"]; $totalpages = ceil($total/RECORDS_PER_PAGE); if ($totalpages == 0) $totalpages = 1; if (isset($_GET["p"])) $page = intval($_GET["p"]); else $page = 1; if ($page < 1 || $page > $totalpages) $page = 1; $switcher = page_switcher("admin.php?page=banners".($type_id > 0 ? "&cid=".$type_id : "").((strlen($search_query) > 0) ? "&s=".rawurlencode($search_query) : ""), $page, $totalpages); $sql = "SELECT t1.*, t2.title AS type_title, t2.deleted AS type_deleted, t2.width, t2.height, t2.preview_url FROM ".$icdb->prefix."banners t1 LEFT JOIN ".$icdb->prefix."types t2 ON t1.type_id = t2.id WHERE t1.deleted = '0' AND t1.status != '".STATUS_DRAFT."'".($type_id > 0 ? " AND t1.type_id = '".$type_id."'" : "").((strlen($search_query) > 0) ? " AND (t1.title LIKE '%".addslashes($search_query)."%' OR t1.email LIKE '%".addslashes($search_query)."%')" : "")." ORDER BY t1.registered DESC LIMIT ".(($page-1)*RECORDS_PER_PAGE).", ".RECORDS_PER_PAGE; $rows = $icdb->get_rows($sql); ?>

Banners 0 ? ' '.htmlspecialchars($type_details['title'], ENT_QUOTES).'' : ''); ?>

0 ? '' : ''); ?> 0 ? '' : ''); ?>
0) { foreach ($rows as $row) { $email = $row['email']; if (DEMO_MODE) { if (($pos = strpos($email, "@")) !== false) { $name = substr($email, 0, strpos($email, "@")); $email = substr($name, 0, 1).'*****'.substr($email, $pos); } } if ($row["status"] < STATUS_PENDING && $row["status"] > STATUS_DRAFT) { if (time() <= $row["registered"] + 24*3600*$row["days_purchased"]) $expired = 'Expires in '.period_to_string($row["registered"] + 24*3600*$row["days_purchased"] - time()); else $expired = 'Expired'; } else $expired = ""; print (' '); } } else { print (' '); } ?>
Banner Type Title E-mail Shows Clicks
'.htmlspecialchars($row['type_title'], ENT_QUOTES).' ('.$row['width'].'x'.$row['height'].')'.($row['type_deleted'] ? ' DEL' : '').' '.(!empty($row['url']) ? '' : '').(empty($row['title']) ? '-' : htmlspecialchars($row['title'], ENT_QUOTES)).(!empty($row['url']) ? '' : '').'
'.$expired.(!empty($row['preview_url']) ? (!empty($expired) ? ', ' : '').' $row["id_str"])).'" target="_blank">live preview' : '').'
'.htmlspecialchars($email, ENT_QUOTES).' '.intval($row["shows_displayed"]).' '.intval($row["clicks"]).' Edit banner details '.($row["status"] == STATUS_ACTIVE ? 'Block banner' : '').' '.($row["status"] == STATUS_PENDING ? 'Unblock banner' : '').' Delete record
'.((strlen($search_query) > 0) ? 'No results found for "'.htmlspecialchars($search_query, ENT_QUOTES).'"' : 'List is empty.').'
 

'.$ok_message.''; else if (DEMO_MODE) $message = '
Demo mode. Real e-mail is hidden.
'; else $message = ''; } else $message = '
'.$error_message.'
'; echo $message; $types = $icdb->get_rows("SELECT * FROM ".$icdb->prefix."types WHERE deleted = '0'"); if (isset($_GET["cid"])) $type_id = intval($_GET["cid"]); else $type_id = 0; unset($id); if (isset($_GET["id"]) && !empty($_GET["id"])) { $id = intval($_GET["id"]); $banner_details = $icdb->get_row("SELECT * FROM ".$icdb->prefix."banners WHERE id = '".$id."' AND deleted = '0'"); if (!$banner_details) unset($id); } $values = array(); foreach (array('title', 'email', 'url', 'days_purchased', 'type_id', 'file', 'source', 'content') as $value) { if (isset($_SESSION[$value])) { $values[$value] = $_SESSION[$value]; unset($_SESSION[$value]); } else if (!empty($id)) $values[$value] = $banner_details[$value]; else $values[$value] = ''; } if ($values['type_id'] == '') $values['type_id'] = $type_id; if (DEMO_MODE) { if (($pos = strpos($values['email'], "@")) !== false) { $nickname = substr($values['email'], 0, strpos($values['email'], "@")); $values['email'] = substr($nickname, 0, 1).'*****'.substr($values['email'], $pos); } } ?>

Banner type:

0 ? 'Select banner type.' : 'Please create at least one banner type.'); ?>
Title:

Please enter banner title.
Banner source:

Please select the source of the banner.
URL:

Please enter banner URL. The banner will be hyperlinked with this URL.
Banner image:

' : ''); ?>
Please select banner image. You can use JPEG, GIF and PNG images. The size of image must be exactly the same as specified in banner type.
HTML Content:

Please enter HTML content. The HTML content is used as is. It is your responsibility to match to website design. To make the banner responsive add class="img img-responsive" to the img tag.
Rotation period:
days
Please enter period of rotation. How many days banner will be in rotation.
E-Mail:

Enter user's e-mail. It is used to send statistics to user.
'); ?> '); ?>

'.$ok_message.''; else if (DEMO_MODE) $message = '
Demo mode. Real e-mails and transaction details are hidden.
'; else $message = ''; } else $message = '
'.$error_message.'
'; echo $message; if (isset($_GET["s"])) $search_query = trim(stripslashes($_GET["s"])); else $search_query = ""; if (isset($_GET["did"])) $banner_id = intval(trim(stripslashes($_GET["did"]))); else $banner_id = 0; $tmp = $icdb->get_row("SELECT COUNT(*) AS total FROM ".$icdb->prefix."transactions WHERE deleted = '0'".($banner_id > 0 ? " AND banner_id = '".$banner_id."'" : "").((strlen($search_query) > 0) ? " AND (payer_name LIKE '%".addslashes($search_query)."%' OR payer_email LIKE '%".addslashes($search_query)."%')" : "")); $total = $tmp["total"]; $totalpages = ceil($total/RECORDS_PER_PAGE); if ($totalpages == 0) $totalpages = 1; if (isset($_GET["p"])) $page = intval($_GET["p"]); else $page = 1; if ($page < 1 || $page > $totalpages) $page = 1; $switcher = page_switcher("admin.php?page=transactions".($banner_id > 0 ? "&did = '".$banner_id."'" : "").((strlen($search_query) > 0) ? "&s=".rawurlencode($search_query) : ""), $page, $totalpages); $rows = $icdb->get_rows("SELECT t1.*, t2.title AS banner_title, t2.url AS banner_url FROM ".$icdb->prefix."transactions t1 LEFT JOIN ".$icdb->prefix."banners t2 ON t1.banner_id = t2.id WHERE t1.deleted = '0'".($banner_id > 0 ? " AND t1.banner_id = '".$banner_id."'" : "").((strlen($search_query) > 0) ? " AND (t1.payer_name LIKE '%".addslashes($search_query)."%' OR t1.payer_email LIKE '%".addslashes($search_query)."%')" : "")." ORDER BY t1.created DESC LIMIT ".(($page-1)*RECORDS_PER_PAGE).", ".RECORDS_PER_PAGE); ?>

Transactions

0 ? '' : ''); ?> 0 ? '' : ''); ?>
0) { foreach ($rows as $row) { $email = $row['payer_email']; $name = $row['payer_name']; if (DEMO_MODE) { if (($pos = strpos($email, "@")) !== false) { $nickname = substr($email, 0, strpos($email, "@")); $email = substr($nickname, 0, 1).'*****'.substr($email, $pos); } if (($pos = strpos($name, "@")) !== false) { $nickname = substr($name, 0, strpos($name, "@")); $name = substr($nickname, 0, 1).'*****'.substr($name, $pos); } } $modals .= '
Banner Payer Amount Status Created
'; $details = explode("&", $row["details"]); foreach ($details as $param) { $param = trim($param); if (!empty($param)) { $data = explode("=", $param, 2); $modals .= ' '; } } $modals .= '
'.htmlspecialchars($data[0], ENT_QUOTES).' '.(DEMO_MODE ? '*****' : htmlspecialchars(urldecode($data[1]), ENT_QUOTES)).'
'; echo ' '.(!empty($row['banner_url']) ? '' : '').(empty($row['banner_title']) ? '-' : htmlspecialchars($row['banner_title'], ENT_QUOTES)).(!empty($row['banner_url']) ? '' : '').' '.htmlspecialchars($name, ENT_QUOTES).'
'.htmlspecialchars($email, ENT_QUOTES).' '.number_format($row['gross'], 2, ".", "").' '.$row['currency'].' '.$row["payment_status"].'
'.$row["transaction_type"].' '.date("Y-m-d H:i", $row['created']).' Delete record '; } } else { print (' '.((strlen($search_query) > 0) ? 'No results found for "'.htmlspecialchars($search_query, ENT_QUOTES).'"' : 'List is empty.').''); } ?>
 

'.$ok_message.''; else $message = ''; } else $message = '
'.$error_message.'
'; echo $message; $url_base = '//'.$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]; $filename = basename(__FILE__); if (($pos = strpos($url_base, $filename)) !== false) $url_base = substr($url_base, 0, $pos); ?>

Embed Ads Manager into your website

  1. Make sure that your website loads jQuery. If it doesn't, just add this line into head section:
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
  2. Add these lines into head section (before </head> tag):
    <link href="css/ubm.css" rel="stylesheet">
    <script src="js/ubm-jsonp.js"></script>
  3. Add banner shortcode (from Banner Types page) in the place where you want to see appropriate banner. Example:
    <a class="ubm-banner" data-id="X"></a>
  4. That's it! Enjoy!

'.$ok_message.''; else $message = ''; } else $message = '
'.$error_message.'
'; //$message = '
Admin Panel is under maintenance. Will be online soon.
'; echo $message; ?>

Admin Panel