$hash = md5($_SERVER['HTTP_USER_AGENT'] . $_SERVER['REMOTE_ADDR']); } $for_sign = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\t\t\tSELECT `data`\n\t\t\t\t\tFROM `" . DB_PREFIX . "authorization`\n\t\t\t\t\tWHERE `hash` = 0x{$hash}\n\t\t\t\t\t", 'fetch_one'); $error = ParseData::checkSign($public_key, $for_sign, $sign, true); } if ($error) { $result = 0; } else { session_start(); define('MY_PREFIX', ''); $my_user_id = get_my_user_id($db); unset($_SESSION['restricted']); // убираем ограниченный режим $_SESSION['user_id'] = $my_user_id; if (!$_SESSION['user_id']) { $_SESSION['user_id'] = 'wait'; } else { $_SESSION['public_key'] = get_user_public_key2($my_user_id); } if ($my_user_id == get_admin_user_id($db)) { $_SESSION['ADMIN'] = 1; } /*if (check_change_key($my_user_id) > 0) $_SESSION['key_changed'] = 1; else $_SESSION['key_changed'] = 0;*/ print json_encode(array('result' => 1)); exit; } } print json_encode(array('result' => 0));
<?php if (!defined('DC')) { die("!defined('DC')"); } $tpl['data']['type'] = 'change_key_active'; $tpl['data']['type_id'] = ParseData::findType($tpl['data']['type']); $tpl['data']['time'] = time(); $tpl['data']['user_id'] = $user_id; $tpl['admin_user_id'] = get_admin_user_id($db); $data = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\tSELECT `change_key`,\n\t\t\t\t\t `change_key_time`,\n\t\t\t\t\t `change_key_close`\n\t\tFROM `" . DB_PREFIX . "users`\n\t\tWHERE `user_id` = {$user_id}\n\t\tLIMIT 1\n\t\t", 'fetch_array'); // разрешил ли уже юзер менять свой ключ админу $tpl['change_key_status'] = $data['change_key']; if ($data['change_key_time'] && !$data['change_key_close']) { $tpl['requests'] = date('d/m/Y H:i:s', $data['change_key_time']); } require_once ABSPATH . 'templates/restoring_access.tpl';