Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $url = 'https://www.paypal.com/cgi-bin/webscr';
- $tier = $_GET["tier"];
- $form_data = array(
- 'business' => 'business@jerr0w.xyz',
- 'notify_url' => 'https://donate.trinia.pro/classes/paypal-listener.php',
- 'cancel_return' => 'https://donate.trinia.pro/verify_error.php',
- 'return' => 'https://donate.trinia.pro/verify_success.php',
- 'rm' => '2',
- 'no_shipping' => '1',
- 'no_note' => '1',
- 'currency_code' => 'EUR',
- 'page_style' => 'paypal',
- 'charset' => 'utf-8',
- 'cmd' => '_xclick'
- );
- // This would be the user's steamid, could just use https://github.com/SmItH197/SteamAuthentication
- // since he's already using it, and wouldn't have to trust the clients steamid
- $form_data["custom"] = "";
- switch ($tier) {
- case 1:
- $form_data["item_name"] = "Donation: Tier I";
- $form_data["amount"] = 0.01;
- break;
- case 2:
- $form_data["item_name"] = "Donation: Tier II";
- $form_data["amount"] = 10.00;
- break;
- case 3:
- $form_data["item_name"] = "Donation: Tier III";
- $form_data["amount"] = 15.00;
- break;
- case 4:
- $form_data["item_name"] = "Donation: Tier IV";
- $form_data["amount"] = 25.00;
- break;
- case 5:
- $form_data["item_name"] = "Donation: Tier V";
- $form_data["amount"] = 50.00;
- break;
- default:
- die("Invalid tier");
- }
- $options = array(
- 'http' => array(
- 'header' => "Content-type: application/x-www-form-urlencoded\r\n",
- 'method' => 'POST',
- 'content' => http_build_query($form_data)
- )
- );
- $context = stream_context_create($options);
- $result = file_get_contents($url, false, $context);
- $headers = parseHeaders($http_response_header);
- if (strpos($headers[0], '302') !== false) {
- header("Location: " . $headers["Location"]);
- }
- //Taken from http://php.net/manual/en/reserved.variables.httpresponseheader.php#117203
- function parseHeaders( $headers )
- {
- $head = array();
- foreach( $headers as $k=>$v )
- {
- $t = explode( ':', $v, 2 );
- if( isset( $t[1] ) )
- $head[ trim($t[0]) ] = trim( $t[1] );
- else
- {
- $head[] = $v;
- if( preg_match( "#HTTP/[0-9\.]+\s+([0-9]+)#",$v, $out ) )
- $head['reponse_code'] = intval($out[1]);
- }
- }
- return $head;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement