本文整理汇总了PHP中is_auth函数的典型用法代码示例。如果您正苦于以下问题:PHP is_auth函数的具体用法?PHP is_auth怎么用?PHP is_auth使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_auth函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show_signin
function show_signin()
{
if (is_auth()) {
redirect("home");
}
render("signin");
}
示例2: show_home
function show_home()
{
if (!is_auth()) {
redirect("user/signin");
}
render("home");
}
示例3: __construct
/**
* Responsable for auto load the model
* @return void
*/
public function __construct()
{
parent::__construct();
if (!is_auth()) {
redirect('admin/login');
}
}
示例4: pageBody
function pageBody($mode)
{
$isAuth = is_auth();
$res = "";
if (!$isAuth) {
$res = auth_form();
} else {
$res = main_form() . get_orders_table($mode);
}
return $res;
}
示例5: __construct
function __construct()
{
parent::__construct();
// Check Auth Login
if (!is_login('Administrator')) {
redirect('users/admin/auth');
}
if (!is_auth()) {
redirect('users/admin/auth/fail');
}
$this->template->set_theme('admin');
// Set layout
$this->template->set_layout('layout');
// Load Langauge
$this->lang->load('admin');
// Set js
$this->template->append_metadata(js_notify());
}
示例6: include_css
echo include_css("bootstrap-wysihtml5.css");
?>
<?php
echo include_css("style.css");
?>
<?php
echo "<script>var PATH = '{$config["path"]}';</script>";
?>
</head>
<body>
<div class="container-narrow">
<div class="masthead">
<?php
if (is_auth()) {
?>
<ul class="nav nav-pills pull-right">
<li class="<?php
echo $controller == "home" ? "active" : "";
?>
">
<?php
echo link_to("home", "Home");
?>
</li>
<li class="<?php
echo $controller == "user" ? "active" : "";
?>
">
<?php
示例7: _before
/**
* Этот метод будет запущен перед выполнением
* любого экшена
*/
public function _before()
{
if (!is_auth()) {
redirect(['controller' => 'index']);
}
}
示例8: invoke_controller
/**
* invoke a controller based on the query arguments given
*
* this function does not return in case of an error.
* @param array $args query-arguments array
* @return mixed return value of controller that was called
*/
function invoke_controller($args)
{
global $controllers;
// change query-arguments so that we always have a arg0 and arg1
if (!isset($args[0])) {
$args[0] = array('', '');
} elseif (is_string($args[0])) {
$args[0] = array($args[0], '');
}
// load all modules
// TODO (later): fastpath for serving cached pages or files (the latter one
// is only doable when we store in the object file which module to load)
load_modules();
$match = false;
if (isset($controllers[$args[0][0] . '-' . $args[0][1]])) {
// foo/bar would match controller for "foo/bar"
$match = $controllers[$args[0][0] . '-' . $args[0][1]];
$reason = $args[0][0] . '/' . $args[0][1];
} elseif (isset($controllers[$args[0][0] . '-*'])) {
// foo/bar would match "foo/*"
$match = $controllers[$args[0][0] . '-*'];
$reason = $args[0][0] . '/*';
} elseif (isset($controllers['*-' . $args[0][1]])) {
// foo/bar would match "*/bar"
$match = $controllers['*-' . $args[0][1]];
$reason = '*/' . $args[0][1];
} elseif (isset($controllers['*-*'])) {
// foo/bar would match "*/*"
$match = $controllers['*-*'];
$reason = '*/*';
}
if ($match !== false) {
// check authentication for those controllers that require it
if (isset($match['auth']) && $match['auth']) {
if (!is_auth()) {
prompt_auth();
}
// also check the referer to prevent against cross site request
// forgery (xsrf)
// this is not really optimal, since proxies can filter the referer
// header, but as a first step..
if (!empty($_SERVER['HTTP_REFERER'])) {
$bu = base_url();
if (substr($_SERVER['HTTP_REFERER'], 0, strlen($bu)) != $bu) {
log_msg('warn', 'controller: possible xsrf detected, referer is ' . quot($_SERVER['HTTP_REFERER']) . ', arguments ' . var_dump_inl($args));
hotglue_error(400);
}
}
}
log_msg('info', 'controller: invoking controller ' . quot($reason) . ' => ' . $match['func']);
return $match['func']($args);
} else {
// normally we won't reach this as some default (*/*) controller will
// be present
log_msg('warn', 'controller: no match for ' . quot($args[0][0] . '/' . $args[0][1]));
hotglue_error(400);
}
}
示例9: Section
$timetable["Manage Timetable"]["View Timetable"]["For a Branch"] = "student_select.php";
$timetable["Manage Timetable"]["View Timetable"]["For a Section (Firstyear)"] = "section_select.php";
} else {
if (is_auth("stu") || is_auth("ft")) {
$timetable["Manage Timetable"]["View Timetable"] = array();
if (is_auth("stu")) {
$timetable["Manage Timetable"]["View Timetable"]["For You"] = "student.php";
} else {
$timetable["Manage Timetable"]["View Timetable"]["For Firstyears"] = "view_firstyr_faculty.php";
$timetable["Manage Timetable"]["View Timetable"]["For Secondyear onwards"] = "view_faculty.php";
}
$timetable["Manage Timetable"]["View Timetable"]["For a Classroom"] = "classroom_select.php";
$timetable["Manage Timetable"]["View Timetable"]["For a Branch"] = "student_select.php";
$timetable["Manage Timetable"]["View Timetable"]["For a Section (firstyear)"] = "section_select.php";
} else {
if (is_auth("deo")) {
$timetable["Manage Timetable"]["View Timetable"] = array();
$timetable["Manage Timetable"]["View Timetable"]["For a Classroom"] = "classroom_select.php";
$timetable["Manage Timetable"]["View Timetable"]["For a Branch"] = "student_select.php";
$timetable["Manage Timetable"]["View Timetable"]["For a Section (firstyear)"] = "section_select.php";
$timetable["Manage Timetable"]["Enter Timetable for a Section (firstyear)"] = "dataoperator_enter_timetable.php";
$timetable["Manage Timetable"]["Assign Classroom to Class"] = array();
$timetable["Manage Timetable"]["Assign Classroom to Class"]["For Firstyears"] = "assign_classroom_firstyear.php";
$timetable["Manage Timetable"]["Assign Classroom to Class"]["For Secondyear onwards"] = "assign_classroom.php";
$timetable["Manage Timetable"]["Assign Subject to Faculty"] = "assign_subject.php";
//$timetable["Manage Timetable"]["Set Timelength to Period"]="set_time.php";
$timetable["Manage Timetable"]["Manage Classrooms"] = array();
$timetable["Manage Timetable"]["Manage Classrooms"]["Add classrooms"] = "adding_classrooms.php";
$timetable["Manage Timetable"]["Manage Classrooms"]["Block classrooms"] = array();
$timetable["Manage Timetable"]["Manage Classrooms"]["Block classrooms"]["Block Building"] = "block_building.php";
$timetable["Manage Timetable"]["Manage Classrooms"]["Block classrooms"]["Block Room"] = "block_room.php";
示例10: gettoken
function gettoken()
{
if (is_auth() && isset($_SESSION["token"])) {
echo $_SESSION["token"];
return;
}
login("token");
}
示例11:
<?php
if (false === ($user = is_auth())) {
?>
<a href="/registration/">Регистрация</a><br />
<a href="/authorization/">Вход</a>
<?php
} else {
?>
Привет, <?php
echo $user['login'];
?>
<br />
<a href="/cabinet/">Кабинет</a><br />
<a href="/out/">Выход</a>
<?php
}
示例12: elseif
} elseif (!$direct) {
$lnk .= 'source/campaign-ads';
}
echo $lnk;
exit;
}
if ($_REQUEST['ajax_act'] == 'sync_slaves') {
dmp(cache_rules_update());
dmp(cache_links_update());
exit;
}
// Страницы, на которые можно войти без авторизации
$open_pages = array('login', 'lostpassword', 'resetpassword');
// Authentification
if (!in_array($_REQUEST['page'], $open_pages)) {
$auth_info = is_auth();
if ($auth_info[0] == false) {
switch ($auth_info[1]) {
case 'register_new':
if ($_REQUEST['page'] != 'register') {
header('Location: ' . _HTML_ROOT_PATH . "/?page=register");
}
break;
default:
header('Location: ' . _HTML_ROOT_PATH . "/?page=login");
break;
}
}
}
if (isset($_REQUEST['csrfkey']) && $_REQUEST['csrfkey'] == CSRF_KEY) {
switch ($_REQUEST['ajax_act']) {
示例13: download_serve_resource
function download_serve_resource($args)
{
$obj = $args['obj'];
if (!isset($obj['type']) || $obj['type'] != 'download') {
return false;
}
$a = expl('.', $obj['name']);
// serve the resource only when it's public or we're logged in (i.e. editing)
if (isset($obj['download-public']) && $obj['download-public'] == 'public' || is_auth()) {
serve_file(CONTENT_DIR . '/' . $a[0] . '/shared/' . $obj['download-file'], $args['dl'], $obj['download-file-mime']);
} else {
if (!is_auth()) {
prompt_auth(true);
}
}
}
示例14: drawHeader
require_once "../Includes/ConfigSQL.php";
//to draw header drawHeader() is calling
drawHeader("TimeTable Info System");
//initialize the session if it is not initialized
if (!isset($_SESSION)) {
session_start();
}
//to redirect to logout.php page if user is not logged in
if (!isset($_SESSION['id'])) {
header("Location:../Logout.php");
}
if (isset($_GET['notification'])) {
drawNotification($_GET['notification'], $_GET['content'], $_GET['type']);
}
if (is_auth("stu")) {
header("Location:student.php");
} else {
if (is_auth("deo")) {
header("Location:dataoperator_timetable.php");
} else {
if (is_auth("ft") || is_auth("hod")) {
header("Location:view_faculty.php");
} else {
drawNotification("Error", "Sorry you are not allowed to access the page.", "error");
}
}
}
drawFooter();
?>
</body>
</html>
示例15: session_start
<?php
if (!defined('Sprinklers')) {
#Start session
if (!isset($_SESSION)) {
session_start();
}
#Tell main we are calling it
define('Sprinklers', TRUE);
#Required files
require_once "main.php";
}
#Redirect if not authenticated or grabbing page directly
if (!is_auth() || !isset($_SERVER['HTTP_X_REQUESTED_WITH']) || $_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest') {
header('Location: ' . $base_url);
exit;
}
#Get controller settings
$_SESSION["data"] = start_data();
#Include the main javascript file
echo "<script>";
include_once "js/main.js.php";
echo "</script>";
?>
<div data-role="page" id="sprinklers">
<div data-theme="b" data-role="header" data-position="fixed" data-tap-toggle="false">
<a data-icon="bars" data-iconpos="notext" href="#sprinklers-settings"></a>
<a data-icon="gear" data-iconpos="notext" href="#settings"><?php
echo _("Settings");
?>