Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php require('PaypalIPN.php');
- use PaypalIPN;
- $ipn = new PaypalIPN();
- // Use the sandbox endpoint during testing.
- $ipn->useSandbox();
- $verified = $ipn->verifyIPN();
- //////////////////////////RECOGEDORES DE CONTENIDO//////////////////////////////////
- $item_name_list = array();
- $item_quantity_list = array();
- $usernames = array();
- $passwords = array();
- $usuario_a_borrar = "empty";
- //////////////////////////FUNCIONES A LLAMAR/////////////////////////////////
- function borrarCuenta() {
- $stmt = mysqli_prepare($conn, "DELETE FROM Cuentas WHERE Username = ?");
- mysqli_stmt_bind_param($stmt, "s", $usuario_a_borrar);
- mysqli_stmt_execute($stmt);
- mysqli_stmt_close($stmt);
- }
- function terminarProceso() {
- header("HTTP/1.1 200 OK");
- die();
- }
- function escribirCuentas() {
- for ($l=0; $l<count($usernames); $l++) {
- echo "Username: " . $usernames[$l] . " Password: " . $passwords[$l] . "<br>";
- }
- }
- $escribirDatosCuentas = escribirCuentas();
- /////////////////////////PROCESAMIENTO DE DATOS/////////////////////////////////
- if ($verified) {
- $payment_status = $_POST["payment_status"];
- $txn_id = $_POST["txn_id"];
- //conexión//
- $servername = "XXXXXXXXXXXXXXXXXXX";
- $username = "XXXXXXXXXXXXXXXXXXXXX";
- $password = "XXXXXXXXXXXXXXXXXXXXX";
- $dbname = "XXXXXXXXXXXXXXXXXXXXXXX";
- $conn = mysqli_connect($servername, $username, $password, $dbname);
- $transid_query = "SELECT * FROM TransactionIDs WHERE TransID = '$txn_id'";
- $transid_result = mysqli_query($conn, $transid_query);
- if ($payment_status === "Completed" && !$transid_result) {
- $payer_email = $_POST["payer_email"];
- $first_name = $_POST["first_name"];
- $last_name = $_POST["last_name"];
- $query_condition= "empty";
- $query = "SELECT TOP 1 Username, Password FROM Cuentas WHERE '$query_condition' AND Server = euw ORDER BY Username ASC";
- for ($i=1; $i<=999; $i++) {
- if (isset($_POST["item_name$i"])) {
- array_push($item_name_list, $_POST["item_name$i"]);
- }
- }
- for ($j=1; $j<=999; $j++) {
- if (isset($_POST["quantity$j"])) {
- array_push($item_quantity_list, $_POST["quantity$j"]);
- }
- }
- for ($k=0; $k<count($item_name_list); $k++) {
- strtolower($item_name_list[$k]);
- switch (item_name_list[k]) {
- /////////////ranked-smurfs/////////////////
- case "ranked smurf - diamond v":
- $query_condition = "Ranked_Type = diamond v";
- $pre_result = mysqli_query($conn, $query);
- if (!$pre_result) {
- terminarProceso();
- }
- $result = $mysqli_fetch_array($pre_result);
- array_push($usernames, $result["Username"]);
- array_push($passwords, $result["Password"]);
- $usuario_a_borrar = $result["Username"];
- borrarCuenta($usuario_a_borrar);
- msyqli_free_result($pre_result);
- break;
- case "ranked smurf - platinum i":
- $query_condition = "Ranked_Type = platinum i";
- $pre_result = mysqli_query($conn, $query);
- if (!$pre_result) {
- terminarProceso();
- }
- $result = $mysqli_fetch_array($pre_result);
- array_push($usernames, $result["Username"]);
- array_push($passwords, $result["Password"]);
- $usuario_a_borrar = $result["Username"];
- borrarCuenta($usuario_a_borrar);
- msyqli_free_result($pre_result);
- break;
- case "ranked smurf - platinum ii":
- $query_condition = "Ranked_Type = platinum ii";
- $pre_result = mysqli_query($conn, $query);
- if (!$pre_result) {
- terminarProceso();
- }
- $result = $mysqli_fetch_array($pre_result);
- array_push($usernames, $result["Username"]);
- array_push($passwords, $result["Password"]);
- $usuario_a_borrar = $result["Username"];
- borrarCuenta($usuario_a_borrar);
- msyqli_free_result($pre_result);
- break;
- case "ranked smurf - platinum iii":
- $query_condition = "Ranked_Type = platinum iii";
- $pre_result = mysqli_query($conn, $query);
- if (!$pre_result) {
- terminarProceso();
- }
- $result = $mysqli_fetch_array($pre_result);
- array_push($usernames, $result["Username"]);
- array_push($passwords, $result["Password"]);
- $usuario_a_borrar = $result["Username"];
- borrarCuenta($usuario_a_borrar);
- msyqli_free_result($pre_result);
- break;
- case "ranked smurf - platinum iv":
- $query_condition = "Ranked_Type = platinum iv";
- $pre_result = mysqli_query($conn, $query);
- if (!$pre_result) {
- terminarProceso();
- }
- $result = $mysqli_fetch_array($pre_result);
- array_push($usernames, $result["Username"]);
- array_push($passwords, $result["Password"]);
- $usuario_a_borrar = $result["Username"];
- borrarCuenta($usuario_a_borrar);
- msyqli_free_result($pre_result);
- break;
- case "ranked smurf - platinum v":
- $query_condition = "Ranked_Type = platinum v";
- $pre_result = mysqli_query($conn, $query);
- if (!$pre_result) {
- terminarProceso();
- }
- $result = $mysqli_fetch_array($pre_result);
- array_push($usernames, $result["Username"]);
- array_push($passwords, $result["Password"]);
- $usuario_a_borrar = $result["Username"];
- borrarCuenta($usuario_a_borrar);
- msyqli_free_result($pre_result);
- break;
- case "ranked smurf - gold i":
- $query_condition = "Ranked_Type = gold i";
- $pre_result = mysqli_query($conn, $query);
- if (!$pre_result) {
- terminarProceso();
- }
- $result = $mysqli_fetch_array($pre_result);
- array_push($usernames, $result["Username"]);
- array_push($passwords, $result["Password"]);
- $usuario_a_borrar = $result["Username"];
- borrarCuenta($usuario_a_borrar);
- msyqli_free_result($pre_result);
- break;
- case "ranked smurf - gold ii":
- $query_condition = "Ranked_Type = gold ii";
- $pre_result = mysqli_query($conn, $query);
- if (!$pre_result) {
- terminarProceso();
- }
- $result = $mysqli_fetch_array($pre_result);
- array_push($usernames, $result["Username"]);
- array_push($passwords, $result["Password"]);
- $usuario_a_borrar = $result["Username"];
- borrarCuenta($usuario_a_borrar);
- msyqli_free_result($pre_result);
- break;
- case "ranked smurf - gold iii":
- $query_condition = "Ranked_Type = gold iii";
- $pre_result = mysqli_query($conn, $query);
- if (!$pre_result) {
- terminarProceso();
- }
- $result = $mysqli_fetch_array($pre_result);
- array_push($usernames, $result["Username"]);
- array_push($passwords, $result["Password"]);
- $usuario_a_borrar = $result["Username"];
- borrarCuenta($usuario_a_borrar);
- msyqli_free_result($pre_result);
- break;
- case "ranked smurf - gold iv":
- $query_condition = "Ranked_Type = gold iv";
- $pre_result = mysqli_query($conn, $query);
- if (!$pre_result) {
- terminarProceso();
- }
- $result = $mysqli_fetch_array($pre_result);
- array_push($usernames, $result["Username"]);
- array_push($passwords, $result["Password"]);
- $usuario_a_borrar = $result["Username"];
- borrarCuenta($usuario_a_borrar);
- msyqli_free_result($pre_result);
- break;
- case "ranked smurf - gold v":
- $query_condition = "Ranked_Type = gold v";
- $pre_result = mysqli_query($conn, $query);
- if (!$pre_result) {
- terminarProceso();
- }
- $result = $mysqli_fetch_array($pre_result);
- array_push($usernames, $result["Username"]);
- array_push($passwords, $result["Password"]);
- $usuario_a_borrar = $result["Username"];
- borrarCuenta($usuario_a_borrar);
- msyqli_free_result($pre_result);
- break;
- case "ranked smurf - silver i":
- $query_condition = "Ranked_Type = silver i";
- $pre_result = mysqli_query($conn, $query);
- if (!$pre_result) {
- terminarProceso();
- }
- $result = $mysqli_fetch_array($pre_result);
- array_push($usernames, $result["Username"]);
- array_push($passwords, $result["Password"]);
- $usuario_a_borrar = $result["Username"];
- borrarCuenta($usuario_a_borrar);
- msyqli_free_result($pre_result);
- break;
- case "ranked smurf - silver ii":
- $query_condition = "Ranked_Type = silver ii";
- $pre_result = mysqli_query($conn, $query);
- if (!$pre_result) {
- terminarProceso();
- }
- $result = $mysqli_fetch_array($pre_result);
- array_push($usernames, $result["Username"]);
- array_push($passwords, $result["Password"]);
- $usuario_a_borrar = $result["Username"];
- borrarCuenta($usuario_a_borrar);
- msyqli_free_result($pre_result);
- break;
- case "ranked smurf - silver iii":
- $query_condition = "Ranked_Type = silver iii";
- $pre_result = mysqli_query($conn, $query);
- if (!$pre_result) {
- terminarProceso();
- }
- $result = $mysqli_fetch_array($pre_result);
- array_push($usernames, $result["Username"]);
- array_push($passwords, $result["Password"]);
- $usuario_a_borrar = $result["Username"];
- borrarCuenta($usuario_a_borrar);
- msyqli_free_result($pre_result);
- break;
- /////////////unranked-smurfs/////////////////
- case "unranked ultimate pack(50.000+ ip)":
- $query_condition = "Unranked_Type = 50000";
- $pre_result = mysqli_query($conn, $query);
- if (!$pre_result) {
- terminarProceso();
- }
- $result = $mysqli_fetch_array($pre_result);
- array_push($usernames, $result["Username"]);
- array_push($passwords, $result["Password"]);
- $usuario_a_borrar = $result["Username"];
- borrarCuenta($usuario_a_borrar);
- msyqli_free_result($pre_result);
- break;
- case "unranked premium pack(30.000+ ip)":
- $query_condition = "Unranked_Type = 30000";
- $pre_result = mysqli_query($conn, $query);
- if (!$pre_result) {
- terminarProceso();
- }
- $result = $mysqli_fetch_array($pre_result);
- array_push($usernames, $result["Username"]);
- array_push($passwords, $result["Password"]);
- $usuario_a_borrar = $result["Username"];
- borrarCuenta($usuario_a_borrar);
- msyqli_free_result($pre_result);
- break;
- case "unranked basic pack(20.000+ ip)":
- $query_condition = "Unranked_Type = 20000";
- $pre_result = mysqli_query($conn, $query);
- if (!$pre_result) {
- terminarProceso();
- }
- $result = $mysqli_fetch_array($pre_result);
- array_push($usernames, $result["Username"]);
- array_push($passwords, $result["Password"]);
- $usuario_a_borrar = $result["Username"];
- borrarCuenta($usuario_a_borrar);
- msyqli_free_result($pre_result);
- break;
- }
- }
- $stmt2 = mysqli_prepare($conn, "INSERT INTO TransactionIDs (TransID) VALUES (?)");
- mysqli_stmt_bind_param($stmt2, "s", $txn_id);
- mysqli_stmt_execute($stmt2);
- mysqli_stmt_close($stmt2);
- date_default_timezone_set('Europe/Madrid');
- $date = date('d/m/Y H:i:s');
- require 'phpmailer/PHPMailerAutoload.php';
- $mail = new PHPMailer;
- $mail->isSMTP();
- $mail->Host = 'smtp.gmail.com';
- $mail->SMTPAuth = true;
- $mail->Username = 'XXXXXXXXXXXXXXXXXXXXXXX';
- $mail->Password = 'XXXXXXXXXXXXXXXXXXXXXXX';
- $mail->SMTPSecure = 'tls';
- $mail->Port = 587;
- $mail->setFrom('XXXXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXXXXXXXXX');
- $mail->addAddress("$payer_email");
- $mail->isHTML(true);
- $mail->Subject = 'Order confirmation';
- $mail->Body = "<span style='font-size:14px'>Hi there, $first_name $last_name!<br><br>Thanks a lot for your purchase at our site on $date! Here are the credentials for your new smurf account:<br><br><span style='font-weight:600'>$escribirDatosCuentas</span><br><br>Remember to change your password through the official League of Legends forums. Should there be any questions or inquiries, please contact us anytime.<br><br>Your Paypal Transaction ID for the current order is: $txn_id.<br><br>Best wishes and enjoy your new account!<br><br>$signature</span>";
- $mail->send();
- mysqli_free_result($transid_result);
- mysqli_close($conn);
- }
- }
- // Reply with an empty 200 response to indicate to paypal the IPN was received correctly.
- header("HTTP/1.1 200 OK");
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement