Mini Shell

Direktori : /proc/self/root/proc/self/root/home/rizant5/public_html_old/development/
Upload File :
Current File : //proc/self/root/proc/self/root/home/rizant5/public_html_old/development/paypal-process.php

<?php
// Include config file
require_once('paypal-config.php');
require_once('config.php');
// Store request params in an array
if (!empty($_POST['paysave'])) {
    extract($_POST);
    $request_params = array
        (
        'METHOD' => 'DoDirectPayment',
        'USER' => $api_username,
        'PWD' => $api_password,
        'SIGNATURE' => $api_signature,
        'VERSION' => $api_version,
        'PAYMENTACTION' => 'Sale',
        'IPADDRESS' => $_SERVER['REMOTE_ADDR'],
        'CREDITCARDTYPE' => $_POST['creditCardType'],
        'ACCT' => $_POST['creditCardNumber'],
        'EXPDATE' => $_POST['expmonth'].$_POST['expyear'],
        'CVV2' => $_POST['cvv2Number'],
        'FIRSTNAME' => $_POST['firstName'],
        //'LASTNAME' => $_POST['lastName'],
        'STREET' => '',
        'CITY' => '',
        'STATE' => '',
        'COUNTRYCODE' => 'US',
        'ZIP' => '',
        'AMT' => $_POST['amount'],
        'CURRENCYCODE' => 'USD',
        'DESC' => 'Testing Payments Pro'
    );

// Loop through $request_params array to generate the NVP string.
    $nvp_string = '';
    foreach ($request_params as $var => $val) {
        $nvp_string .= '&' . $var . '=' . urlencode($val);
    }
    
//echo $nvp_string; die;
// Send NVP string to PayPal and store response
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_VERBOSE, 1);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($curl, CURLOPT_TIMEOUT, 30);
    curl_setopt($curl, CURLOPT_URL, $api_endpoint);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $nvp_string);

    $result = curl_exec($curl);
    //echo $result . '<br /><br />';
    curl_close($curl);
//echo $api_endpoint; exit;
// Parse the API response
    $result_array = NVPToArray($result);

    //echo '<pre />';
   //print_r($result_array);
	if(!empty($result_array)){
		$status=$result_array['ACK'];
		$trancation_id=$result_array['TRANSACTIONID'];
		$amount=$result_array['AMT'];
                $error_log=$result_array['L_LONGMESSAGE0'];
		$createdate=date('Y-m-d h:i:s');
		$stu_id=$_POST['stu_id'];
		$conn->exec("insert into payments (txnid,stu_id,payment_amount,payment_status,createdtime,error_log) values ('$trancation_id','$stu_id','$amount','$status','$createdate','$error_log')");
	if($result_array['ACK']=='Success'){
		$conn->exec("update student_reg set stu_status='1',start_date=now() where stu_id='$stu_id'");
		header("location:our-courses.php?msg=success");}
	else{header("location:our-courses.php?msg=fail");}
	}
}

// Function to convert NTP string to an array
    function NVPToArray($NVPString) {
        $proArray = array();
        while (strlen($NVPString)) {
            // name
            $keypos = strpos($NVPString, '=');
            $keyval = substr($NVPString, 0, $keypos);
            // value
            $valuepos = strpos($NVPString, '&') ? strpos($NVPString, '&') : strlen($NVPString);
            $valval = substr($NVPString, $keypos + 1, $valuepos - $keypos - 1);
            // decoding the respose
            $proArray[$keyval] = urldecode($valval);
            $NVPString = substr($NVPString, $valuepos + 1, strlen($NVPString));
        }
        return $proArray;
    }

Zerion Mini Shell 1.0