Reklama za sms
include("../scripts/plugins/admgr/include.php"); ?>
function send_ordersms($pkg, $adtype, $price, $post, $quantity, $smskod)
{
if ($post['redeem'] != 1) {
if (!sprawdzmail($post['email'])) {return array(-1,'Nieporawny adres e-mail');}
// if ($post['email'] == '') { return array(-1,'Please supply us with email address to contact you if needed.'); }
if ($post['pay_system'] == '') { return array(-2, 'You need to select the payment system you paid with.'); }
if ($post['transaction_id'] == '') { return array(-3, 'Musisz wpisać kod SMS'); }
if ($pkg['advertise'] != 1) { return array(-10, 'This offer is not available for outside advertisers.'); }
$post['calculated_price'] = 'PLN '.$price;
$refid = $_COOKIE['refid'];
} else {
$details = get_user_details($_SESSION['username']);
$post['username'] = $details['username'];
$post['email'] = $details['email'];
$refid = '';
if ($pkg['v_type'] == 'points') {
$post['calculated_price'] = round($price) . ' points';
$funds = points_totals('all', 'return');
} else {
$post['calculated_price'] = 'PLN '.$price;
$funds = cash_totals('all', 'return');
}
if ($price > $funds) { return array(-8, 'You do not have funds required to redeem for this offer.'); }
if ($pkg['redeemable'] != 1) { return array(-9, 'This offer is not redeemable.'); }
if ($_SESSION['admgr_lastredeem'] > time()-5) { return array(-10, 'Double redemption request detected.'); }
$_SESSION['admgr_lastredeem'] = time();
}
for ($i = 1; $i <= $quantity; $i++) {
if ($post['subject'][$i] == '') { return array(-7, 'Please enter ad description / email subject.'); }
if ($post['link_url'][$i] == '') { return array(-4, 'Please enter here your web link you want to go with your ad.'); }
if (substr($post['link_url'][$i], 0, 7) != 'http://') { return array(-8, 'Wrong link url!
Valid URL Looks like: http://yourhost.com/pages/index.php?refid=you'); }
if (($adtype['type'] == 'ptc') or ($adtype['type'] == 'rotate') or ($adtype['type'] == 'pts')) {
if ($post['banner_url'][$i] == '') { return array(-5, 'Please give us the link to your banner image.'); }
if (substr($post['banner_url'][$i], 0, 7) != 'http://') { return array(-7, 'Wrong banner address!
Valid URL Looks like: http://yourhost.com/banner.gif'); }
} else {
if ($post['ad_text'][$i] == '') { return array(-6, 'Please give us the text of your advertisement.'); }
}
}
//////////////DOTPAY
if ($smskod!='') {
$id = 8457;
$code = $_POST['iden'];
$type = "sms";
$del=1;
$check = $smskod;
if($check == NULL) exit("Prosze wpisac kod");
$handle = fopen("http://dotpay.pl/check_code.php?id=".$id."&code=".$code."&check=".$check."&type=".$type."&del=".$del, 'r');
$status = fgets($handle, 8);
$czas_zycia = fgets($handle, 24);
fclose($handle);
$czas_zycia = rtrim($czas_zycia);
if ($status == 0) {print "Kod niepoprawny.";
exit();
}
else
{
if (!isset($_COOKIE['ActiveCode']))
{
setcookie('ActiveCode',1, time()+$czas_zycia);
}
else
{
setcookie('ActiveCode',0, time()+2, "/");
setcookie('ActiveCode',1, time()+$czas_zycia, "/");
}
echo "ok" ;
} }
/////////////////////////Koniec DotPaY
$post['package_name'] = $adtype['name'].' / '.$pkg['name'];
unset($post['order_ad']);
unset($post['agree_type']);
if (isset($post['res_countries'])) {
$nice = str_replace(array('||', '<>'), array("\n"," = "), $post['res_countries']);
$post['target_countries'] = "\n".$nice;
}
if (isset($post['res_interests'])) {
$nice = str_replace(array('||', '<>'), array("\n"," = "), $post['res_interests']);
$post['target_interests'] = "\n".$nice;
}
$autopro = get_admgr_value('autopro');
if (($autopro == 1) && ($adtype['type'] != 'other') && ($adtype['type'] != 'sponsor')) {
$fpost['pid'] = $post['pid'];
$fpost['redeem'] = $post['redeem'];
$fpost['username'] = $post['username'];
$fpost['email'] = $post['email'];
$fpost['pay_system'] = $post['pay_system'];
$fpost['transaction_id'] = $post['transaction_id'];
$fpost['res_interests'] = $post['res_interests'];
$fpost['res_countries'] = $post['res_countries'];
$hprice = $price / $quantity;
for ($i = 1; $i <= $quantity; $i++) {
$fpost['comments'] = $post['comments'][$i];
$fpost['subject'] = $post['subject'][$i];
$fpost['link_url'] = $post['link_url'][$i];
$fpost['banner_url'] = $post['banner_url'][$i];
$fpost['ad_text'] = $post['ad_text'][$i];
switch ($adtype['type']) {
case 'ptc': $result = ptc_order($pkg['id'], $hprice, $post['redeem'], $fpost); break;
case 'pts': $result = pts_order($pkg['id'], $hprice, $post['redeem'], $fpost); break;
case 'rotate': $result = rotate_order($pkg['id'], $hprice, $post['redeem'], $fpost); break;
case 'text': $result = email_order($pkg['id'], $hprice, $post['redeem'], $fpost); break;
}
}
if ($result) {
$rad = array('description' => $post['subject'], 'name' => $post['username'], 'email' => $post['email'], 'link_url' => $post['link_url'], 'id' => (int)$result);
if ($post['redeem'] == 1) {
insert_accounting($post['username'], $post['package_name'], $pkg['v_type'], -$price);
notify_advertiser($post['email'], 'redeem', $rad);
} else {
notify_advertiser($post['email'], 'purchase', $rad);
}
} else {
return array(-10, 'Error submitting ad. Please try again later or contact us.');
}
$message .= "New Ad Order has been received:\n\n";
if ($refid != '') $message .= "Referrer ID: $refid\n";
$message .= "User: $post[username]\n";
$message .= "EMail: $post[email]\n";
$message .= "Payment Method: ".($post['redeem'] == 1 ? "Redemption" : $post['pay_system'] . ' / ' . $post['transaction_id'])."\n";
$message .= "Ad Item: $post[package_name]\n";
$message .= "Quantity: $quantity\n";
$message .= "Total Price: $post[calculated_price]\n\n";
$message .= "Note: Verify that the payment has been made before approving an ad.\n\n";
for ($i = 1; $i <= $quantity; $i++) {
$message .= "Ad #$i Details:\n";
$message .= "Advertiser's Comment: ".$post['comments'][$i]."\n";
$message .= "Ad Description: ".$post['subject'][$i]."\n";
$message .= "Paid-Link URL: ".$post['link_url'][$i]."\n";
if (($adtype['type'] == 'ptc') or ($adtype['type'] == 'rotate') or ($adtype['type'] == 'pts')) {
$message .= "Banner URL: ".$post['banner_url'][$i]."\n\n";
} else {
$message .= "Ad Text: ".$post['ad_text'][$i]."\n\n";
}
}
$message .= "Target Countries: $post[target_countries]\n";
$message .= "Target Interests: $post[target_interests]\n";
} else {
$rad = array('description' => $post['subject'], 'name' => $post['username'], 'email' => $post['email'], 'link_url' => $post['link_url'], 'id' => "None");
if ($post['redeem'] == 1) {
insert_accounting($post['username'], $post['package_name'], $pkg['v_type'], -$price);
notify_advertiser($post['email'], 'redeem', $rad);
} else {
notify_advertiser($post['email'], 'purchase', $rad);
}
$message .= "New Ad Order has been received:\n\n";
if ($refid != '') $message .= "Referrer ID: $refid\n";
$message .= "User: $post[username]\n";
$message .= "EMail: $post[email]\n";
$message .= "Payment Method: ".($post['redeem'] == 1 ? "Redemption" : $post['pay_system'] . ' / ' . $post['transaction_id'])."\n";
$message .= "Ad Item: $post[package_name]\n";
$message .= "Quantity: $quantity\n";
$message .= "Total Price: $post[calculated_price]\n\n";
$message .= "Note: Verify that the payment has been made before approving an ad.\n\n";
for ($i = 1; $i <= $quantity; $i++) {
$message .= "Ad #$i Details:\n";
$message .= "Advertiser's Comment: ".$post['comments'][$i]."\n";
$message .= "Ad Description: ".$post['subject'][$i]."\n";
$message .= "Paid-Link URL: ".$post['link_url'][$i]."\n";
if (($adtype['type'] == 'ptc') or ($adtype['type'] == 'rotate') or ($adtype['type'] == 'pts')) {
$message .= "Banner URL: ".$post['banner_url'][$i]."\n\n";
} else {
$message .= "Ad Text: ".$post['ad_text'][$i]."\n\n";
}
}
$message .= "Target Countries: $post[target_countries]\n";
$message .= "Target Interests: $post[target_interests]\n";
}
if ($post['redeem'] == 1) {
admgr_sendemail(redemption_email, "New redemption request has been received.", $message, $post['email'], $post['username']);
} else {
admgr_sendemail(advertising_email, "New Ad Order has been received.", $message, $post['email'], $post['username']);
}
return array(1, 'Your order has been submited.
We will contact you soon.');
}
?>