<?php
/*************************************************
APIError.php

Displays error parameters.

Called by DoDirectPaymentReceipt.php, TransactionDetails.php,
GetExpressCheckoutDetails.php and DoExpressCheckoutPayment.php.

*************************************************/

session_start();
$resArray=$_SESSION['reshash']; 
?>

<html>
<head>
<title>PayPal PHP API Response</title>
<link href="sdk.css" rel="stylesheet" type="text/css"/>
	<script type="text/javascript">
		function gotoflex() {
			window.opener.window.document.getElementById('payPalWindow').paymentComplete();
			window.close();
		}
	</script>
</head>

<body alink=#0000FF vlink=#0000FF>
    <img alt="Smashhit Solutions Online Design Center" src="ban.jpg">

<center>

<table width="700" height="350">
<tr>
		<td colspan="2" class="header">The PayPal API has returned an error!</td>
	</tr>

<?php  //it will print if any URL errors 
	if(isset($_SESSION['curl_error_no'])) { 
			$errorCode= $_SESSION['curl_error_no'] ;
			$errorMessage=$_SESSION['curl_error_msg'] ;	
			session_unset();	
?>

   
<tr>
		<td>Error Number:</td>
		<td><?= $errorCode ?></td>
	</tr>
	<tr>
		<td>Error Message:</td>
		<td><?= $errorMessage ?></td>
	</tr>
	
	</center>
	</table>
<?php } else {

/* If there is no URL Errors, Construct the HTML page with 
   Response Error parameters.   
   */
?>

		<td>Ack:</td>
		<td><?= $resArray['ACK'] ?></td>
	</tr>
	<tr>
		<td>Correlation ID:</td>
		<td><?= $resArray['CORRELATIONID'] ?></td>
	</tr>
	<tr>
		<td>Version:</td>
		<td><?= $resArray['VERSION']?></td>
	</tr>
<?php
	$count=0;
	while (isset($resArray["L_SHORTMESSAGE".$count])) {		
		  $errorCode    = $resArray["L_ERRORCODE".$count];
		  $shortMessage = $resArray["L_SHORTMESSAGE".$count];
		  $longMessage  = $resArray["L_LONGMESSAGE".$count]; 
		  $count=$count+1; 
?>
	<tr>
		<td>Error Number:</td>
		<td><?= $errorCode ?></td>
	</tr>
	<tr>
		<td>Short Message:</td>
		<td><?= $shortMessage ?></td>
	</tr>
	<tr>
		<td>Long Message:</td>
		<td><?= $longMessage ?></td>
	</tr>
	
<?php }//end while
}// end else
?>
</center>
	</table>
<br>
<br>
<br>
<br>
<br>
 <a href="http://www.smashhit.org/">Return To Business Card</a>
</body>
</html>

