/var/www/hkosl.com/PayEase_kelvin/APIError.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
    
/*************************************************
     * APIError.php
     *
     * Displays error parameters.
     *
     * Called by DoDirectPaymentReceipt.php, TransactionDetails.php,
     * GetExpressCheckoutDetails.php and DoExpressCheckoutPayment.php.
     *************************************************/
    //require_once('../webadmin/configure.php');
session_start();
    
$pid session_id();

    
$resArray $_SESSION['reshash'];


//todo: save content to database    

    
if (isset($_SESSION['curl_error_no'])) {
        
$errorCode    $_SESSION['curl_error_no'];
        
$errorMessage $_SESSION['curl_error_msg'];
        
session_unset();
    } else {
        
$errorCode "N/A";
        
$errorMessage .= "<table>";
        foreach (
$resArray as $key => $value) {
            
$errorMessage .= "<tr><td> $key:</td><td>$value</td></tr>";
        }
        
$errorMessage .= "</table>";
    }

    
/*$sql = "INSERT INTO sys_errorlog SET tag = 'Paypal Error', error_code = ?, error_msg = ?, createdate = NOW(), refno = ?, sessionid = ?,
useragent = ?, _session = ?, _server = ?
";
//echo $sql;*/
    
$parameters = array($errorCode$errorMessagevar_export($resArraytrue), $pid$_SERVER['HTTP_USER_AGENT'], var_export($_SESSIONtrue), var_export($_SERVERtrue));
    
/*if (!($sth = $dbh->prepare($sql))) {
        throw new Exception('[' . $sth->errorCode() . ']: ' . print_r($sth->errorInfo()));
        exit;
    }

    if (!$sth->execute($parameters)) {
        throw new Exception('[' . $sth->errorCode() . ']: ' . print_r($sth->errorInfo()));
        exit;
    }*/
    
$_SESSION["error_msg"] = "PayPal 付款出錯,請與我們聯絡。";
    
/*header("Location: ../contactus.php");
    exit;*/

var_dump($parameters);

    echo 
phpinfo();