Renais
Новичок
<?php
include "../config.php";
if (isset($_POST['group']) && isset($_POST['nickname']) && $_POST['nickname'] != '' && isset($_POST['group'])) {
if (array_key_exists($_POST['group'], $options['groups'])) {
$toPay = $options['groups'][$_POST['group']]['price'];
$pdo = new PDO("mysql:host=" . $settings['db']['host'] . ";dbname=" . $settings['db']['dbname'], $settings['db']['user'], $settings['db']['password']);
$stmt = $pdo->prepare('SELECT `parent` FROM `permissions_inheritance` WHERE child = ?');
$stmt->execute(array(getUserUUID($_POST['nickname'])));
while ($row = $stmt->fetch()){
$group = $row['parent'];
}
if (isset($group)) {
$toPay = $toPay - $options['groups'][$group]['price'];
}
if (isset($_POST['promo']) && $_POST['promo'] != "") {
if (array_key_exists($_POST['promo'], $options['promo'])) {
$discount = $options['promo'][$_POST['promo']];
$toPay = $toPay - ($toPay / 100 * $discount);
}
}
if ($toPay <= 0) {
header("Location: /");
} else {
header("Location: https://sci.interkassa.com/?ik_co_id=" . $settings['interkassa']['id'] . "&ik_am=" . $toPay . "&ik_pm_no=" . $_POST['nickname'] . "_" . $_POST['group']. "&ik_desc=Покупка статуса");
}
}
} elseif (isset($_POST['case'])) {
if (array_key_exists($_POST['case'], $options['items'])) {
$toPay = $options['items'][$_POST['case']]['price'];
header("Location: https://sci.interkassa.com/?ik_co_id=" . $settings['interkassa']['id'] . "&ik_am=" . $toPay . "&ik_pm_no=" . $_POST['nickname'] . "_" . $_POST['group']. "&ik_desc=Покупка кейсов");
}
} elseif (isset($_POST['unban'])) {
$toPay = $options['unban'];
header("Location: https://sci.interkassa.com/?ik_co_id=" . $settings['interkassa']['id'] . "&ik_am=" . $toPay . "&ik_pm_no=" . $_POST['nickname'] . "_unban&ik_desc=Разбан");
} else {
header("Location: /");
}
function getUserUUID($name){
$val = md5("OfflinePlayer:". $name, true);
$byte = array_values(unpack('C16', $val));
$tLo = ($byte[0] << 24) | ($byte[1] << 16) | ($byte[2] << 8) | $byte[3];
$tMi = ($byte[4] << 8) | $byte[5];
$tHi = ($byte[6] << 8) | $byte[7];
$csLo = $byte[9];
$csHi = $byte[8] & 0x3f | (1 << 7);
if (pack('L', 0x6162797A) == pack('N', 0x6162797A)) {
$tLo = (($tLo & 0x000000ff) << 24) | (($tLo & 0x0000ff00) << 8) | (($tLo & 0x00ff0000) >> 8) | (($tLo & 0xff000000) >> 24);
$tMi = (($tMi & 0x00ff) << 8) | (($tMi & 0xff00) >> 8);
$tHi = (($tHi & 0x00ff) << 8) | (($tHi & 0xff00) >> 8);
}
$tHi &= 0x0fff;
$tHi |= (3 << 12);
$uuid = sprintf(
'%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x',
$tLo, $tMi, $tHi, $csHi, $csLo,
$byte[10], $byte[11], $byte[12], $byte[13], $byte[14], $byte[15]
);
return $uuid;
}
include "../config.php";
if (isset($_POST['group']) && isset($_POST['nickname']) && $_POST['nickname'] != '' && isset($_POST['group'])) {
if (array_key_exists($_POST['group'], $options['groups'])) {
$toPay = $options['groups'][$_POST['group']]['price'];
$pdo = new PDO("mysql:host=" . $settings['db']['host'] . ";dbname=" . $settings['db']['dbname'], $settings['db']['user'], $settings['db']['password']);
$stmt = $pdo->prepare('SELECT `parent` FROM `permissions_inheritance` WHERE child = ?');
$stmt->execute(array(getUserUUID($_POST['nickname'])));
while ($row = $stmt->fetch()){
$group = $row['parent'];
}
if (isset($group)) {
$toPay = $toPay - $options['groups'][$group]['price'];
}
if (isset($_POST['promo']) && $_POST['promo'] != "") {
if (array_key_exists($_POST['promo'], $options['promo'])) {
$discount = $options['promo'][$_POST['promo']];
$toPay = $toPay - ($toPay / 100 * $discount);
}
}
if ($toPay <= 0) {
header("Location: /");
} else {
header("Location: https://sci.interkassa.com/?ik_co_id=" . $settings['interkassa']['id'] . "&ik_am=" . $toPay . "&ik_pm_no=" . $_POST['nickname'] . "_" . $_POST['group']. "&ik_desc=Покупка статуса");
}
}
} elseif (isset($_POST['case'])) {
if (array_key_exists($_POST['case'], $options['items'])) {
$toPay = $options['items'][$_POST['case']]['price'];
header("Location: https://sci.interkassa.com/?ik_co_id=" . $settings['interkassa']['id'] . "&ik_am=" . $toPay . "&ik_pm_no=" . $_POST['nickname'] . "_" . $_POST['group']. "&ik_desc=Покупка кейсов");
}
} elseif (isset($_POST['unban'])) {
$toPay = $options['unban'];
header("Location: https://sci.interkassa.com/?ik_co_id=" . $settings['interkassa']['id'] . "&ik_am=" . $toPay . "&ik_pm_no=" . $_POST['nickname'] . "_unban&ik_desc=Разбан");
} else {
header("Location: /");
}
function getUserUUID($name){
$val = md5("OfflinePlayer:". $name, true);
$byte = array_values(unpack('C16', $val));
$tLo = ($byte[0] << 24) | ($byte[1] << 16) | ($byte[2] << 8) | $byte[3];
$tMi = ($byte[4] << 8) | $byte[5];
$tHi = ($byte[6] << 8) | $byte[7];
$csLo = $byte[9];
$csHi = $byte[8] & 0x3f | (1 << 7);
if (pack('L', 0x6162797A) == pack('N', 0x6162797A)) {
$tLo = (($tLo & 0x000000ff) << 24) | (($tLo & 0x0000ff00) << 8) | (($tLo & 0x00ff0000) >> 8) | (($tLo & 0xff000000) >> 24);
$tMi = (($tMi & 0x00ff) << 8) | (($tMi & 0xff00) >> 8);
$tHi = (($tHi & 0x00ff) << 8) | (($tHi & 0xff00) >> 8);
}
$tHi &= 0x0fff;
$tHi |= (3 << 12);
$uuid = sprintf(
'%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x',
$tLo, $tMi, $tHi, $csHi, $csLo,
$byte[10], $byte[11], $byte[12], $byte[13], $byte[14], $byte[15]
);
return $uuid;
}