Cyber Anakins Lightsaber - A Minishell-based backdoor

Current Path : /home/bjb2293782/xn--80abaeoqbbrbgf8aea5a2a2z.xn--p1ai/docs/
Upload File :
Current File : /home/bjb2293782/xn--80abaeoqbbrbgf8aea5a2a2z.xn--p1ai/docs/pay.php

<?php


require("design.php");
require("paymentutils.php");

session_start();

$order = isset($_SESSION['order']) ? intval($_SESSION['order']) : 0;
if ($order == 0) die("ERROR: Неверный номер заказа");


function PrintEnd()
{
	MIDDLECOLUMN2();
	print "<center><table><tr><td>";
	ACTUALLINKS('actualLinksH');
	print "</tr></td></table></center>";
	FAQ();

	MIDDLECOLUMN();
	CHANNELS("channelBlockH");
	RIGHTCOLUMN();

	ACTUALLINKS();
	FAQ();
	BOTTOM();
	exit(0);
}


TOP(-1);


LEFTCOLUMN();
CHANNELS();


MAINCOLUMN();


$mysql = mysqlopen();

$result = mysqli_query($mysql,
						"SELECT
							`date`,
							`sum`
						FROM
							libOrders
						WHERE
							`id`=$order AND `payDate` IS NULL
						LIMIT 1");
if (mysqli_errno($mysql)) die("ERROR: ".mysqli_error($mysql)." at line ".__LINE__." of file ".__FILE__."\n");
if (!($row = mysqli_fetch_assoc($result)))
{
	mysqli_free_result($result);

	print "<h1>Заказ $order</h1>\n";
	print "<br><br><center>Заказ не найден</center>\n";

	MIDDLECOLUMN2();
	print "<center><table><tr><td>";
	ACTUALLINKS('actualLinksH');
	print "</tr></td></table></center>";
	FAQ();

	MIDDLECOLUMN();
	CHANNELS("channelBlockH");
	RIGHTCOLUMN();

	ACTUALLINKS();
	FAQ();
	BOTTOM();
	exit(0);
}
print "<h1>Оплата заказа $order от ".SQLtoDate($row['date'])."</h1>\n";

$sum = $row['sum'];

mysqli_free_result($result);










$data = "{\"amount\": {
          \"value\": \"$sum\",
          \"currency\": \"RUB\"
        },
        \"confirmation\": {
          \"type\": \"embedded\",
          \"locale\": \"en_US\"
        },
        \"capture\": true,
        \"description\": \"Заказ №$order\"
      }";

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.yookassa.ru/v3/payments");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($curl, CURLOPT_USERPWD, YOOKASSA_SHOP.":".YOOKASSA_SECRET_KEY);
curl_setopt($curl, CURLOPT_HTTPHEADER,
						array("Idempotence-Key: $order",
							"Content-Type: application/json"));
curl_setopt($curl,CURLOPT_POST,true);
curl_setopt($curl,CURLOPT_POSTFIELDS,$data);

$response = curl_exec($curl);
if(curl_error($curl))
{
    die(curl_error($curl));
}
curl_close($curl);



if (!preg_match("/\"id\"\s*\:\s*\"([^\"]+)\"/", $response, $g))
{
	print "Не найден id от ЮКасса: $response";
	PrintEnd();
}
$yookassa_id = $g[1];

if (!preg_match("/\"confirmation_token\"\s*\:\s*\"([^\"]+)\"/", $response, $g))
{
	print "Не найден ключ подтверждения формы: $response";
	PrintEnd();
}
$confirmation_token = $g[1];

if (preg_match("/\"paid\"\s*\:\s*true/", $response, $g))
{
	mysqli_query($mysql, "UPDATE libOrders SET `payDate`=NOW() WHERE `id`=$order LIMIT 1");
	if (mysqli_errno($mysql)) die("ERROR: ".mysqli_error($mysql)." at line ".__LINE__." of file ".__FILE__."\n");
	print "<script>location='basket.php';</script>";
}
else
{
	$yookassa_id = mysqli_escape_string($mysql, $yookassa_id);
	mysqli_query($mysql, "UPDATE libOrders SET `yookassa_id`='$yookassa_id' WHERE `id`=$order LIMIT 1");
	if (mysqli_errno($mysql)) die("ERROR: ".mysqli_error($mysql)." at line ".__LINE__." of file ".__FILE__."\n");
}


?>


<script src="https://yookassa.ru/checkout-widget/v1/checkout-widget.js"></script>


<div id="payment-form"></div>

<script>
const checkout = new window.YooMoneyCheckoutWidget({
    confirmation_token: '<?php print $confirmation_token; ?>',
    return_url: 'https://библиотекикоролёва.рф/basket.php',

    error_callback: function(error)
    {
        errorBox(error)
    }
});

//Отображение платежной формы в контейнере
checkout.render('payment-form');
</script>


<?php
	PrintEnd();
?>

May the force be with you, always.