Make an IDF soldier smile this Purim.
global $wpdb;
$purim_names = $wpdb->get_results (“SELECT * FROM wp_purim_donate ORDER BY id DESC”);
$all_names =”;
foreach($purim_names as $print ){
if($print->name != ”){
$all_names .= ($print->name).’.’;
}
}
$ttlamont= 0;
$purim_result = $wpdb->get_results ( “SELECT * FROM wp_purim_donate” );
foreach ( $purim_result as $print ) {
$ttlamont = $ttlamont + ($print->amount);
}
$info = ‘USER=ari_api1.chayalelchayal.org’
.’&PWD=6XHLGN3F9NAJW2T2′
.’&SIGNATURE=AFcWxV21C7fd0v3bYYYRCpSSRl31Aewd.dbGvus4ljFRlPiAt3kJ6ISk’
.’&METHOD=TransactionSearch’
.’&TRANSACTIONCLASS=RECEIVED’
.’&STARTDATE=2017-02-07T01:11:11Z’
.’&VERSION=94′;
$curl = curl_init(‘https://api-3t.paypal.com/nvp’);
curl_setopt($curl, CURLOPT_FAILONERROR, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_POSTFIELDS, $info);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_POST, 1);
$result = curl_exec($curl);
# Bust the string up into an array by the ampersand (&)
# You could also use parse_str(), but it would most likely limit out
$result = explode(“&”, $result);
# Loop through the new array and further bust up each element by the equal sign (=)
# and then create a new array with the left side of the equal sign as the key and the right side of the equal sign as the value
foreach($result as $value){
$value = explode(“=”, $value);
$temp[$value[0]] = $value[1];
}
for($i=0; $i<(count($temp)/11)-1; $i++){ $returned_array[$i] = array( “timestamp” => urldecode($temp[“L_TIMESTAMP”.$i]),
“timezone” => urldecode($temp[“L_TIMEZONE”.$i]),
“type” => urldecode($temp[“L_TYPE”.$i]),
“email” => urldecode($temp[“L_EMAIL”.$i]),
“name” => urldecode($temp[“L_NAME”.$i]),
“transaction_id” => urldecode($temp[“L_TRANSACTIONID”.$i]),
“status” => urldecode($temp[“L_STATUS”.$i]),
“amt” => urldecode($temp[“L_AMT”.$i]),
“currency_code” => urldecode($temp[“L_CURRENCYCODE”.$i]),
“fee_amount” => urldecode($temp[“L_FEEAMT”.$i]),
“net_amount” => urldecode($temp[“L_NETAMT”.$i]));
}
$paypal_names =”;
$net_amount = 0;
foreach($returned_array as $value){
if($value[‘name’] != ”){
$paypal_names .= $value[‘name’].’.’;
}
if($value[‘net_amount’] != ”){
$net_amount = $value[‘net_amount’]+$net_amount;
}
}
$ttlamont = $ttlamont + $net_amount;
$ttlamont = $ttlamont/18;
$ttlamont = (int)$ttlamont;
$ttlamont = $ttlamont +5;
$percentage = ( $ttlamont /1000) * 100;
if($percentage > 100){
$percentage = 100;
}