Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $raw_post_data = file_get_contents('php://input');
- $raw_post_array = explode('&', $raw_post_data);
- $myPost = array();
- foreach ($raw_post_array as $keyval) {
- $keyval = explode ('=', $keyval);
- if (count($keyval) == 2)
- $myPost[$keyval[0]] = urldecode($keyval[1]);
- }
- $req = 'cmd=_notify-validate';
- if (function_exists('get_magic_quotes_gpc')) {
- $get_magic_quotes_exists = true;
- }
- foreach ($myPost as $key => $value) {
- if ($get_magic_quotes_exists == true && get_magic_quotes_gpc() == 1) {
- $value = urlencode(stripslashes($value));
- } else {
- $value = urlencode($value);
- }
- $req .= "&$key=$value";
- }
- $ch = curl_init('https://ipnpb.sandbox.paypal.com/cgi-bin/webscr');
- curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
- curl_setopt($ch, CURLOPT_FORBID_REUSE, 1);
- curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Expect:','Connection: Close'));
- if ( !($res = curl_exec($ch)) ) {
- curl_close($ch);
- exit;
- }
- curl_close($ch);
- if (strcmp ($res, "VERIFIED") == 0) {
- //////////////////////////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() {
- die();
- }
- function escribirCuentas() {
- for ($l=0; $l<count($usernames); $l++) {
- echo "Username: " . $usernames[$l] . " Password: " . $passwords[$l] . "<br>";
- }
- }
- $escribirDatosCuentas = escribirCuentas();
- /////////////////////////PROCESAMIENTO DE DATOS/////////////////////////////////
- $payment_status = $_POST["payment_status"];
- $txn_id = $_POST["txn_id"];
- echo $txn_id;
- //conexión//
- $servername = "XXXXXXXXXXXX";
- $username = "XXXXXXXXXXXXXX";
- $password = "XXXXXXXXXXXXXX";
- $dbname = "XXXXXXXXXXXXXXXX";
- $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" && msqli_num_rows($transid_result) == 0) {
- $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=0; $i<=999; $i++) {
- if (isset($_POST["item_name$i"])) {
- array_push($item_name_list, $_POST["item_name$i"]);
- }
- }
- for ($j=0; $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 (msqli_num_rows($pre_result) == 0) {
- 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 (msqli_num_rows($pre_result) == 0) {
- 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 (msqli_num_rows($pre_result) == 0) {
- 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 (msqli_num_rows($pre_result) == 0) {
- 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 (msqli_num_rows($pre_result) == 0) {
- 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 (msqli_num_rows($pre_result) == 0) {
- 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 (msqli_num_rows($pre_result) == 0) {
- 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 (msqli_num_rows($pre_result) == 0) {
- 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 (msqli_num_rows($pre_result) == 0) {
- 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 (msqli_num_rows($pre_result) == 0) {
- 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 (msqli_num_rows($pre_result) == 0) {
- 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 (msqli_num_rows($pre_result) == 0) {
- 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 (msqli_num_rows($pre_result) == 0) {
- 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 (msqli_num_rows($pre_result) == 0) {
- 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 (msqli_num_rows($pre_result) == 0) {
- 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 (msqli_num_rows($pre_result) == 0) {
- 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 (msqli_num_rows($pre_result) == 0) {
- 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 = 'XXXXXXXXXXXXXX';
- $mail->Password = 'XXXXXXXXXXXXXX';
- $mail->SMTPSecure = 'tls';
- $mail->Port = 587;
- $mail->setFrom('XXXXXXXXXXXXXXXXX');
- $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>Customer Support</span>";
- $mail->send();
- }
- mysqli_free_result($transid_result);
- mysqli_close($conn);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement