本文整理汇总了PHP中Auth::isLogged方法的典型用法代码示例。如果您正苦于以下问题:PHP Auth::isLogged方法的具体用法?PHP Auth::isLogged怎么用?PHP Auth::isLogged使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Auth
的用法示例。
在下文中一共展示了Auth::isLogged方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: withFB
function withFB()
{
if (Auth::isLogged()) {
die('Hacking Attempt');
}
Mold::theme("Register/register_with_fb");
}
示例2: process_login
function process_login()
{
$username = addslashes($_POST["admin_email"]);
$password = addslashes($_POST["admin_password"]);
$rememberme = isset($_POST["rememberme"]) ? 1 : 0;
if ($password == "") {
$password = "emptynoGakMkgAda yang pakai718";
}
$row = array("admin_email" => $username, "admin_password" => $password, "rememberme" => $rememberme);
/*if ($this->ldapLogin($username, $password)) {
$row["admin_ldap"] = 1;
}*/
//login pakai row credential
Auth::login($row);
//kalau sukses
if (Auth::isLogged()) {
//load school setting
// $ss = new Schoolsetting();
// $ss->loadToSession();
//redirect
//Account::setRedirection ();
Hook::processHook($this->login_hook);
Redirect::firstPage();
} else {
Redirect::loginFailed();
}
}
示例3: login
/** @Auth("*") */
public function login()
{
if (Auth::isLogged()) {
$this->_redirect('~/unidade');
}
if (is_post) {
$form = $this->_data();
$usuario = Usuario::logar($form->oab, $form->senha);
if ($usuario) {
if ($usuario->Bloqueado == 1) {
$this->_flash('alert alert-error fade in', 'Login ou Senha incorreta!');
//Usuário bloqueado!
} else {
Auth::set($usuario->EhAdmin == 1 ? "admin" : "usuario");
Session::set('usuario', $usuario);
$url = '~/ci/rascunho';
if (isset($_GET['forwarded']) && $_GET['forwarded'] != '') {
$url = '~/' . $_GET['forwarded'];
}
$this->_redirect($url);
}
} else {
$this->_flash('alert alert-error fade in', 'Login ou Senha incorreta!');
}
}
return $this->_view();
}
示例4: check
public static function check()
{
if (!Auth::isLogged()) {
return False;
}
return Auth::getUser()["abonement"] == 1;
}
示例5: indexCheckRemember
public static function indexCheckRemember()
{
if (!Auth::isLogged()) {
$row = self::checkRemember();
if (count($row) > 0) {
self::login($row);
}
}
}
示例6: access
public function access()
{
if (!Auth::isLogged()) {
$this->redirect("/login");
}
if (!Auth::isAdmin()) {
Error::httpError(403);
}
}
示例7: logout
public function logout()
{
global $_TB_IDENTITY;
if (Auth::isLogged(App::$instance)) {
setcookie(md5("logged" . $_TB_IDENTITY[App::$instance->user->origin]['serviceName']), false, time() - 3600, '/', Null, 0);
} else {
App::$instance->MQ->setMessage('Вы не авторизированы');
}
ST::redirectToRoute("Index/index");
}
示例8: CheckRequestedRoute
public function CheckRequestedRoute($controller, $action)
{
$routes = App::$instance->routes;
$result = new stdClass();
$result->controller = false;
$result->action = false;
$result->method = false;
$result->access = false;
$result->ajax = false;
foreach ($routes as $route) {
//is ajax?
if (ST::isAjaxRequest() && $route->ajax) {
$result->ajax = true;
}
// dump($result);
//check requested controller
if ($route->controller === $controller) {
$result->controller = True;
//check requested action
foreach ($route->action as $founded_action) {
// dump($founded_action);
if ($founded_action === '*' || $founded_action === $action) {
$result->action = True;
//check requested method
foreach ($route->methods as $founded_method) {
if ($founded_method === '*' || $founded_method === strtolower($_SERVER['REQUEST_METHOD'])) {
$result->method = True;
//check requested access
foreach ($route->access as $founded_access) {
if ($founded_access === '*') {
$result->access = True;
break;
}
if (Auth::isLogged(App::$instance) && $founded_access === '@') {
$result->access = True;
break;
}
if (Auth::isLogged(App::$instance)) {
if ($founded_access === App::$instance->user->role) {
$result->access = True;
//check requested access
}
}
}
}
}
// break;
}
}
// break;
}
}
// dump($result);
return $result;
}
示例9: actionActivate
public function actionActivate()
{
if (!Auth::isLogged()) {
$this->redirect("/");
}
$message = false;
if (isset($_POST['code'])) {
$model = CodeModel::model()->where("`code`='" . $_POST['code'] . "'")->findRow();
if (!$model) {
$message = "Данный код не найден.";
} else {
Abonement::addMonths($model->months);
$model->delete();
$message = "Код успешно активирован.";
}
}
$this->view("abonem/activate", array("message" => $message), false);
}
示例10: login
function login()
{
$username = addslashes($_POST["admin_username"]);
$password = addslashes($_POST["admin_password"]);
$rememberme = isset($_POST["rememberme"]) ? 1 : 0;
$row = array("admin_username" => $username, "admin_password" => $password, "rememberme" => $rememberme);
//login pakai row credential
Auth::login($row);
//kalau sukses
if (Auth::isLogged()) {
//load school setting
$ss = new Schoolsetting();
$ss->loadToSession();
//redirect
Account::setRedirection();
} else {
Redirect::loginFailed();
}
}
示例11: pull
public function pull()
{
if (!Auth::isLogged(App::$instance)) {
die(json_encode([]));
}
// not auth
//set time barrier
if (!$this->isCanBePulled()) {
die(json_encode([]));
}
// not time come
$startThere = date_create()->modify("-120 seconds");
$readed = $this->sesRead();
//define last access time
$this->putLastRequestTime();
//get notices
$notifications = Notification::where("created_at", ">", $startThere)->where("created_at", "<", date_create())->whereNotIn("id", $readed['filtered'])->whereIn("to", [0, App::$instance->user->id])->take(5)->get();
//humanize
if (count($notifications)) {
foreach ($notifications as $notice) {
$notice->humanized = new stdClass();
$notice->humanized->created_at = date_create($notice->created_at)->format("d.m.Y H:i:s");
}
}
//mark as collected
if (count($notifications)) {
foreach ($notifications as $notice) {
$readed['raw'][] = [$notice->id, date_create()->format("Y-m-d H:i:s")];
}
$this->sesWrite($readed['raw']);
}
if (ST::isAjaxRequest()) {
print json_encode($notifications);
} else {
return $notifications;
}
}
示例12: login
public function login()
{
if (empty($_POST['log'])) {
if (Auth::isLogged()) {
header('location: ' . URL . CONTEXT_PATH_ADMIN);
} else {
$this->view->renderAdmin(RENDER_VIEW_USER_LOGIN, TRUE);
}
} else {
//Thực hiện đăng nhập
// run the login() method in the login-model, put the result in $login_successful (true or false)
Model::autoloadModel('User');
$model = new UserModel($this->db);
if ($model->loginValidate()) {
if ($model->login($_POST['log'])) {
header('location: ' . URL . CONTEXT_PATH_ADMIN);
} else {
$this->view->renderAdmin(RENDER_VIEW_USER_LOGIN, TRUE);
}
} else {
$this->view->renderAdmin(RENDER_VIEW_USER_LOGIN, TRUE);
}
}
}
示例13: session_start
<?php
session_start();
require "../../../auth.php";
if (Auth::isLogged()) {
} else {
header('Location:forms/404.php');
}
include '../../functions.php';
global $db;
$today = date("Y-m-d");
$myadmin = $_SESSION['auth']['myadmin'];
$myid = $_SESSION['auth']['myid'];
if ($myadmin == 1) {
$sql = "SELECT id, nom_usage FROM collaborateurs ORDER BY nom_usage ";
} else {
$sql = "SELECT id, nom_usage FROM collaborateurs Where ((collaborateurs.debauche > '{$today}') OR (collaborateurs.debauche IS NULL)) ORDER BY nom_usage ";
}
$sth = $db->query($sql);
$list_collab = $sth->fetchall();
$sql = "SELECT DISTINCT clients.id as id_cli, clients.nom, (SELECT colors.ref\n FROM colors INNER JOIN (collaborateurs INNER JOIN (clients INNER JOIN color_client_collab ON clients.id = color_client_collab.id_client) ON collaborateurs.id = color_client_collab.id_collab) ON colors.id = color_client_collab.id_color\n WHERE (((clients.id)=id_cli) AND ((collaborateurs.id)={$myid}))) FROM (clients INNER JOIN contrats ON clients.id = contrats.id_client) INNER JOIN (collaborateurs INNER JOIN affect_cont_collab ON collaborateurs.id = affect_cont_collab.id_collab) ON contrats.id = affect_cont_collab.id_contrat WHERE (((collaborateurs.id)={$myid}))";
$stcli = $db->query($sql);
$list_cli = $stcli->fetchall();
$sql = "SELECT date_format(heures.heures, '%H:%i') FROM heures";
$sth = $db->query($sql);
$list_h = $sth->fetchall();
?>
<link rel="stylesheet" type="text/css" href="./src/css/app-new.css">
<link href="./bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<!-- <link href="./font-awesome-4.1.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" /> -->
示例14: stdClass
$data["question"] = new stdClass();
$data["question"]->question_content = "";
$data["question"]->question_hint = "";
$data["question"]->question_type = "checkbox";
$data["question"]->question_weight = "1";
$data["question"]->question_weight = "1";
$data["choices"] = array();
$data["choices"][0] = new stdClass();
$data["choices"][0]->choice_status = 0;
$data["choices"][0]->question_type = "checkbox";
$data["choices"][0]->choice_content = "";
$data["choices"][0]->choice_id = -1;
}
}
} else {
if ($auth->isLogged() && Validation::Query($_GET, array("id")) && is_numeric($_GET["id"])) {
$question_result = $_MYSQLI->query('SELECT * FROM question INNER JOIN questionnaire ON questionnaire_id = question_questionnaire_id WHERE question_id = ' . $_GET["id"]);
if ($question_result->num_rows > 0) {
$error = false;
$data["question"] = $question_result->fetch_object();
$own = $data["question"]->questionnaire_user_id == Auth::getUserId();
$choice_query = ' SELECT *, SUM(case when answer_student_user_id = ' . Auth::getUserId() . ' then 1 else 0 end) as checked
FROM question q
JOIN choice c ON c.choice_question_id = q.question_id
LEFT JOIN answer a ON a.answer_choice_id = c.choice_id
WHERE question_id = ' . $_GET["id"] . '
GROUP BY choice_id
ORDER BY question_num ASC, question_id ASC';
$choice_result = $_MYSQLI->query($choice_query);
$choice_ids = array();
$data["choices"] = array();
示例15:
<?php
ST::deployTemplate('heads/ui_timepicker.inc');
RenderEngine::MenuChanger();
?>
<div class="container">
<div class="col-md-12 text-center">
<br><br><br><br>
<h1 class="text-muted">Ошибка</h1>
<span class="text-muted" style="font-size: 160px; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;">401</span>
<h1 class="text-muted">Недостаточно прав для доступа</h1>
<hr>
<h4 class="text-center"><?php
echo !Auth::isLogged(App::$instance) ? "<a href='" . ST::routeToCa('AuthNew/login') . "'>Войти в систему</a> " : '';
?>
</h4>
</div>
</div>