63 $this->groups =
'[0]';
64 foreach (
$user as $prop => $value) {
65 $this->$prop = $value;
67 $this->groups = array_filter(json_decode($this->groups,
true),
function (
$id) {
72 return ($row->weight < $this->weight || in_array($row->id, $this->groups)) && $row->id != 1;
76 return ($row->weight < $this->weight || in_array($row->id, $this->groups));
79 return $row->weight <= $this->weight && $row->id != 1;
82 return in_array($row->id, $this->groups);
98 if (!$this->
id)
return;
99 $password = trim($password);
100 $sth =
$dbh->prepare(
"UPDATE `users` SET `md5password` = :md5password WHERE `id` = :id");
101 $sth->bindValue(
':md5password', md5($password));
102 $sth->bindValue(
':id', $this->
id);
104 $this->md5password = md5($password);
105 return $sth->rowCount();
118 if (!$this->
id)
return;
119 $email = mb_strtolower(trim($email),
'utf-8');
120 $sth =
$dbh->prepare(
"UPDATE `users` SET `email` = ? WHERE `id` = ?");
121 $sth->bindValue(1, $email);
122 $sth->bindValue(2, $this->
id);
124 $this->email = $email;
125 return $sth->rowCount();
138 if (!empty($_COOKIE[
'FROM_UID']))
return;
139 $sth =
$dbh->prepare(
"UPDATE `users` SET `date_online` = NOW(), `ip` = :ip WHERE `id` = :id AND `act` = 1");
141 $sth->bindValue(
':id', $this->
id);
154 if (!$this->
id || in_array(
$request, [
'/disabled',
'/forbidden'])) {
157 if (!empty($_COOKIE[
'FROM_UID']))
return;
158 $sth =
$dbh->prepare(
"UPDATE `users` SET `request` = :request WHERE `id` = :id AND `act` = 1");
160 $sth->bindValue(
':id', $this->
id);
171 public static function get(
$id)
175 $sth =
$dbh->prepare(
"SELECT * FROM `users` WHERE `id` = ?");
177 return $sth->fetch();
187 if (!empty($_COOKIE[
'FROM_UID'])) {
188 setcookie(
'FROM_UID', 0, [
189 'expires' =>
time() - 31536000,
196 $_COOKIE[
'FROM_UID'] = 0;
202 setcookie(
'UID', 0, [
203 'expires' =>
time() - 31536000,
232 if (empty($_COOKIE[
'UID'])) {
234 setcookie(
'UID',
$uid, [
235 'expires' =>
time() + 31536000,
242 $_COOKIE[
'UID'] =
$uid;
244 } elseif (!empty($_COOKIE[
'UID'])) {
262 public static function match($email)
265 $email = trim($email);
269 $sth =
$dbh->prepare(
"SELECT * FROM `users` WHERE `email` = ?");
270 $sth->execute([$email]);
271 return $sth->fetch();
314 $dbh->query(
"UPDATE `users` SET `email_confirmed` = $email_confirmed WHERE `id` = $this->id");
315 $this->email_confirmed = $email_confirmed;
if(!($row=Wrong\Models\Crontabs::find($_POST['id']))) if(! $user->access() ->write($row)) $sth
User отвечает за работу с данными пользователя
static session($init_id=0)
static is_remind($id, $md5)
set_confirm($email_confirmed=1)
static is_confirm($id, $md5)
Connect создает подключение к базе данных
static getInstance($ignore_error=false)
Access класс, проверки прав доступов
Group класс, содержащий статические методы, используемые для управления группами пользователей.
static max_weight_group($arr)
Env класс управляющий, добавляющий или записывающий переменные среды
setcookie('FROM_UID', $uid, [ 'expires'=> time()+31536000, 'path'=> '/', 'domain'=> $_SERVER['HTTP_HOST'], 'secure'=> Wrong\Start\Env::$e->IS_SECURE, 'httponly'=> false, 'samesite'=> Wrong\Start\Env::$e->IS_SECURE ? 'None' :'Lax']) or setcookie('FROM_UID' time()+31536000
setcookie('FROM_UID', $uid, [ 'expires'=> time()+31536000, 'path'=> '/', 'domain'=> $_SERVER['HTTP_HOST'], 'secure'=> Wrong\Start\Env::$e->IS_SECURE, 'httponly'=> false, 'samesite'=> Wrong\Start\Env::$e->IS_SECURE ? 'None' :'Lax']) or setcookie('FROM_UID' Wrong Start Env::$e IS_SECURE
if(!($row=Wrong\Models\Users::find($_POST['id']))) if($row->id==$user->id) if(! $user->access() ->write($row)) $uid
setcookie('FROM_UID', $uid, [ 'expires'=> time()+31536000, 'path'=> '/', 'domain'=> $_SERVER['HTTP_HOST'], 'secure'=> Wrong\Start\Env::$e->IS_SECURE, 'httponly'=> false, 'samesite'=> Wrong\Start\Env::$e->IS_SECURE ? 'None' :'Lax']) or setcookie('FROM_UID' $_SERVER['HTTP_HOST']
catch(\Throwable $th) $request