prefix."banners WHERE registered+24*3600*days_purchased < '".time()."' AND status = '".STATUS_ACTIVE."' AND deleted = '0'"; $rows = $icdb->get_rows($sql); foreach ($rows as $row) { $sql = "UPDATE ".$icdb->prefix."banners SET status = '".STATUS_EXPIRED."' WHERE id = '".$row["id"]."'"; $icdb->query($sql); if (!empty($row["email"])) { $stats = 'Title: '.htmlspecialchars($row["title"], ENT_QUOTES).' URL: '.$row["url"].' Rotation period: '.$row["days_purchased"].' '.'days Shows: '.$row["shows_displayed"].' Clicks: '.$row["clicks"].' CTR: '.number_format($row["clicks"]*100/$row["shows_displayed"], 2, ".", "").'%'; $tags = array("{banner_title}", "{statistics}", "{signup_page}"); $vals = array(htmlspecialchars($row["title"], ENT_QUOTES), $stats, $options['signup_page']); $body = str_replace($tags, $vals, $options['stats_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($row["email"], $options['stats_email_subject'], $body, $mail_headers); } } $banners = array(); $session_id = time().rand(10000,99999); if (check_options() === true) { $data = stripslashes(trim($_REQUEST['ubm_banners'])); $pairs = explode(",", $data); foreach ($pairs as $pair) { $data = explode(":", $pair); if (sizeof($data) == 2 && is_numeric($data[0]) && is_numeric($data[1])) { $type_id = intval($data[1]); $type_details = $icdb->get_row("SELECT * FROM ".$icdb->prefix."types WHERE id = '".$type_id."' AND deleted = '0'"); if (!$type_details) continue; unset($banner_details); if (($pos = strpos($_SERVER["HTTP_REFERER"], "ubm_show")) !== false) { $id_str = substr($_SERVER["HTTP_REFERER"], $pos + strlen("ubm_show=")); if (($pos = strpos($id_str, "&")) !== false) { $id_str = substr($id_str, 0, $pos); } $banner_details = $icdb->get_row("SELECT * FROM ".$icdb->prefix."banners WHERE type_id = '".$type_id."' AND id_str='".$id_str."' AND deleted = '0' AND id NOT IN (SELECT banner_id FROM ".$icdb->prefix."log WHERE session_id = '".$session_id."' AND type_id = '".$type_id."')"); } if (empty($banner_details)) $banner_details = $icdb->get_row("SELECT * FROM ".$icdb->prefix."banners WHERE type_id = '".$type_id."' AND registered+24*3600*days_purchased >= '".time()."' AND status = '".STATUS_ACTIVE."' AND deleted = '0' AND id NOT IN (SELECT banner_id FROM ".$icdb->prefix."log WHERE session_id = '".$session_id."' AND type_id = '".$type_id."') ORDER BY RAND()"); if (empty($banner_details)) { if (intval($type_details['placeholder_type'] == SOURCE1_DEFAULT)) { if (!preg_match('|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $options['signup_page']) || strlen($options['signup_page']) == 0) $html = ''; else $html = 'Advertise Here'; } else { $html = $type_details['placeholder_content']; } } else { $sql = "UPDATE ".$icdb->prefix."banners SET shows_displayed = shows_displayed + 1 WHERE id = '".$banner_details["id"]."'"; $icdb->query($sql); $sql = "INSERT INTO ".$icdb->prefix."log (banner_id, type_id, session_id, created) VALUES ('".$banner_details["id"]."', '".$type_id."', '".$session_id."', '".time()."')"; $icdb->query($sql); if (intval($banner_details['source']) == SOURCE2_IMAGE) { $html = ''.htmlspecialchars($banner_details['; } else { $html = $banner_details['content']; } } $banners['ubm_'.intval($data[0])] = $html; } } $sql = "DELETE FROM ".$icdb->prefix."log WHERE session_id = '".$session_id."'"; $icdb->query($sql); } $html = json_encode($banners); if ($jsonp_enabled) { $html_object = new stdClass(); $html_object->html = $html; echo $jsonp_callback.'('.json_encode($html_object).')'; } else echo $html; exit; break; case 'ubm_getbox': if (isset($_REQUEST['ubm_url'])) $return_url = trim(stripslashes($_REQUEST['ubm_url'])); else $return_url = ''; $form = ''; if (check_options() === true) { if (!in_array($options['currency'], $interkassa_currency_list)) $options['enable_interkassa'] = "off"; if (!in_array($options['currency'], $paypal_currency_list)) $options['enable_paypal'] = "off"; if (!in_array($options['currency'], $payza_currency_list)) $options['enable_payza'] = "off"; if (!in_array($options['currency'], $egopay_currency_list)) $options['enable_egopay'] = "off"; if (!in_array($options['currency'], $perfect_currency_list)) $options['enable_perfect'] = "off"; if (!in_array($options['currency'], $skrill_currency_list)) $options['enable_skrill'] = "off"; if (!in_array($options['currency'], $bitpay_currency_list)) $options['enable_bitpay'] = "off"; if (!in_array($options['currency'], $stripe_currency_list)) $options['enable_stripe'] = "off"; if ($options['currency'] != 'USD') $options['enable_authnet'] = "off"; $methods = 0; if ($options['enable_paypal'] == "on") $methods++; if ($options['enable_payza'] == "on") $methods++; if ($options['enable_interkassa'] == "on") $methods++; if ($options['enable_authnet'] == "on") $methods++; if ($options['enable_egopay'] == "on") $methods++; if ($options['enable_perfect'] == "on") $methods++; if ($options['enable_skrill'] == "on") $methods++; if ($options['enable_bitpay'] == "on") $methods++; if ($options['enable_stripe'] == "on") $methods++; $sql = "SELECT t1.*, t2.total FROM ".$icdb->prefix."types t1 LEFT JOIN (SELECT type_id, COUNT(*) AS total FROM ".$icdb->prefix."banners WHERE registered+24*3600*days_purchased >= '".time()."' AND status = '".STATUS_ACTIVE."' AND deleted = '0' GROUP BY type_id) t2 ON t2.type_id = t1.id WHERE t1.deleted = '0' AND t1.status = '".STATUS_ACTIVE."' AND (t2.total < t1.slots || t2.total IS NULL)"; $rows = $icdb->get_rows($sql); if ($methods == 0) { $form = '
Ads Manager. Please check settings!
'; } else if (sizeof($rows) == 0) { $form = '
There are no slots available for new banner. Please try again later.
'; } else { if (!preg_match('|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $return_url) || strlen($return_url) == 0) $return_url = $_SERVER["HTTP_REFERER"]; $tac = ''; $terms = htmlspecialchars($options['terms'], ENT_QUOTES); $terms = str_replace("\n", "
", $terms); $terms = str_replace("\r", "", $terms); if (strlen($terms) > 0) { $terms_id = "t".random_string(8); $tac = '
By clicking the button below, I agree with the Terms & Conditions.
'; } $intro = $options['intro']; $intro = str_replace("\n", "
", $intro); $intro = str_replace("\r", "", $intro); $tags = array("{minimum_days}"); $vals = array($options['minimum_days']); $intro = str_replace($tags, $vals, $intro); if (strlen($intro) > 0) $intro = '
'.$intro.'
'; if ($options['enable_paypal'] == "on") $active_method = 'paypal'; else if ($options['enable_payza'] == "on") $active_method = 'payza'; else if ($options['enable_interkassa'] == "on") $active_method = 'interkassa'; else if ($options['enable_authnet'] == "on") $active_method = 'authnet'; else if ($options['enable_egopay'] == "on") $active_method = 'egopay'; else if ($options['enable_perfect'] == "on") $active_method = 'perfect'; else if ($options['enable_skrill'] == "on") $active_method = 'skrill'; else if ($options['enable_bitpay'] == "on") $active_method = 'bitpay'; else if ($options['enable_stripe'] == "on") $active_method = 'stripe'; $form = '
'; } } else $form = '
Ads Manager. Please check settings!
'; $html = $form; if ($jsonp_enabled) { $html_object = new stdClass(); $html_object->html = $html; echo $jsonp_callback.'('.json_encode($html_object).')'; } else echo $html; exit; break; case 'ubm_submit': $html = ''; $id_str = trim($_REQUEST['id_str']); $id_str = preg_replace('/[^a-zA-Z0-9]/', '', $id_str); if (strlen($id_str) < 16) die(); $banner_details = $icdb->get_row("SELECT * FROM ".$icdb->prefix."banners WHERE id_str = '".$id_str."' AND deleted = '0'"); if ($banner_details && $banner_details['status'] != STATUS_DRAFT) die(); if (!$banner_details) { $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, registered, blocked, deleted) VALUES ('0', '', '', '', '', '0', '0.00', 'USD', '0', '0', '".$id_str."', '".STATUS_DRAFT."', '', '', '".time()."', '0', '0')"); $id = $icdb->insert_id; } else $id = $banner_details['id']; $title = trim(stripslashes($_REQUEST['title'])); $email = trim(stripslashes($_REQUEST['email'])); $url = trim(stripslashes($_REQUEST['url'])); $period = intval($_REQUEST['period']); $payment_method = trim(stripslashes($_REQUEST['method'])); $return_url = trim(stripslashes($_REQUEST['return'])); $type = intval($_REQUEST['type']); if (!preg_match('|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $return_url) || strlen($return_url) == 0) $return_url = $_SERVER["HTTP_REFERER"]; if ($title == 'Banner title (required)') $title = ''; if ($url == 'Link (optional)') $url = ''; $error = ''; if (strlen($title) > 128) $error .= '
  • Banner title is too long.
  • '; else if (strlen($title) < 3) $error .= '
  • Banner title is too short.
  • '; if ($email == '') { $error .= '
  • Your e-mail address is required.
  • '; } else if (!preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/i", $email)) { $error .= '
  • You have entered an invalid e-mail address.
  • '; } else if (sizeof($email) > 64) { $error .= '
  • Your email is too long.
  • '; } if ($period < $options['minimum_days']) $error .= '
  • Rotation period must be at least '.$options['minimum_days'].' days.
  • '; if (!preg_match('|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $url) && strlen($url) > 0) { $error .= '
  • Website URL must be valid URL.
  • '; } else if (sizeof($url) > 192) { $error .= '
  • Your website URL is too long.
  • '; } $type_details = $icdb->get_row("SELECT t1.*, t2.total FROM ".$icdb->prefix."types t1 LEFT JOIN (SELECT type_id, COUNT(*) AS total FROM ".$icdb->prefix."banners WHERE registered+24*3600*days_purchased >= '".time()."' AND status = '".STATUS_ACTIVE."' AND deleted = '0' GROUP BY type_id) t2 ON t2.type_id = t1.id WHERE t1.id = '".$type."' AND t1.deleted = '0'"); if (!$type_details) $error .= '
  • Invalid banner type.
  • '; 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") $error .= '
  • 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"]) $error .= '
  • Image size must be '.$type_details["width"].'x'.$type_details["height"].'.
  • '; else { $image = "banner_".md5(microtime().$_FILES["file"]["tmp_name"]).$ext; if (!move_uploaded_file($_FILES["file"]["tmp_name"], ABSPATH."/files/".$image)) { $error .= '
  • Can not save uploaded image.
  • '; } } } } else $error .= '
  • Banner image must be uploaded.
  • '; if ($payment_method == 'interkassa') { if ($options['enable_interkassa'] != 'on') $error .= '
  • Payment method not supported.
  • '; $method ='
    '; } else if ($payment_method == 'payza') { if ($options['enable_payza'] != 'on') $error .= '
  • Payment method not supported.
  • '; $method ='
    '; } else if ($payment_method == 'authnet') { if ($options['enable_authnet'] != 'on') $error .= '
  • Payment method not supported.
  • '; $method = '
    '; } else if ($payment_method == 'skrill') { if ($options['enable_skrill'] != 'on') $error .= '
  • Payment method not supported.
  • '; $method ='
    '; } else if ($payment_method == 'egopay') { if ($options['enable_egopay'] != 'on') $error .= '
  • Payment method not supported.
  • '; $method ='
    '; } else if ($payment_method == 'perfect') { if ($options['enable_perfect'] != 'on') $error .= '
  • Payment method not supported.
  • '; $method ='
    '; } else if ($payment_method == 'bitpay') { if ($options['enable_bitpay'] != 'on') $error .= '
  • Payment method not supported.
  • '; $method ='
    '; } else if ($payment_method == 'stripe') { if ($options['enable_stripe'] != 'on') $error .= '
  • Payment method not supported.
  • '; $method ='
    '; } else { if ($options['enable_paypal'] != 'on') $error .= '
  • Payment method not supported.
  • '; $method ='
    '; } if ($error != '') { $html .= '
    Attention! Please correct the errors below and try again.'; $html .= ''; $html .= '
    '; $icdb->query("UPDATE ".$icdb->prefix."banners SET echo = '".$icdb->escape_string($html)."' WHERE id = '".$id."'"); } else { $amount = number_format($period*$type_details["price"]/REFERENCE_PERIOD_DAYS, 2, ".", ""); $html .= '
    Title:'.(empty($title) ? '-' : htmlspecialchars($title, ENT_QUOTES)).'
    Website:'.(empty($url) ? '-' : ''.htmlspecialchars($url, ENT_QUOTES).'').'
    Banner:'.htmlspecialchars($type_details["title"], ENT_QUOTES).' ('.$type_details["width"].'x'.$type_details["height"].')'.(!empty($type_details['preview_url']) ? '
    $id_str)).'" target="_blank">live preview' : '').'
    E-Mail:'.htmlspecialchars($email, ENT_QUOTES).'
    Price:'.$amount.' '.$options['currency'].'
    Payment method:'.$method.'
    '; if ($payment_method == 'bitpay') { $html .= ' '; } else if ($payment_method == 'stripe') { $html .= ' '; } else { $html .= ' '; } $html .= '
    '; if ($payment_method == 'interkassa') { $params = array(); $params['ik_co_id'] = $options['interkassa_checkout_id']; $params['ik_am'] = number_format($amount, 2, ".", ""); $params['ik_cur'] = $options['currency']; $params['ik_pm_no'] = $id.'-'.time(); $params['ik_desc'] = htmlspecialchars($type_details["title"], ENT_QUOTES).' ('.$type_details["width"].'x'.$type_details["height"].')'; $params['ik_ia_u'] = $url_base.'ipn.php?method=interkassa'; $params['ik_ia_m'] = 'POST'; $params['ik_suc_u'] = $return_url; $params['ik_suc_m'] = 'GET'; $params['ik_fal_u'] = $_SERVER["HTTP_REFERER"]; $params['ik_fal_m'] = 'GET'; $params['ik_x_email'] = $email; $html .= '
    '; foreach($params as $key => $value) { $html .= ' '; } $html .= '
    '; } else if ($payment_method == 'payza') { $html .= '
    '; } else if ($payment_method == 'authnet') { $fp_timestamp = time(); $fp_sequence = $id.time(); $fingerprint = get_fingerprint($options['authnet_login'], $options['authnet_key'], $amount, $fp_sequence, $fp_timestamp); $html .= '
    '; if ($options['authnet_sandbox'] == "on") { $html .= ' '; } else { $html .= ' '; } $style = get_auth_style(); $html .= '
    '; } else if ($payment_method == 'skrill') { $html .= '
    '; } else if ($payment_method == 'egopay') { $data = array(); $data['amount'] = $amount; $data['currency'] = $options['currency']; $data['description'] = htmlspecialchars($type_details["title"], ENT_QUOTES).' ('.$type_details["width"].'x'.$type_details["height"].')'; $data['cf_1'] = $id; $data['success_url'] = $return_url; $data['fail_url'] = $_SERVER["HTTP_REFERER"]; $sdata = serialize($data); $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); $crypttext = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $options['egopay_store_pass'], $sdata, MCRYPT_MODE_ECB, $iv); $hash = base64_encode($crypttext); $hash = str_replace(array('+','/','='), array('-','_',''), $hash); $hash = $options['egopay_store_id'].$hash; $html .= '
    '; } else if ($payment_method == 'perfect') { $html .= '
    '; } else if ($payment_method == 'bitpay') { } else if ($payment_method == 'stripe') { $html .= '
    '; } else { $html .= '
    '; } $html .= '
    '; $icdb->query("UPDATE ".$icdb->prefix."banners SET type_id = '".$type."', title = '".$icdb->escape_string($title)."', email = '".$icdb->escape_string($email)."', url = '".$icdb->escape_string($url)."', days_purchased = '".number_format(floatval($period), 2, ".", "")."', amount = '".number_format(floatval($amount), 2, ".", "")."', currency = '".$options['currency']."', echo = '".$icdb->escape_string($html)."', details = '".$icdb->escape_string($return_url)."', file = '".$icdb->escape_string($image)."' WHERE id = '".$id."'"); } exit; break; case 'ubm_postsubmit': $html = ''; $id_str = trim($_REQUEST['ubm_id_str']); $id_str = preg_replace('/[^a-zA-Z0-9]/', '', $id_str); if (strlen($id_str) < 16) die(); $banner_details = $icdb->get_row("SELECT * FROM ".$icdb->prefix."banners WHERE id_str = '".$id_str."' AND deleted = '0'"); if ($banner_details && $banner_details['status'] != STATUS_DRAFT) die(); $html = $banner_details['echo']; if ($jsonp_enabled) { $html_object = new stdClass(); $html_object->html = $html; echo $jsonp_callback.'('.json_encode($html_object).')'; } else echo $html; exit; break; case 'ubm_bitpayurl': $banner_id = intval($_REQUEST['ubm_id']); $return_url = trim(stripslashes($_REQUEST['ubm_url'])); $banner_details = $icdb->get_row("SELECT * FROM ".$icdb->prefix."banners WHERE id = '".$banner_id."' AND status = '".STATUS_DRAFT."'"); $error = ''; if (!$banner_details) $error .= '
  • Invalid banner details.
  • '; if (empty($error)) { $bitpay_options['orderID'] = $banner_details['id'].'N'.time(); $bitpay_options['itemDesc'] = $banner_details['title']; $bitpay_options['itemCode'] = $banner_details['id']; $bitpay_options['notificationURL'] = $url_base.'ipn.php?method=bitpay';; $bitpay_options['price'] = number_format($banner_details['amount'], 2, ".", ""); $bitpay_options['currency'] = $banner_details['currency']; $bitpay_options['physical'] = 'false'; $bitpay_options['transactionSpeed'] = $options['bitpay_speed']; $bitpay_options['fullNotifications'] = 'false'; $bitpay_options['redirectURL'] = $return_url; $bitpay_options['posData'] = '{"banner_id" : "'.$banner_details['id'].'", "payer_email" : "'.$banner_details['email'].'"}'; $post = json_encode($bitpay_options); $curl = curl_init('https://bitpay.com/api/invoice/'); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, $post); $header = array( 'Content-Type: application/json', 'Content-Length: '.strlen($post), 'Authorization: Basic '.base64_encode($options['bitpay_key']), ); curl_setopt($curl, CURLOPT_PORT, 443); curl_setopt($curl, CURLOPT_HTTPHEADER, $header); curl_setopt($curl, CURLOPT_TIMEOUT, 10); curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC ) ; curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 1); // verify certificate curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2); // check existence of CN and verify that it matches hostname curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_FORBID_REUSE, 1); curl_setopt($curl, CURLOPT_FRESH_CONNECT, 1); $json = curl_exec($curl); curl_close($curl); if ($json === false) { $html = '
    Attention! Please correct the errors below and try again.
    '; } else { $post = json_decode($json, true); if (!$post) { $html = '
    Attention! Please correct the errors below and try again.
    '; } else { if (isset($post['error'])) { $html = '
    Attention! Please correct the errors below and try again.
    '; } else if ($post['status'] != 'new') { $html = '
    Attention! Please correct the errors below and try again.
    '; } else $html = $post['url']; } } } else { $html = '
    Attention! Please correct the errors below and try again.
    '; } if ($jsonp_enabled) { $html_object = new stdClass(); $html_object->html = $html; echo $jsonp_callback.'('.json_encode($html_object).')'; } else echo $html; exit; break; case 'ubm_stripecharge': $banner_id = intval($_REQUEST['ubm_id']); $token = trim(stripslashes($_REQUEST['ubm_token'])); $banner_details = $icdb->get_row("SELECT t1.*, t2.title AS type_title FROM ".$icdb->prefix."banners t1 LEFT JOIN ".$icdb->prefix."types t2 ON t1.type_id = t2.id WHERE t1.id = '".$banner_id."' AND t1.status = '".STATUS_DRAFT."'"); $error = ''; if (!$banner_details) $error .= '
  • Invalid banner details.
  • '; if (empty($error)) { require_once(dirname(__FILE__).'/lib/Stripe.php'); try { Stripe::setApiKey($options['stripe_secret']); $charge = Stripe_Charge::create(array( "amount" => intval($banner_details['amount']*100), "currency" => $banner_details['currency'], "card" => $token, "description" => $banner_details['email']) ); $post = json_decode($charge, true); $response = 'token='.$token; foreach ($post as $key => $value) { if (is_array($value)) $response .= "&".$key."=".urlencode(str_replace('&', ' ', serialize($value))); else $response .= "&".$key."=".urlencode($value); } $sql = "INSERT INTO ".$icdb->prefix."transactions ( banner_id, payer_name, payer_email, gross, currency, payment_status, transaction_type, txn_id, details, created) VALUES ( '".$banner_id."', '".$icdb->escape_string($post['card']['name'])."', '".$icdb->escape_string($banner_details['email'])."', '".floatval($banner_details['amount'])."', '".$banner_details['currency']."', 'Completed', 'Stripe: ".$post['card']['type']."', '".$token."', '".$icdb->escape_string($response)."', '".time()."' )"; $icdb->query($sql); $registered = time(); if ($options['enable_approval'] == 'on') $icdb->query("UPDATE ".$icdb->prefix."banners SET status = '".STATUS_PENDING."', registered = '".$registered."', blocked = '".$registered."' WHERE id = '".$banner_id."'"); else $icdb->query("UPDATE ".$icdb->prefix."banners SET status = '".STATUS_ACTIVE."', registered = '".$registered."', blocked = '0' WHERE id = '".$banner_id."'"); $tags = array("{payer_name}", "{payer_email}", "{amount}", "{currency}", "{type_title}", "{banner_title}", "{transaction_date}", "{gateway}"); $vals = array($post['card']['name'], $banner_details['email'], $banner_details['amount'], $banner_details['currency'], $banner_details["type_title"], $banner_details["title"], date("Y-m-d H:i:s")." (server time)", "Stripe"); send_thanksgiving_email($tags, $vals, $banner_details['email']); $html = '
    Payment successfully completed.
    '; } catch(Exception $e) { $body = $e->getJsonBody(); $err = $body['error']; $html = '
    Attention! Please correct the errors below and try again.
    '; } } else { $html = '
    Attention! Please correct the errors below and try again.
    '; } if ($jsonp_enabled) { $html_object = new stdClass(); $html_object->html = $html; echo $jsonp_callback.'('.json_encode($html_object).')'; } else echo $html; exit; break; default: break; } } ?>