Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ini_set('display_errors', 1);
- ini_set('display_startup_errors', 1);
- error_reporting(E_ALL);
- session_start();
- require './inc/mailer/PHPMailer.php';
- require './inc/mailer/Exception.php';
- require './inc/mailer/SMTP.php';
- require './inc/mailer/OAuth.php';
- require './inc/mailer/POP3.php';
- use PHPMailer\PHPMailer\PHPMailer;
- use PHPMailer\PHPMailer\Exception;
- use PHPMailer\PHPMailer\OAuth;
- use PHPMailer\PHPMailer\POP3;
- use PHPMailer\PHPMailer\SMTP;
- require './inc/config.php';
- $items = json_decode(file_get_contents('inc/products.json'), true);
- if (!isset($items[$_GET['product']])) {
- die('Error, product not found.');
- }
- if (!isset($_SESSION['email'])) {
- die('Email session does not exist');
- }
- if (isset($_GET['option'])) {
- $option = $_GET['option'];
- }
- $url = $items[$_GET['product']]['downloadurl'];
- if (isset($_GET['token'])) {
- $result = send_curl($api_url, array(
- 'user' => $paypal['user'],
- 'pwd' => $paypal['pwd'],
- 'signature' => $paypal['signature'],
- 'version' => $paypal['version'],
- 'method' => 'DoExpressCheckoutPayment',
- 'paymentrequest_0_paymentaction' => 'sale',
- 'paymentrequest_0_amt' => $items[$_GET['product']]['price'],
- 'paymentrequest_0_currencycode' => 'USD',
- 'token' => $_GET['token'],
- 'payerid' => $_GET['PayerID']
- ));
- if ($result['PAYMENTINFO_0_PAYMENTSTATUS'] == 'Completed') {
- echo 'success';
- $email = new PHPMailer();
- $email->SMTPDebug = 0;
- $email->isSMTP();
- $email->Host = $settings_smtp_host;
- $email->SMTPAuth = true;
- $email->Username = $settings_email;
- $email->Password = $settings_password;
- $email->SMTPSecure = "tls";
- $email->Port = $settings_smtp_port;
- $email->SetFrom($settings_email, $email_from_name);
- $email->Subject = $email_subject;
- $email->Body = $email_text;
- $email->AddBCC($user_email, $user_name);
- $email->AddAddress( $_GET['email'] );
- $email->AddAttachment( $_GET['url'] , $items[$_GET['product']]['mailfilename'] );
- echo $email->Send();
- if (file_exists($_GET['url'])) {
- $url = $_GET['url'];
- header('Content-Description: File Transfer');
- header('Content-Type: application/octet-stream');
- header('Content-Disposition: attachment; filename='.basename($url));
- header('Expires: 0');
- header('Cache-Control: must-revalidate');
- header('Pragma: public');
- header('Content-Length: ' . filesize($url));
- readfile($url);
- }
- //header('Location: /?msg=Success');
- }
- }
- if ($option == 'PayPal') {
- $result = send_curl($api_url, array(
- 'method' => 'SetExpressCheckout',
- 'paymentrequest_0_paymentaction' => 'sale',
- 'paymentre_paymentaction' => 'sale',
- 'paymentrequest_ntaction' => 'sale',
- 'paymentrequest_0_amt' => $items[$_GET['product']]['price'],
- 'paymentrequest_0_currencycode' => 'USD',
- 'returnurl' => 'http://'.$_SERVER['HTTP_HOST'].'/purchase.php?email=' . $_SESSION['email'] . '&product=' . $_GET['product'] . '&url=http://' . $_SERVER['HTTP_HOST']. '/' .$items[$_GET['product']]['downloadurl'],
- 'cancelurl' => 'http://'.$_SERVER['HTTP_HOST'].'/?msg=Cancelled',
- 'user' => $paypal['user'],
- 'pwd' => $paypal['pwd'],
- 'signature' => $paypal['signature'],
- 'version' => $paypal['version']
- ));
- if ($result['ACK'] == 'Success') {
- header('Location: ' . $redirect_url . '?cmd=_express-checkout&useraction=commit&token=' . $result['TOKEN']);
- } else {
- echo 'Error creating payment. Contact TrollC#5916 on discord.';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement