xoops forums

tdmaster

Just popping in
Posted on: 2008/7/31 17:17
tdmaster
tdmaster (Show more)
Just popping in
Posts: 5
Since: 2008/7/7 3
#1

Need help updating a DB Value after IPN Success

Senario:
I have set user access to WF-Downloads restricted for only those who have 100 or more posts.

I want those who pay the subscription fee through paypal to bypass this restriction by automatically updating their post value to 100 after payment (IPN??).

Attached below is my IPN script and I believe the action would take place under the following line "if(eregi("VERIFIED",$result))"


include_once("../../../../../mainfile.php");
include_once("../../../include/functions.php");

$gatewayConfig = getGatewayConfig('paypal');

if (isset($gatewayConfig['ipn_log'])) {
$h = @fopen($gatewayConfig['ipn_log'], "a");
}

//get global configuration information
include_once('../includes/global_config.inc.php');

//get pay pal configuration file
include_once('../includes/config.inc.php');

//decide which post method to use
switch($paypal['post_method']) {

case "libCurl": //php compiled with libCurl support

$result=libCurlPost($paypal['url'],$_POST);


break;


case "curl": //cURL via command line

$result=curlPost($paypal['url'],$_POST);

break;


case "fso": //php fsockopen();
log_ipn($h, "starting fso");
log_ipn($h, implode(",", $_POST));
$result=fsockPost($paypal['url'],$_POST);
break;


default: //use the fsockopen method as default post method

$result=fsockPost($paypal['url'],$_POST);

break;

}

//check the ipn result received back from paypal
if(eregi("VERIFIED",$result)) {
$str='';
foreach ($_POST as $k=>$v) {
$str.="$k=$v,";
}
log_ipn($h, $str);
log_ipn($h, $result);
include_once('./ipn_success.php');
}

else {
log_ipn($h, "ipn error");
include_once('./ipn_error.php');
}

if (is_resource($h)) {
fclose($h);
}

Any help would be awesome!!!