getbase(); $session->sessioncheck(); if(isset($_SESSION['token'])) { $token = $_SESSION['token']; if($token != $_GET['token']) { $message = $messages->message('Transaction completed, however token is incorrect. Please contact the shop owner if issues arrive through either e-mail or the contact form. N.B. The shopowner has not been notified of this error.'); $messages->showmessage(); exit; } } else { $messages->message('Transaction completed, however token is incomplete. Please contact the shop owner if issues arrive through either e-mail or the contact form. N.B. The shopowner has not been notified of this error.'); $messages->showmessage(); exit; } /* $item_name = $_POST['item_name']; $item_number = $_POST['item_number']; $payment_status = $_POST['payment_status']; $payment_amount = $_POST['mc_gross']; $payment_currency = $_POST['mc_currency']; $txn_id = $_POST['txn_id']; $receiver_email = $_POST['receiver_email']; $payer_email = $_POST['payer_email']; */ if(isset($_REQUEST['invoice'])) { $paypalinvoice = (int)$_REQUEST['invoice']; } else { $paypalinvoice = null; } $dir = '../../server/config/orders.conf.json'; $invoiceid = $invoicer->invoiceid($dir,'get'); if($paypalinvoice != $invoiceid) { // different invoice ID, check for race condition. // probable race condition. $invoicediff = ($invoiceid - $_SESSION['invoiceid']); if($invoicediff == 1) { $invoicer->invoiceid($dir,'set',$invoiceid+1); } elseif($invoicediff > 1) { // certainly race condition. // mail shop owner here } else { $invoicer->invoiceid($dir,'set',$invoiceid+1); } } else { $shop->invoiceid('set',$invoiceid+1); } $sitecurrency = $shop->getsitecurrency('../../server/config/site.conf.json','../../server/config/currencies.conf.json'); $shippingcountry = $sanitizer->sanitize($_SESSION['shipping_country'],'encode'); $siteconf = $shop->load_json("../../server/config/shipping.conf.json"); $countryprice = $shop->getcountryprice($siteconf,$shippingcountry); if($countryprice != false) { $country_price = (int)$countryprice; } else { $country_price = 10; // default shipping fee. } // mail to shopowner. $setup = new \security\forms\SecureMail(); $siteconf = $shop->load_json("../../server/config/site.conf.json"); $result = $shop->getasetting($siteconf,'site.email'); if($result["site.email"] != '') { if(strlen($result["site.email"]) > 64) { $email = $shop->decrypt($result["site.email"]); } else { $email = $sanitizer->sanitize($result["site.email"],'email'); } } $siteconf = $shop->load_json("../../server/config/site.conf.json"); $result = $shop->getasetting($siteconf,'site.title'); if($result["site.title"] != '') { if(strlen($result["site.title"]) > 10) { $shopname = $sanitizer->sanitize($result["site.title"],'unicode'); } else { $shopname = 'Webshop owner'; } } $body = "Today, a new order was placed in the webshop and paid. Below are the details of the order.".PHP_EOL . PHP_EOL; $body .= "### ORDER ###".PHP_EOL; $body .= ''; $body .= '
'; // Might not load 3rd resources, may have to include static CSS. $body .= ''; $body .= ''; $body .= ''; $body .= ''; $body .= '