From 070c6dde2a5c81729d96618a01754e51700f8700 Mon Sep 17 00:00:00 2001 From: "Janus B. Kristensen" Date: Sun, 8 May 2005 01:50:20 +0000 Subject: [PATCH] Initial checkin of PayPal donation system svn path=/trunk/boinc/; revision=6078 --- html/inc/paypal_global_config.inc | 276 ++++++++++++++++++++++++++++++ html/user/payment_process.php | 38 ++++ 2 files changed, 314 insertions(+) create mode 100644 html/inc/paypal_global_config.inc create mode 100644 html/user/payment_process.php diff --git a/html/inc/paypal_global_config.inc b/html/inc/paypal_global_config.inc new file mode 100644 index 0000000000..a1e985fef9 --- /dev/null +++ b/html/inc/paypal_global_config.inc @@ -0,0 +1,276 @@ +$v) { +$postdata.= $i . "=" . urlencode($v) . "&"; +} + +$postdata.="cmd=_notify-validate"; + +//execute curl on the command line + +exec("$paypal[curl_location] -d \"$postdata\" $url", $info); + +$info=implode(",",$info); + +return $info; + +} + +//posts transaction data using libCurl + +function libCurlPost($url,$data) { + +//build post string + +foreach($data as $i=>$v) { + +$postdata.= $i . "=" . urlencode($v) . "&"; + +} + +$postdata.="cmd=_notify-validate"; + +$ch=curl_init(); + +curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,FALSE); +curl_setopt($ch,CURLOPT_URL,$url); +curl_setopt($ch,CURLOPT_POST,1); +curl_setopt($ch,CURLOPT_POSTFIELDS,$postdata); + +//Start ob to prevent curl_exec from displaying stuff. +ob_start(); +curl_exec($ch); + +//Get contents of output buffer +$info=ob_get_contents(); +curl_close($ch); + +//End ob and erase contents. +ob_end_clean(); + +return $info; + +} + +//posts transaction data using fsockopen. +function fsockPost($url,$data) { + +//Parse url +$web=parse_url($url); + +//build post string +foreach($data as $i=>$v) { +$postdata.= $i . "=" . urlencode($v) . "&"; +} + +$postdata.="cmd=_notify-validate"; + +//Set the port number +if($web[scheme] == "https") { $web[port]="443"; $ssl="ssl://"; } else { $web[port]="80"; } + +//Create paypal connection +$fp=@fsockopen($ssl . $web[host],$web[port],$errnum,$errstr,30); + +//Error checking +if(!$fp) { echo "$errnum: $errstr"; } + +//Post Data +else { + + fputs($fp, "POST $web[path] HTTP/1.1\r\n"); + fputs($fp, "Host: $web[host]\r\n"); + fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n"); + fputs($fp, "Content-length: ".strlen($postdata)."\r\n"); + fputs($fp, "Connection: close\r\n\r\n"); + fputs($fp, $postdata . "\r\n\r\n"); + +//loop through the response from the server +while(!feof($fp)) { $info[]=@fgets($fp, 1024); } + +//close fp - we are done with it +fclose($fp); + +//break up results into a string +$info=implode(",",$info); + +} + +return $info; + + } + +//Display Paypal Hidden Variables + +function showVariables() { + +global $paypal; + +?> + + + + +"> +"> +"> +"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/html/user/payment_process.php b/html/user/payment_process.php new file mode 100644 index 0000000000..a99574452f --- /dev/null +++ b/html/user/payment_process.php @@ -0,0 +1,38 @@ + + + +Processing transaction... + +
+ + + +
Processing Transaction . . .
+ +
+ +