<?php
include 'config.php';
$base_logs = new mysqli(Config::DB_HOST_LOG, Config::DB_USER_LOG, Config::DB_PASS_LOG, Config::DB_NAME_LOG) or die("Ошибка BD #2!");
$base_logs -> query("SET character_set_results = utf8");
$base_logs -> query("SET NAMES 'utf8'");
$TABLE_LOG = Config::DB_LOG_TABLE;
$base_server = new mysqli(Config::DB_HOST_SERVER, Config::DB_USER_SERVER, Config::DB_PASS_SERVER, Config::DB_NAME_SERVER) or die("Ошибка BD #1!");
$base_server -> query("SET character_set_results = utf8");
$base_server -> query("SET NAMES 'utf8'");
if (isset($_COOKIE[hash]))
{
$result = $base_logs -> query("SELECT user_id FROM coookie WHERE hash = '".$_COOKIE[hash]."' LIMIT 1; ");
$data = mysqli_fetch_array($result);
$sql = "SELECT * FROM user WHERE id = '".$data[user_id]."' LIMIT 1;";
$result -> close();
$result = $base_logs -> query($sql);
$cookie = mysqli_fetch_assoc($result);
$result -> close();
$ip = explode( (strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ':') == true ? ':':'.' ), $_SERVER['HTTP_X_FORWARDED_FOR'] );
$cookie[ip] = $ip[0].'^'.$ip[1].'^'.$ip[2];
$sign = hash('sha512', implode ( '|', $cookie ), false);
if ($sign !== $_COOKIE[hash])
{
$base_logs -> query("DELETE FROM coookie WHERE hash = '".$_COOKIE[hash]."'");
setcookie("hash", "", time() - 30, "/", "", 1);
unset($_SESSION['account_log_name']);
unset($_SESSION['account_log_password']);
session_destroy();
header('Location: ../check/authorization');
die();
}
}
else
{
$user = $_SESSION["account_log_name"];
$password = $_SESSION["account_log_password"];
$sql = "SELECT * FROM user WHERE login = '".$user."' AND password = '".$password."'";
}
$query = $base_logs -> query($sql);
$row = mysqli_num_rows($query);
$data = mysqli_fetch_assoc($query);
$subscription = $data['sub'];
if (!$row && $_SERVER['SCRIPT_NAME'] !== '/check/authorization')
{
unset($_SESSION['account_log_name']);
unset($_SESSION['account_log_password']);
session_destroy();
header('Location: ../check/authorization');
die();
}
else if (!$data[status])
{
die('<html><head><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"></head></html><center><b>Внимание ошибка авторизации:<br />Ваш аккаунт проходит модерацию</b><br /><a href = ../check/authorization>Вернуться на раздел авторизации</a></center>');
return false;
}
$query -> close();
$query = $base_logs -> query('SELECT * FROM `settings`');
$server = mysqli_fetch_assoc($query);
if (!$server[status])
{
include '../404/close.php';
die();
return false;
}
else if ($row && $subscription < time() && $_SERVER['SCRIPT_NAME'] !== '/pages/subscription.php')
{
header('Location: ../pages/subscription');
die();
}
?>
{
"group_id": 207221152,
"type": "message_new",
"event_id": "b30225df6cfd6de14e67c132bddd2b799442af76",
"v": "5.131",
"object": {
"message": {
"date": 1677832192,
"from_id": 320057906,
"id": 0,
"out": 0,
"attachments": [],
"conversation_message_id": 512,
"fwd_messages": [],
"important": false,
"is_hidden": false,
"peer_id": 2000000008,
"random_id": 0,
"text": "!test [id658634106|@poliopo]"
},
"client_info": {
"button_actions": [
"text",
"vkpay",
"open_app",
"location",
"open_link",
"callback",
"intent_subscribe",
"intent_unsubscribe"
],
"keyboard": true,
"inline_keyboard": true,
"carousel": true,
"lang_id": 0
}
}
}
if (mb_substr($message,0,5) == '!kick')
{
if (in_array($id, $is_admin))
{
$kick_id = mb_substr($message ,6);
$kick_id = explode("|", mb_substr($kick_id, 3))[0];
if($kick_id == "")
{
$vk->sendMessage($peer_id, "ID указан неверно.");
}
else
{
$vk->request('messages.addChatUser', ['chat_id' => $chat_id, 'user_id' => $kick_id]);
//$vk->request('messages.removeChatUser', ['chat_id' => $chat_id, 'member_id' => $kick_id]);
$msg = explode( ' ', $message );
$id = $data->object->from_id;
$userInfo = $vk->request("users.get", ["user_ids" => $id]);
$first_name1 = $userInfo[0]['first_name']; // Имя исключаемого пользователя
$last_name1 = $userInfo[0]['last_name']; // Фамилия исключаемого пользователя
$userInfo = $vk->request("users.get", ["user_ids" => $kick_id]);
$first_name = $userInfo[0]['first_name']; // Имя исключаемого пользователя
$last_name = $userInfo[0]['last_name']; // Фамилия исключаемого пользователя
$vk->sendMessage($peer_id, "Администратор @id$id ($first_name1 $last_name1) исключил пользователя @id$kick_id ($first_name $last_name) причина: $msg[2]");
}
}
else
{
$vk->sendMessage($peer_id, "[Ошибка] У вас недостаточно административных прав.");
}
}