function placeAutobid($preference, $loansToAutolend, $possibleBids, $lenderId, $desiredInt, $MaxdesiredInt) { global $database, $session, $form; $amntToLend = 0; $amountTobid = 0; $processed = array(); Logger_Array("AutoBid---LOG", 'laon count line no 74', count($loansToAutolend)); $loans = $session->getLoansForBid($preference, $loansToAutolend, $processed); Logger_Array("AutoBid---LOG", 'No of Loans line no 76', count($loans)); $fullyFunded = array(); if (!empty($loans)) { while (1) { if (count($loans) == 1) { Logger_Array("AutoBid---LOG", 'Log only one loan left Line No', '84'); if ($possibleBids) { $totBid = $database->getTotalBid($loans[0]['borrowerid'], $loans[0]['loanid']); $totAutoBid = $database->getTotalAutoBid($loans[0]['loanid']); $reqdamt = $loans[0]['reqdamt']; $StillNeeded = bcsub($reqdamt, $totBid, 2); $amountcanBid = AUTO_LEND_AMT * $possibleBids; if ($StillNeeded > 0) { if ($StillNeeded >= $amountcanBid) { $amountTobid = $amountcanBid; } else { if ($StillNeeded < $amountcanBid) { $amountTobid = $StillNeeded; } } if ($MaxdesiredInt < $loans[0]['intOffer']) { $intToPlaceBid = $MaxdesiredInt; } else { $intToPlaceBid = $loans[0]['intOffer']; } $LoanbidId = 0; /* Added By Mohit 20-01-14 To get Last manully Bid Detail*/ if ($preference == 6) { $status = $session->getStatusBar($loans[0]['borrowerid'], $loans[0]['loanid'], 5); $lastBid = $database->lastBidDetail($loans[0]['loanid'], $lenderId); if (!is_array($lastBid)) { continue; } if (array_filter($lastBid)) { $lastBidAmnt = $lastBid['amnt']; $lastBidIntr = $lastBid['intr']; if ($desiredInt < $lastBidIntr && $lastBidIntr < $MaxdesiredInt) { $intToPlaceBid = $lastBidIntr; } elseif ($desiredInt > $lastBidIntr) { $intToPlaceBid = $desiredInt; } else { $intToPlaceBid = $MaxdesiredInt; } $biddedAmnt = $loans[0]['reqdamt'] * $status / 100; $reqAmnt = $loans[0]['reqdamt'] - $biddedAmnt; $amountTobid = min($lastBidAmnt, $reqAmnt); } } /***** End here *****/ $amountTobid = min($amountTobid, AUTO_LEND_AMT); if ($amountTobid + $totAutoBid <= $loans[0]['reqdamt'] / 2) { $LoanbidId = $session->placebid($loans[0]['loanid'], $loans[0]['borrowerid'], $amountTobid, $intToPlaceBid, 1, true, $lenderId); } if (is_array($LoanbidId)) { $database->addAutoLoanBid($LoanbidId['loanbid_id'], $lenderId, $loans[0]['borrowerid'], $loans[0]['loanid'], $amountTobid, $intToPlaceBid); Logger_Array("Entry in Autolend Table IF loan==1", 'Loan BidID', 'LenderId', 'Loan id', 'BorrowerId', 'Amnt to lend', 'Intrest', $LoanbidId['loanbid_id'], $lenderId, $loans[0]['loanid'], $loans[0]['borrowerid'], $amountTobid, $intToPlaceBid); $possibleBids = 0; $processed[] = $loans[0]['loanid']; unset($loans[0]); } else { $processed[] = $loans[0]['loanid']; unset($loans[0]); } } } } //$loans = $session->getLoansForBid($preference, $loansToAutolend, $processed); if (empty($loans)) { Logger_Array("AutoBid---LOG", 'No Loan Line No', '141'); break; } if (!$possibleBids) { Logger_Array("AutoBid---LOG", 'No possible bids', '143'); break; } if (count($loans) > 1) { foreach ($loans as $key => $loan) { if ($possibleBids) { $status = $session->getStatusBar($loan['borrowerid'], $loan['loanid'], 5); if ($status >= 100) { unset($loans[$key]); $processed[] = $loan['loanid']; $fullyFunded[] = $loan['loanid']; } else { $totAutoBid = $database->getTotalAutoBid($loan['loanid']); if ($MaxdesiredInt < $loan['intOffer']) { $intToPlaceBid = $MaxdesiredInt; } else { $intToPlaceBid = $loan['intOffer']; } /* Added By Mohit 20-01-14 To get Last manully Bid Detail*/ $LoanbidId = 0; if ($preference == 6) { $lastBid = $database->lastBidDetail($loan['loanid'], $lenderId); if (!is_array($lastBid)) { continue; } if (array_filter($lastBid)) { $lastBidAmnt = $lastBid['amnt']; $lastBidIntr = $lastBid['intr']; if ($desiredInt < $lastBidIntr && $lastBidIntr < $MaxdesiredInt) { $intToPlaceBid = $lastBidIntr; } elseif ($desiredInt > $lastBidIntr) { $intToPlaceBid = $desiredInt; } else { $intToPlaceBid = $MaxdesiredInt; } $biddedAmnt = $loan['reqdamt'] * $status / 100; $reqAmnt = $loan['reqdamt'] - $biddedAmnt; $amntToLend = min($lastBidAmnt, $reqAmnt); } } else { $amntToLend = AUTO_LEND_AMT; } $amntToLend = min($amntToLend, AUTO_LEND_AMT); if ($amntToLend + $totAutoBid <= $loan['reqdamt'] / 2) { $LoanbidId = $session->placebid($loan['loanid'], $loan['borrowerid'], $amntToLend, $intToPlaceBid, 1, true, $lenderId); } if (is_array($LoanbidId)) { $database->addAutoLoanBid($LoanbidId['loanbid_id'], $lenderId, $loan['borrowerid'], $loan['loanid'], $amntToLend, $intToPlaceBid); unset($loans[$key]); $processed[] = $loan['loanid']; $possibleBids--; } else { $form->num_errors = 0; unset($loans[$key]); $processed[] = $loan['loanid']; } } } } } if (!$possibleBids) { Logger_Array("AutoBid---LOG", 'No possible bids2', '5921'); break; } if (empty($loans)) { //$loans = $session->getLoansForBid($preference, $loansToAutolend, $processed); if (empty($loans)) { Logger_Array("AutoBid---LOG", 'Log Endign here Lien no', '5928'); break; } } } } Logger_Array("AutoBid---LOG", 'fully funded loan ID line 5935', $fullyFunded); return $fullyFunded; }
if (!$database) { Logger_Array("cvError_db_connecttion", 'database connection error'); } if (isset($order_id)) { $order_detail = $database->GetOrderDetail($order_id); Logger_Array("cvError_order_detail", $order_detail); } if (empty($order_detail) && isset($_SESSION['PaidGiftcardCart'])) { $order_detail = $database->GetOrderDetailbyCustom($_SESSION['PaidGiftcardCart']); Logger_Array("cvError_order_detail", $order_detail); unset($_SESSION['PaidGiftcardCart']); } if (empty($order_detail) && isset($_SESSION['gifcardids'])) { $order_detail = $database->GetOrderDetailPaynow($_SESSION['gifcardids']); unset($_SESSION['gifcardids']); Logger_Array("cvError_order_detail", $order_detail); } ?> <div class="row"> <div class="span16"> <?php if (empty($order_detail)) { echo ""; } else { echo "<br>"; if ($order_detail[0]['order_type'] == 'print') { echo "Thanks for your gift card purchase! Please review your order details below:"; echo "<br>"; foreach ($order_detail as $rows) { $amt = number_format($rows['card_amount'], 2, '.', ','); $to = $rows['to_name'];
function writeFile($filename, $language) { global $db; $q = "SELECT count(id) from ! where mainkey=? and lang=?"; $count = $db->getOne($q, array('labels', $filename, 'en')); if ($count == 0) { return -2; } $p = "SELECT * from ! where mainkey=? and lang=?"; $data = $db->getAll($p, array('labels', $filename, $language)); if ($count != count($data)) { return -1; } $res1 = is_dir("editables/" . $language); if ($res1 != 1) { $res2 = mkdir("editables/" . $language, 0777, true); } $fp = fopen("editables/" . $language . "/" . $filename . ".php", "w"); $String = "<?php"; foreach ($data as $row) { $String .= "\n\$" . "lang['" . $row['mainkey'] . "']['" . $row['subkey'] . "']='" . addslashes(stripslashes(str_replace('"', "'", $row['text']))) . "';"; } $String .= "\n?>"; fwrite($fp, $String); fclose($fp); if (file_exists("editables/" . $language . "/" . $filename . ".php")) { Logger_Array("Label file download", 'mainkey, subkey, language', $row['mainkey'], $row['subkey'], $language); return 1; } else { return 0; } }
<input type="hidden" name="uploadedDocs[]" value="<?php echo $docuploaded['addresProof']; ?> " /> <input type="hidden" name="additional_verification" /> <input type="hidden" name="before_fb_data" id="before_fb_data" /> <input type="hidden" name="fb_data" id="fb_data" value='<?php if (!empty($save_fb_data)) { echo urlencode(addslashes(base64_decode($save_fb_data))); } else { echo urlencode(addslashes(serialize($fbData))); } ?> '/> <?php Logger_Array("FB LOG - on b_editprofile", 'fbData1', serialize($fbData) . $username); ?> <input type="hidden" name="uploadfileanchor" id="uploadfileanchor" /> <input type="hidden" name="user_guess" value="<?php echo generateToken('additional_verification'); ?> "/> <input type="hidden" name="id" value="<?php echo $id; ?> "/> <?php if ($borrowerActive != 1) { ?>
// return response curl_setopt($ch, CURLOPT_TIMEOUT, 20); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_POSTFIELDS, $body); if ($rtn == 0) { $result = curl_exec($ch); $xml = simplexml_load_string($result); } else { echo "We were unable to process the transaction. Please verify that the information entered is accurate and try again, or complete the transaction using a different payment method."; Logger_Array("before curl execution", $rtn); curl_close($ch); exit; } Logger_Array("transaction result original", $result); Logger_Array("transaction result in array", $xml); curl_close($ch); $txn_status = $database->getTransactionStatus($invoiceid); if (strtoupper($txn_status) == 'START') { if ($rtn == 0) { $rawid = $database->saveRawIPNPaySimple($result); if ($rawid == 0) { $rtn = 1; } } $res = $xml['Success']; if (strtoupper($res) == strtoupper('TRUE')) { if (isset($_POST['addPayment'])) { if ($rtn == 0) { $database->startDbTxn(); $rest = $database->updatePaySimpleTxn($invoiceid, $rawid, $orderamt, $donation, 1);
function GetOrderDetail($id) { global $db; $q = "SELECT * from ! where txn_id = ? AND status = ? order by id"; $res = $db->getAll($q, array('gift_cards', $id, 1)); if (empty($res)) { Logger_Array("cvError_giftorderDetail", 'Rows not found'); } return $res; }
} $order_amount = $database->GetOrderAmount($order_id); $paypal_amount = $order_amount['amount']; Logger_Array("cvError", 'paypal_amount before adding paypal transaction', $paypal_amount); if ($paypal_amount > 0) { $paypal_donation = $order_amount['donation']; $paypalTranFee = $database->getAdminSetting('PaypalTransaction'); $paypalTranAmount = $paypal_amount * $paypalTranFee / 100; $totalAmt = $paypal_amount + $paypalTranAmount + $paypal_donation; $totalAmt = number_format($totalAmt, 2, '.', ''); $userid = 0; if (!empty($session->userid)) { $userid = $session->userid; } $invoiceid = $database->addNewPayPalTxn($userid, $paypal_amount, $paypalTranAmount, $paypal_donation, $totalAmt, 'START', $custom, 'gift'); Logger_Array("cvError", 'invoiceid after adding paypal transaction', $invoiceid); if (!empty($invoiceid)) { $bodyLoad = 1; $res = $database->setInvoiceId($order_id, $invoiceid); } } } if ($bodyLoad) { ?> <body onload="validate_form(document.form1)"> <div style="font-family:verdana,arial,helvetica,sans-serif;font-size:11px"> <center> Please wait while your transaction is being processed. <center> </div> <?php
function additional_verification() { global $session, $form; $id = $session->userid; $_POST_ORG = $_POST; //Logger_Array("FB LOG - updateprocess start",'fb_data', serialize($_POST['fb_data']).$_POST["busername"]); $_POST = sanitize_custom($_POST); for ($i = 1; $i <= 10; $i++) { $endorser_name[] = $_POST['endorser_name' . $i]; $endorser_email[] = $_POST['endorser_email' . $i]; $endorser_id[] = $_POST['endorser_id' . $i]; } if ($_POST['before_fb_data'] == '1') { $_SESSION['fb_data'] = $_POST; header('Location: index.php?p=111&fb_data=1#FB_cntct'); } else { if (isset($_FILES['front_national_id']['tmp_name']) && !is_uploaded_file($_FILES['front_national_id']['tmp_name']) && !empty($_POST['isFrntNatid'])) { $_FILES['front_national_id']['tmp_name'] = $_POST['isFrntNatid']; $_FILES['front_national_id']['name'] = end(explode("/", $_POST['isFrntNatid'])); } if (isset($_FILES['address_proof']['tmp_name']) && !is_uploaded_file($_FILES['address_proof']['tmp_name']) && !empty($_POST['isaddrprf'])) { $_FILES['address_proof']['tmp_name'] = $_POST['isaddrprf']; $_FILES['address_proof']['name'] = end(explode("/", $_POST['isaddrprf'])); } if (!empty($_POST["uploadfileanchor"])) { $result = 2; } else { Logger_Array("FB LOG - updateprocess", 'fb_data', serialize($_POST['fb_data']) . $_POST["busername"]); $result = $session->additional_verification($id, $_POST["labellang"], $_FILES, $_POST['submitform'], $_POST['uploadedDocs'], $_POST['fb_data'], $endorser_name, $endorser_email, $endorser_id); } if ($result == 0) { require "editables/register.php"; $path = getEditablePath('register.php'); require "editables/" . $path; if ($_POST['submitform'] != trim($lang['register']['RegisterComplete'])) { $_SESSION['bedited'] = true; } if (isset($_POST["labellang"]) && $_POST["labellang"] != "en") { $url = SITE_URL . $_POST["labellang"] . "/index.php?p=111"; } else { if (isset($_GET["language"])) { $language = $_GET["language"]; $url = SITE_URL . $language . "/index.php?p=111"; } else { $url = SITE_URL . "index.php?p=111"; } } if ($_POST['submitform'] == trim($lang['register']['RegisterComplete'])) { $url = SITE_URL . "index.php?p=50"; } header("Location: {$url}"); } else { $_SESSION['value_array'] = $_POST_ORG; $_SESSION['error_array'] = $form->getErrorArray(); $errurl1 = $_SERVER['HTTP_REFERER']; if (strstr($errurl1, "fb_join")) { $errurl = $errurl1; } else { $errurl = $errurl1 . "&fb_join=1"; } $supported = array("image/gif", "image/jpeg", "image/pjpeg", "image/png", "image/x-png", "application/pdf"); if (isset($_FILES['front_national_id']['type'])) { $frntidtype = $_FILES['front_national_id']['type']; } if (isset($_FILES['address_proof']['type'])) { $addrsype = $_FILES['address_proof']['type']; } if (isset($_FILES['front_national_id']['tmp_name']) && !empty($_FILES['front_national_id']['tmp_name']) && in_array($frntidtype, $supported)) { chmod($_FILES['front_national_id']['tmp_name'], 0644); $time = time(); if ($_FILES['front_national_id']['tmp_name'] == "image/gif") { $frntnatid = $time . ".gif"; } else { if ($_FILES['front_national_id']['tmp_name'] == "image/jpeg" || $_FILES['front_national_id']['tmp_name'] == "image/pjpeg") { $frntnatid = $time . ".jpeg"; } else { if ($_FILES['front_national_id']['tmp_name'] == "image/png" || $_FILES['front_national_id']['tmp_name'] == "image/x-png") { $frntnatid = $time . ".png"; } else { $frntnatid = $_FILES['front_national_id']['name']; } } } move_uploaded_file($_FILES['front_national_id']['tmp_name'], TMP_IMAGE_DIR . $frntnatid); $_SESSION['value_array']['isFrntNatid'] = TMP_IMAGE_DIR . $frntnatid; } if (isset($_FILES['address_proof']['tmp_name']) && !empty($_FILES['address_proof']['tmp_name']) && in_array($addrsype, $supported)) { chmod($_FILES['address_proof']['tmp_name'], 0644); $time = time(); if ($_FILES['address_proof']['tmp_name'] == "image/gif") { $addrprf = $time . ".gif"; } else { if ($_FILES['address_proof']['tmp_name'] == "image/jpeg" || $_FILES['address_proof']['tmp_name'] == "image/pjpeg") { $addrprf = $time . ".jpeg"; } else { if ($_FILES['address_proof']['tmp_name'] == "image/png" || $_FILES['address_proof']['tmp_name'] == "image/x-png") { $addrprf = $time . ".png"; } else { $addrprf = $_FILES['address_proof']['name']; } } } move_uploaded_file($_FILES['address_proof']['tmp_name'], TMP_IMAGE_DIR . $addrprf); $_SESSION['value_array']['isaddrprf'] = TMP_IMAGE_DIR . $addrprf; } if ($result == 1) { if (!empty($_SESSION['error_array']['front_national_id'])) { $errurl = 'index.php?p=111' . "#front_national_iderr"; } else { if (!empty($_SESSION['error_array']['address_proof'])) { $errurl = 'index.php?p=111' . "#address_prooferr"; header("Location: {$errurl}"); } else { $url = $_SERVER['HTTP_REFERER']; if (strstr($url, "fb_join")) { header("Location: {$url}" . $_POST["uploadfileanchor"]); } else { // redirect to borrower form after file upload. $_POST["uploadfileanchor"] contains an anchor header("Location: {$url}&fb_join=1" . $_POST["uploadfileanchor"]); } } } } } } }
} else { if ($_POST["MessType"] == "Delete") { $senderid = $_POST["Senderid1"]; $parentid = $_POST["parentid"]; $forumid = $_POST["forumid"]; if ($session->userid == $senderid || $session->userid == ADMIN_ID || $grp_leader === $session->userid) { Logger_Array("deletegrpComment-MessType-Delete", $session->userid, $parentid, $senderid, $forumid); $result = $database->deletegrpComment($parentid, $senderid, $forumid); } } else { if ($_POST["MessType"] == "DeleteReal") { $senderid = $_POST["Senderid1"]; $parentid = $_POST["parentid"]; $forumid = $_POST["forumid"]; if ($session->userid == $senderid || $session->userid == ADMIN_ID || $grp_leader === $session->userid) { Logger_Array("deletegrpComment-MessType-DeleteReal", $session->userid, $parentid, $senderid, $forumid); $result = $database->deleteGrpCommentReal($parentid, $senderid, $forumid); } } } } } if ($return == 82) { header("Location: index.php?p=82&gid={$grp_id}" . $backComment); } function rebuildTree($parentId, $left, $thread, $db = null) { $right = $left + 1; $query = 'SELECT a.id FROM zi_comment AS a WHERE a.parentId = ' . (int) $parentId . ' ORDER BY a.left'; $childIds = ($childIds = $db->getAll($query)) ? $childIds : array(); $i = 0;
function newLoanApplication() { /* Function will use only from cron jobs */ global $database; $res = $database->getEvents(NEW_LOAN_APPLICATION); foreach ($res as $row) { $event_fields = explode(',', $row['event_fields']); $loanid = $event_fields[0]; $oldLoanid = $event_fields[1]; $userid = $event_fields[2]; $bname = $database->getNameById($userid); $lenders = $database->getLendersEmailForLoanApp($oldLoanid); $repay_date = $database->getRepaidDate($userid, $oldLoanid); $i = 0; foreach ($lenders as $lender) { $this->sendNewLoanAppMailToLender($loanid, $lender['Email'], $lender['FirstName'] . ' ' . $lender['LastName'], $userid, $bname, $repay_date); $i++; } Logger_Array("New Loan App Mails", 'Total mails sent, loanid', $i, $loanid); $database->updateEvent($row['id']); } }
} if (!empty($processCart)) { if (is_array($processCart)) { Logger("In Paypaldetails redirecting to bid page\n"); $_SESSION['lender_bid_success1'] = 1; $_SESSION['lender_bid_success_amt'] = $processCart['bidamt']; $_SESSION['lender_bid_success_int'] = $processCart['bidint']; echo "<SCRIPT type='text/javascript'>\n\t\t\t\t\t\tbidRedirect(" . $processCart['loanid'] . ", " . $processCart['borrowerid'] . ", " . '1' . "); \n\t\t\t\t\t</SCRIPT>"; } else { Logger("In Paypaldetails redirecting to giftcard page \n" . $_GET['cm']); $_SESSION['PaidGiftcardCart'] = $_GET['cm']; echo "<SCRIPT type='text/javascript'>\n\t\t\t\t\t\t\t\thdrRedirect(); \n\t\t\t\t\t\t\t</SCRIPT>"; } } } elseif (!empty($rtn) && $rtn['txn_type'] == 'gift') { echo "<SCRIPT type='text/javascript'>\n\t\t\t\thdrRedirect(); \n\t\t\t\t</SCRIPT>"; } else { Logger_Array("cvError", 'paypal transaction update failed, transaction-id', $_GET['tx']); echo "<div align='center'><font color=green><b>Thank you! The transaction is not yet complete. We will update your <a href='index.php?p=16&u={$session->userid}'>Account</a> when the transaction is completed by Paypal.</b></font></div>"; echo "<br/><br/>"; echo "<div align='left'><b>Paypal Transaction Id:</b> " . $_GET['tx'] . "</div>"; } } else { if (isset($_GET['tx'])) { echo "<div align='center'><font color=green><b>Thank you! The transaction is not yet complete. We will update your <a href='index.php?p=16&u={$session->userid}'>Account</a> when the transaction is completed by Paypal.</b></font></div>"; echo "<br/><br/>"; echo "<div align='left'><b>Paypal Transaction Id:</b> " . $_GET['tx'] . "</div>"; } } ?> </div>
if ($donated_amt > 0) { $paypalTranAmount = $paypal_amount * $paypalTranFee / 100; /* $donated_amt replace by $paypal_amount on date 20-01-14 */ } elseif (isset($_POST['addPayment'])) { $paypalTranAmount = $_POST['paypal_amount'] * $paypalTranFee / 100; } else { $paypalTranAmount = 0; } $totalAmt = $paypal_amount + $paypalTranAmount + $paypal_donation; $totalAmt = number_format($totalAmt, 2, '.', ''); $invoiceid = $database->addNewPayPalTxn($session->userid, $paypal_amount, $paypalTranAmount, $paypal_donation, $totalAmt, 'START', $custom); if (isset($_POST['bid_paypal_amount'])) { $database->setBidInvoice($_SESSION['bidPaymentId'], $invoiceid); } if (isset($_POST['lending_cart_paypal'])) { Logger_Array("lending cart payment", $_POST['lending_cart_paypal']); $database->setLendingCartInvoice($invoiceid); $_SESSION['PayLendingCart'] = 1; } ?> <form name='form1' id='form1' action=<?php echo PAYPALADDRESS; ?> method="post"> <input type="hidden" name="cmd" value="_cart"> <input type="hidden" name="upload" value="1"> <input type="hidden" name="business" value=<?php echo PAYPAL_ACCOUNT; ?> > <input type="hidden" name="item_name_1" value="Add to Zidisha Account">
if (isset($_SESSION['order_id'])) { $time = time(); $custom = md5($time); $order_id = $_SESSION['order_id']; $order_amount = $database->GetOrderAmount($order_id); $amount = $order_amount['amount']; Logger_Array("cvError_amount", $amount); if (!isset($session->userid)) { $userid = 0; } else { $userid = $session->userid; } $invoiceid = $database->addNewPaySimpleTxn($userid, $amount, 'START', $custom); Logger_Array("cvError_invoiceid", $invoiceid); $res = $database->setInvoiceId($order_id, $invoiceid); Logger_Array("cvError_res", $res); if ($res != 1) { echo "There was some problem please try again <a href='index.php?p=26'>click here</a>"; } $amount = number_format($amount, 2, '.', ','); } else { echo "Error Occured"; exit; } ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Your Company Online BillPay Form</title> <script language="JavaScript" type="text/JavaScript">
$value = urlencode(stripslashes($value)); $req .= "&" . $key . "=" . $value; $ipn_email .= $key . " = " . urldecode($value) . '<br />'; $ipn_data_array[$key] = urldecode($value); } // Store IPN data serialized for RAW data storage later $ipn_serialized = serialize($ipn_data_array); // Store RAW IPN log in the DB require_once "../session.php"; global $db; $invoice = $ipn_data_array[UMinvoice]; if ($invoice == 0) { echo "There was a problem processing your transaction. Please contact admin to complete the transaction."; } else { $txn_status = $database->getTransactionStatus($invoice); Logger_Array("cvError_txn_status", $txn_status, $invoice); if (strtoupper($txn_status) == 'START') { $ret = $database->saveRawIPNPaySimple($ipn_serialized); $q = "select * from ! where ipn_data_serialized = ?"; $row = $db->getRow($q, array('paysimple_ipn_raw_log', $ipn_serialized)); Logger($ipn_serialized, $level); if ($ipn_data_array[UMstatus] == "Approved" && $ipn_data_array[UMerrorcode] == 00) { $database->updatePaySimpleTxn($invoice, $row['id']); echo "Your payment transaction has been completed, and funds credited to your lender account. Please click <a href='../../index.php?p=16&u=" . $session->userid . "'><strong>here</strong></a> to view your current account status."; } else { Logger('invalid IPN from PaySimple', $level); } } else { echo "Your payment transaction has been completed, and funds credited to your lender account. Please click <a href='../../index.php?p=16&u=" . $session->userid . "'><strong>here</strong></a> to view your current account status."; } }
$ret = $database->saveRawIPNPaySimple($ipn_serialized); Logger_Array("cvError_ret", $ret); $q = "select * from ! where ipn_data_serialized = ?"; $row = $db->getRow($q, array('paysimple_ipn_raw_log', $ipn_serialized)); Logger_Array("cvError_row", $row); Logger($ipn_serialized, $level); if ($ipn_data_array[UMstatus] == "Approved" && $ipn_data_array[UMerrorcode] == 00) { $res4 = $database->updatePaySimpleTxnForGift($invoice, $row['id']); Logger_Array("cvError_res4", $res4); $order_id = $database->getOrderIdByInvoiceid($invoice); Logger_Array("cvError_order_id", $order_id); $_SESSION['orderid'] = $order_id; $res1 = $database->updateGiftTransaction($order_id); /* 1 for paysimple transaction approve */ Logger_Array("cvError_res1", $res1); $res2 = $session->sendGiftCardMailsToSender($order_id); Logger_Array("cvError_res2", $res2); $res3 = $session->sendGiftCardMailsToReciever($order_id); Logger_Array("cvError_res3", $res3); echo "<SCRIPT type='text/javascript'>\n\t\t\t\t\thdrRedirect(); \n\t\t\t\t\t</SCRIPT>"; /*encript id and invoiceid*/ } else { Logger('invalid IPN from PaySimple', $level); } } else { echo "Your transaction has been already completed.<br>"; echo "click <a href='index.php?p=28'>here</a> to order review.<br>"; echo "click <a href='index.php'>here</a> to go home page."; //header('Location: index.php?p=28'); } }