Thats great, in anycase, I switched from PHP 5 to PHP 4 and it's been working, well for the donations, but I want to be able to list the donors to give them credit. I'm playing with the newer 2.3 xoops. going to see if the module works better in that version, I read it works fine, so I'm going to see.
All right, in a despirate move I change my server from php4 rather then php5 now the donations module seems to work just fine, the settings save, which means the donations can be made correctly to me. however. IPN Reconsile is not adding the donation to the list in the treasure so the donors can get credit.
I've even tried using the same email for the donors module as I have in XOOPS admin email address.
and I double checked the url in the IPN config at paypal.com
I've tried using Method="POST" rather then method="post" and I've also replace all entries of $_GET with $_POST. I'm still getting no closer the donations working with PHP5.
I'm still trying to fix the xdonations 1.9 module. I'm still useing PHP5 & MySQL4. I'm not getting any errors reported of any kind. It's just the the admin/index.php will not post/update/delete.
below is the code.
/************************************************************************/ /* Donations - Paypal financial management module for XOOPS 2 */ /* Copyright (c) 2004 by Xoops2 Donations Module Dev Team */ /* http://dev.xoops.org/modules/xfmod/project/?group_id=1060 */ /* $Id: index.php,v 1.14 2004/10/15 17:54:09 blackdeath_csmc Exp $ */ /************************************************************************/ /* */ /* Based on NukeTreasury for PHP-Nuke - by Dave Lawrence AKA Thrash */ /* NukeTreasury - Financial management for PHP-Nuke */ /* Copyright (c) 2004 by Dave Lawrence AKA Thrash */ /* thrash@fragnastika.com */ /* thrashn8r@hotmail.com */ /* */ /************************************************************************/ /* */ /* This program is free software; you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ /* the Free Software Foundation; either version 2 of the License. */ /* */ /* This program is distributed in the hope that it will be useful, but */ /* WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ /* General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ /* along with this program; if not, write to the Free Software */ /* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 */ /* USA */ /************************************************************************/
include '../../../include/cp_header.php'; if ( file_exists("../language/".$xoopsConfig['language']."/main.php") ) { include "../language/".$xoopsConfig['language']."/main.php"; } else { include "../language/english/main.php"; }
// Collect IPN reconcile data // First, get the date of the last time we reconciled $query_Recordset2 = "SELECT `date` as recdate FROM ".$xoopsDB->prefix("donations_financial")." WHERE name = 'PayPal IPN' ORDER BY date DESC LIMIT 1"; $Recordset2 = $xoopsDB->query($query_Recordset2); $row_Recordset2 = $xoopsDB->fetchArray($Recordset2); $recdate = $row_Recordset2['recdate'];
// Get the date of the last donation $query_Recordset2 = "SELECT `payment_date` as curdate FROM ".$xoopsDB->prefix("donations_transactions")." WHERE payment_status = 'Completed' AND (txn_type = 'send_money' OR txn_type = 'web_accept' ) ORDER BY payment_date DESC LIMIT 1"; $Recordset2 = $xoopsDB->query($query_Recordset2); $row_Recordset2 = $xoopsDB->fetchArray($Recordset2); $curdate = $row_Recordset2['curdate'];
// Collect the IPN transactions between recdate and curdate $query_Recordset2 = "SELECT custom, SUM(mc_gross) AS gross, SUM(mc_gross - mc_fee) AS net FROM ".$xoopsDB->prefix("donations_transactions")." WHERE (payment_date > '".$recdate."' AND payment_date <= '".$curdate."') GROUP BY txn_id"; $Recordset2 = $xoopsDB->query($query_Recordset2);
// Iterate over the records skipping the ones that total out to zero(refunds) $ipn_tot = 0; $num_ipn = 0; while( $row_Recordset2 = $xoopsDB->fetchArray($Recordset2) ) { if( $row_Recordset2['gross'] > 0 ) { $ipn_tot += $row_Recordset2['net']; $num_ipn++; } }
// Get the register balance $query_Recordset4 = "SELECT SUM(amount) as total FROM ".$xoopsDB->prefix("donations_financial").""; $Recordset4 = $xoopsDB->query($query_Recordset4); $row_Recordset4 = $xoopsDB->fetchArray($Recordset4); $total = $row_Recordset4['total'];
// Query to remove the Edit/Delete buttons if no results will be listed. $queryRec = "select * from ".$xoopsDB->prefix("donations_financial").""; $RecordsetQ = $xoopsDB->query($queryRec); $numRec = $xoopsDB->getRowsNum($RecordsetQ);
function FinancialRegEdit() { global $tr_config, $modversion, $xoopsDB;
$time = date("h:i:s"); $nTime = $_POST['StartYear'].'-'.$_POST['StartMonth'].'-'.$_POST['StartDay'].' '.$time; $nTime = strtotime($nTime); //$nTime = strtotime($_POST[Date]); if($nTime == -1) echo "Invalid Date format "; else if( strlen($_POST['Name']) == 0) echo "The Name field cannot be blank "; else if( !is_numeric($_POST['Amount'])) echo "Invalid Amount field, do not use any characters other than -.0123456789 "; else { echo "Field passed validation! ";
$desc = 'This is where you can appeal to your users and your community for donations. Suggestion: Explain why you need donations, what you do with the money and how you manage it. Make them comfortable that they are not throwing their money away.';
$sql = "SELECT * FROM ".$xoopsDB->prefix("donations_config")." WHERE name = 'don_text'"; $Recordset = $xoopsDB->query($sql); $row = $xoopsDB->fetchArray($Recordset); $DON_TEXT = $row['text']; echo '
' ."
$desc" align="right">Donations page text
" ."
$desc" align="left">" ."
";
ShowTextBox('don_amt_checked', 'Which donation amount below is checked by default?', '', '4', 'onChange="return validInt(this,'Donation Default',1);"');
echo '
';
$query_Recordset1 = "SELECT * FROM ".$xoopsDB->prefix("donations_config")." WHERE name = 'don_amount' ORDER BY subtype"; $Recordset1 = $xoopsDB->query($query_Recordset1); $row_Recordset1 = $xoopsDB->fetchArray($Recordset1); $totalRows_Recordset1 = $xoopsDB->getRowsNum($Recordset1); $desc = htmlentities($row_Recordset1['text']);
"; } while ($row_Recordset1 = $xoopsDB->fetchArray($Recordset1)); $row1 .= '
'; $row2 .= '
'; echo "$row1$row2";
echo '
'; echo '
center' width='100%'>
'; echo '
'; echo '
1' width='90%' align='center'>
'; echo '
PayPal Configuration
'; echo '
center'>
';
$rsql = "SELECT rank_id, rank_title FROM ".$xoopsDB->prefix('ranks').""; $rresult = $xoopsDB->query($rsql); $r_array = array(); while( $r_row = $xoopsDB->fetchRow($rresult) ){ $r_array[] = $r_row; } ShowDropBox('paypal_url', 'Please choose which Paypal IPN url you will use.', '', '', ''); ShowTextBox('receiver_email', 'PayPal Receiver Email', '', '40', ''); ShowTextBox('ty_url', "URL for Donation 'Thank You'", '', '80', 'onChange="checkCancelledURL(); return validdateURL(this,this.value);"'); ShowTextBox('pp_cancel_url', 'URL for cancelled donation', '', '80', 'onChange="return validdateURL(this,this.value);"'); ShowTextBox('pp_itemname', 'PayPal Item Name', '', '20', ''); ShowTextBox('pp_item_num', 'PayPal Item Number', '', '20', ''); ShowTextBox('pp_image_url', 'URL of image to display in PayPal', '', '60', ''); ShowYNBox('pp_get_addr', 'Ask user for postal address', '', '', ''); ShowDropBox('pp_curr_code', 'Choose your currency', '', '', ''); $gsql = "SELECT groupid, name FROM ".$xoopsDB->prefix('groups')." WHERE groupid>3"; $gresult = $xoopsDB->query($gsql); $g_array = array(); while( $g_row = $xoopsDB->fetchRow($gresult) ){ $g_array[] = $g_row; } ShowArrayDropBox('assign_group', 'Select a Group to assign donators to.', '', '', '', $g_array); $rsql = "SELECT rank_id, rank_title FROM ".$xoopsDB->prefix('ranks').""; $rresult = $xoopsDB->query($rsql); $r_array = array(); while( $r_row = $xoopsDB->fetchRow($rresult) ){ $r_array[] = $r_row; } ShowArrayDropBox('assign_rank', 'Select a Rank to assign donators to.', '', '', '', $r_array);
echo '
';
echo '
'; echo '
IPN Logging Options
'; echo '
' .'
Logging level
' .'
' .'; echo ''; echo ''; echo ''; echo '
';
ShowTextBox('ipn_log_entries', 'Keep this many log entries', '', '4', '');
$desc = 'This box shows the link to the IPN recorder. This link must be pasted EXACTLY as it is into your PayPal IPN profile. You can click on the "test" link to the right to verify that the IPN recorder is functioning correctly.'; $desc = htmlentities($desc); echo '
"; } while ($row_Recordset1 = $xoopsDB->fetchArray($Recordset1)); $row1 .= '
'; $row2 .= '
'; echo "$row1$row2";
echo '
'; echo '
center' width='100%'>
'; echo '
'; echo ''; }
function ConfigUpdate() { global $tr_config, $modversion, $xoopsDB;
echo " #0000FF">If you see this screen then an SQL error was encountered" . "You should see a message in #FF0000">RED below indicating what the error is
"; $ERR = 1; $ilog="";
$ilog .= " ";
foreach( $_POST as $option => $value ) { /// Look for form variables if( preg_match("/var_/",$option)) { $varnm = preg_replace("/var_/","",$option); // Check for subtype field
if( preg_match("/-(.*)/",$varnm,$subtype) ) { echo " subtype = $subtype[1] "; $temp = $varnm; $varnm = preg_replace("/-.*/","",$temp); // Is this is a text field? if( preg_match("/([^-]*)-txt/",$subtype[1], $subtype2) ) { if (!get_magic_quotes_gpc()) { $textarea = addslashes($value); } else { $textarea = $value; }
// If there were no errors if( $ERR == 0 ) Header("Location: index.php?op=Config#AdminTop"); }
function IpnRec() { global $tr_config, $modversion, $xoopsDB, $curr_sign; $query_Recordset1 = "select `date` as recdate from ".$xoopsDB->prefix("donations_financial")."" ." where name='PayPal IPN' order by date desc limit 1"; $Recordset1 = $xoopsDB->query($query_Recordset1); $row_Recordset1 = $xoopsDB->fetchArray($Recordset1); if($row_Recordset1){ $recdate = "payment_date > '".$row_Recordset1['recdate']."' and"; }else{ $recdate = ''; }
$query_Recordset1 = "select `payment_date` as curdate from ".$xoopsDB->prefix("donations_transactions")."" ." where payment_status='Completed' and (txn_type='send_money' or txn_type='web_accept')" ." order by payment_date desc limit 1"; $Recordset1 = $xoopsDB->query($query_Recordset1); $row_Recordset1 = $xoopsDB->fetchArray($Recordset1); $curdate = $row_Recordset1['curdate']; $query_Recordset1 = "select sum(mc_gross - mc_fee) as ipn_total, count(*) as numrecs" ." from ".$xoopsDB->prefix("donations_transactions")." where ($recdate payment_date <= '$curdate')" ." and payment_status = 'Completed' and (txn_type='send_money' or txn_type='web_accept')"; $Recordset1 = $xoopsDB->query($query_Recordset1); $row_Recordset1 = $xoopsDB->fetchArray($Recordset1);
echo "
title">Update register with PayPal IPN
"; if( $row_Recordset1['numrecs'] == 0 ) echo "There are no new IPN records to import! "; else { $insert_set = "INSERT INTO `".$xoopsDB->prefix("donations_financial")."` (`date`,`num`,`name`,`descr`,`amount`) VALUES ('$curdate','','PayPal IPN','Auto-Reconcile','".$row_Recordset1['ipn_total']."')";
if($xoopsDB->queryF($insert_set)) echo "$row_Recordset1[numrecs] IPN records have been imported for a total of $curr_sign" . sprintf("%0.2f", $row_Recordset1['ipn_total']); else echo " ERROR : There are $row_Recordset1[numrecs] to import, but there was an " ."error encoutered during db record insertion into Financial table. Insertion " ."FAILED"; }