function processPayOnArrival() { global $bookprs; global $bsiCore; $bsiMail = new bsiMail(); $emailContent = $bsiMail->loadEmailContent(); $subject = $emailContent['subject']; mysql_query("UPDATE bsi_bookings SET payment_success=true WHERE booking_id = " . $bookprs->bookingId); mysql_query("UPDATE bsi_clients SET existing_client = 1 WHERE email = '" . $bookprs->clientEmail . "'"); $emailBody = "Dear " . $bookprs->clientName . ",<br><br>"; $emailBody .= $emailContent['body'] . "<br><br>"; $emailBody .= $bookprs->invoiceHtml; $emailBody .= '<br><br>' . mysql_real_escape_string(PP_REGARDS) . ',<br>' . $bsiCore->config['conf_hotel_name'] . '<br>' . $bsiCore->config['conf_hotel_phone']; $emailBody .= '<br><br><font style=\\"color:#F00; font-size:10px;\\">[ ' . mysql_real_escape_string(PP_CARRY) . ' ]</font>'; $returnMsg = $bsiMail->sendEMail($bookprs->clientEmail, $subject, $emailBody); if ($returnMsg == true) { $notifyEmailSubject = "Booking no." . $bookprs->bookingId . " - Notification of Room Booking by " . $bookprs->clientName; $notifynMsg = $bsiMail->sendEMail($bsiCore->config['conf_hotel_email'], $notifyEmailSubject, $bookprs->invoiceHtml); header('Location: booking-confirm.php?success_code=1'); die; } else { header('Location: booking-failure.php?error_code=25'); die; } //header('Location: booking-confirm.php?success_code=1'); }
<?php session_start(); include "includes/db.conn.php"; include "includes/conf.class.php"; include "includes/mail.class.php"; $row_default_lang = mysql_fetch_assoc(mysql_query("select * from bsi_language where `lang_default`=true")); include "languages/" . $row_default_lang['lang_file']; $paymentGatewayDetails = $bsiCore->loadPaymentGateways(); $bsiMail = new bsiMail(); $emailContent = $bsiMail->loadEmailContent(); require_once 'paypal.class.php'; // include the class file $invoice = time(); $p = new paypal_class(); // initiate an instance of the class //$p->paypal_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr'; // testing paypal url $p->paypal_url = 'https://www.paypal.com/cgi-bin/webscr'; // paypal url // setup a variable for this script (ie: 'http://www.micahcarrick.com/paypal.php') $this_script = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; // if there is not action variable, set the default action of 'process' if (empty($_GET['action'])) { $_GET['action'] = 'process'; } switch ($_GET['action']) { case 'process': // Process and order... $p->add_field('business', $paymentGatewayDetails['pp']['account']); $p->add_field('return', $this_script . '?action=success'); $p->add_field('cancel_return', $this_script . '?action=cancel');