if ($row = mysql_fetch_object($result)) {
         $basket_quantity = $row->basket_quantity;
         $basket_id = $row->basket_id;
     }
 }
 // Check if this is a forced update or if it is member-requested
 if ($_SESSION['renewal_info']['membership_expired'] && $update_membership_page != true) {
     $popup_renew_membership .= '
       <script type="text/javascript">
         jQuery(document).ready(function() {
           popup_src("update_membership.php?display_as=popup", "membership_renewal", "index.php?action=logout");
           });
       </script>';
     $page_specific_css .= '
       <link rel="stylesheet" id="membership_renewal_styles" href="' . PATH . 'membership_renewal.css" type="text/css" media="all" />';
 } elseif (MOTD_REPEAT_TIME >= 0 && strlen(MOTD_CONTENT) > 0 && !ofs_get_status('motd_viewed', $_SESSION['member_id'])) {
     $popup_motd .= '
       <script type="text/javascript">
         jQuery(document).ready(function() {
           popup_src("motd.php?display_as=popup", "motd", "");
           });
       </script>';
     $page_specific_css .= '
       <link rel="stylesheet" id="motd_styles"  href="' . PATH . 'motd.css" type="text/css" media="all" />';
 }
 // Set up the page tabs
 if (CurrentMember::auth_type('member')) {
     $panel_member_menu = '
     <div class="tab_frame">
       <a href="' . PATH . 'panel_member.php" class="' . ($page_tab == 'member_panel' ? ' current_tab' : '') . '">Member Panel</a>
     </div>';
     $payment_currency = $_POST['mc_currency'];
     $txn_id = $_POST['txn_id'];
     $receiver_email = $_POST['receiver_email'];
     $payer_email = $_POST['payer_email'];
     // IPN message values depend upon the type of notification sent.
 } elseif (strcmp($status_response, 'INVALID') == 0) {
     // IPN invalid, log for manual investigation
     die(debug_print("ERROR: 571930 ", array('Level' => 'FAIL', 'Scope' => 'Paypal API', 'File ' => __FILE__ . ' at line ' . __LINE__, 'Message' => 'The response from IPN was: ' . $status_response, 'Details' => array('Message received' => $received_post_data, 'Message sent    ' => $status_request, 'Status response ' => $status_response))));
 }
 $okay_to_post_payment = true;
 // Check if the payment_status is 'Completed'
 if ($_POST['payment_status'] != 'Completed') {
     $okay_to_post_payment = false;
 }
 // Check if this transaction_id matches one we have already processed
 if ($_POST['payment_gross'] == ofs_get_status('paypal_txn_id', $_POST['txn_id'])) {
     $okay_to_post_payment = false;
 }
 // Check if the payment address is okay
 if (stripos(PAYPAL_VALID_EMAILS, $_POST['receiver_email']) === false) {
     $okay_to_post_payment = false;
 }
 // Check for the proper currency
 if ($_POST['mc_currency'] != PAYPAL_CURRENCY) {
     $okay_to_post_payment = false;
 }
 // If we made it through the gauntlet, then we can now post the payment
 if ($okay_to_post_payment == true) {
     // We use the "custom" field of paypal submissions to track what sort of payment is being made
     // Options are:
     //    basket#[basket_id]