If the response from PayPal was a success, display the response parameters'

   If the response was an error, display the errors received using APIError.php.

   */
$ack = strtoupper($resArray["ACK"]);
if ($ack != 'SUCCESS' && $ack != 'SUCCESSWITHWARNING') {
    $_SESSION['reshash'] = $resArray;
    $location = "APIError.php";
    header("Location: {$location}");
} else {
    //print_r($_SESSION);
    $orderid = $_SESSION['form']['orderid'];
    $sql = "SELECT * FROM " . ORDERS_TABLE . " WHERE id=" . $_SESSION['form']['orderid'];
    //exit;
    $orderdetails = $databaseobject->fetch_array($sql);
    extract($orderdetails[0]);
    $where = "id=" . $_SESSION['form']['orderid'];
    $AddArray = array('status' => 'shipped', 'paymentmode' => 'PayPal');
    $databaseobject->update_record(ORDERS_TABLE, $AddArray, $where, '', $query_echo = '');
    $sqladmin = "SELECT order_email from sitesetting";
    $orderemail = $databaseobject->get_name_using_id($sqladmin);
    //extract($orderdetails[0]);
    $from = $orderemail;
    //'Savostore.com';//$content['email'];
    $to = $orderemail;
    //'*****@*****.**';// $orderemail;//'*****@*****.**';//$orderemail;//'*****@*****.**';////$toemail;
    $headers = "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
    $headers .= "From:" . $from;
    $mail_format = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">