Loading...
Нужно закрыть доступ от гостей
Что в return ; засунуть чтобы кидало на главную страницу ?


function UID_lvl($access_level)
{
global $user;
if ($user['access_level'] < $access_level || !isset($user))
return false;
}
________
посл. ред. 20.02.2021 в 02:30; всего 3 раз(а); by SNEG
Location?
Byte (20.02.2021 в 02:35)
Location?

return exit(header('Location: /')); типа так?
Или без exit()?
________
посл. ред. 20.02.2021 в 02:52; всего 1 раз(а); by SNEG
SNEG (20.02.2021 в 02:45)
return exit(header('Location: /')); типа так? Или без exit()?

Можно и без return просто header а после exit, последняя функция завершит скрипт Гг
System (20.02.2021 в 02:53) Можно и без return просто header а после exit, последняя функция завершит скрипт Гг
Я так понимаю , оба варианта будут одинакого работать?
php
   function UID_level($access_level) { global $user; if ($user['access_level'] < $access_level || !isset($user)) exit(header('Location: /')); }   
php
   function UID_level($access_level) { global $user; if ($user['access_level'] < $access_level || !isset($user)) return header('Location: /'); }   
SNEG (20.02.2021 в 03:18) Я так понимаю , оба варианта будут одинакого работать?
php
   function UID_level($access_level){global $user;if ($user['access_level'] < $access_level || !isset($user))exit(header('Location: /'));}   
php
   function UID_level($access_level){global $user;if ($user['access_level'] < $access_level || !isset($user))return header('Location: /');}[/hljs  
[hljs class="javascript"]function UID_level($access_level) { global $user; if ($user['access_level'] < $access_level || !isset($user)) (header('Location: /')); exit; }
function UID_level()
{
global $user;
if ($user['access_level'] < 5на пример || !isset($user))
header('Location: /');
exit();
}
Онлайн: 1
Время:
Gen. 0.101
(c) Bym.Guru 2010-2026