本文整理汇总了PHP中isLoggedIn函数的典型用法代码示例。如果您正苦于以下问题:PHP isLoggedIn函数的具体用法?PHP isLoggedIn怎么用?PHP isLoggedIn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isLoggedIn函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: userName
function userName()
{
if (isLoggedIn()) {
return $_SESSION['username'];
} else {
return '';
}
}
开发者ID:r0the,项目名称:paedawan,代码行数:8,代码来源:session.php
示例2: action
/**
* Function renders main page and implements user login behaviour.
* If user is already logged in, he will be redirected to his twitter wall.
* If user doesn't exist or entered data is wrong, warning message will show.
*/
public function action()
{
if (isLoggedIn()) {
redirect(\route\Route::get("twitterWall")->generate(array("id" => UserRepository::getIdByUsername($_SESSION['username']))));
}
$main = new Main();
$main->setPageTitle("Twitter App");
$body = new \templates\Index();
$main->setBody($body);
echo $main;
if (UserRepository::isLoggedIn()) {
redirect(\route\Route::get("twitterWall")->generate());
}
if (post('login')) {
$username = htmlentities(trim(post('username')));
$password = htmlentities(trim(post('password')));
$hashedPassword = hash_password($password);
if (UserRepository::login($username, $hashedPassword)) {
redirect(\route\Route::get("twitterWall")->generate(array("id" => UserRepository::getIdByUsername($_SESSION['username']))));
exit;
} else {
?>
<script src="assets/js/loginError.js"></script>
<?php
}
}
}
开发者ID:chiiiro,项目名称:SSP-TwitterApp,代码行数:32,代码来源:Index.php
示例3: redirect
function redirect($page)
{
$currentPage = basename($_SERVER['PHP_SELF']);
// prevent redirecting away from graphs.php when $.post is accessing
if ($currentPage == 'graphs.php' || $currentPage == 'verify.php') {
if ($_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest') {
header('Location: /fp2.0/');
exit;
}
} else {
if ($currentPage != $page) {
if ($page == 'index.php') {
$page = '';
}
// make sure index.php is not included so that the url is shorter
if (!isLoggedIn()) {
header("Location: login.php");
exit;
} else {
if ($currentPage != 'monthlyReport.php' && $currentPage != 'settings.php') {
header("Location: /fp2.0/" . $page);
exit;
}
}
}
}
}
开发者ID:HomerGaidarski,项目名称:Gunter-Hans-Transaction-Reports,代码行数:27,代码来源:session.php
示例4: handleCookies
function handleCookies()
{
// if no session lets check for cookies
if (!isLoggedIn()) {
if (isset($_COOKIE["urika_userlogin"]) == true && isset($_COOKIE["urika_login_tried"]) == false) {
$CI =& get_instance();
$CI->load->model("user_model");
$query = $CI->user_model->getUser($_COOKIE["urika_userlogin"], "u_username");
if ($query) {
// now verify secret before creating session
$row = $query->row();
if (isset($_COOKIE["urika_usersecret"]) && md5($row->u_username . $row->u_password) == $_COOKIE["urika_usersecret"]) {
// win lets make a session
$data = array('username' => $row->u_username, 'user_id' => $row->user_id, 'is_logged_in' => true, 'image_url' => getUserProfileURL($row->u_profile_id, $row->u_email));
$CI->session->set_userdata($data);
} else {
// no luck
setcookie("urika_login_tried", $_COOKIE["urika_userlogin"]);
}
} else {
// no match, so et a cookie so we don't try over and over again
setcookie("urika_login_tried", $_COOKIE["urika_userlogin"]);
}
}
}
}
开发者ID:redroot,项目名称:URIKA,代码行数:26,代码来源:user_cookie.php
示例5: logout
function logout()
{
if (isLoggedIn()) {
unset($_SESSION['user']);
}
return true;
}
开发者ID:Tourepedia,项目名称:v1.1,代码行数:7,代码来源:userFunctions.php
示例6: find
public function find()
{
if (!$this->uri->segment(3)) {
show_404(current_url(), FALSE);
} else {
if ($this->data['Treasure'] = $this->treasure_model->get_by('md5', $this->uri->segment(3))) {
if (isFound($this->data['Treasure']->id, $this->session->userdata('id'))) {
$found = TRUE;
} else {
$found = FALSE;
if (isLoggedIn()) {
if (!isBanned($this->session->userdata('id'))) {
if (!isAdmin()) {
$this->mytreasure_model->insert(array('pirate' => $this->session->userdata('id'), 'treasure' => $this->data['Treasure']->id, 'time' => time()));
}
}
}
}
$this->data['found'] = $found;
$this->template->write_view('content', 'views/treasure/find', $this->data);
$this->template->render();
} else {
show_404(current_url(), FALSE);
}
}
}
开发者ID:robertmain,项目名称:Treasure-Hunt,代码行数:26,代码来源:treasure.php
示例7: loggedin_user
/**
* Returns the current logged in user
*
* @return array|null
*/
function loggedin_user()
{
//User is not lgged in
if (!isLoggedIn()) {
//we return null
return null;
}
//Check if we have user id
if (!isset($_SESSION['user_id']) || $_SESSION['user_id'] == '' || $_SESSION['user_id'] == null) {
//Return null
return null;
}
//Create new user object
$user = new App\Models\User();
//Get user id
$user_id = $_SESSION['user_id'];
//Get the user
$results = $user->query("SELECT * FROM users WHERE id = '" . $user_id . "'");
//We got the results
if ($results != false) {
//Return the current user row
return $results[0];
} else {
//No user found
//return null
return null;
}
}
开发者ID:AshniSukhoo,项目名称:blog,代码行数:33,代码来源:helpers.php
示例8: getUsername
/**
* Vraca korisnicko ime ako je korisnik ulogiran.
*/
function getUsername()
{
if (isLoggedIn()) {
return $_SESSION["username"];
}
return null;
}
开发者ID:chiiiro,项目名称:SSP-TwitterApp,代码行数:10,代码来源:functions.php
示例9: index
function index($info = "")
{
$menuList[] = array('id' => 1, 'name' => $this->spTextPanel['Website Manager'], 'url_section' => 'websites');
if (isAdmin()) {
$menuList[] = array('id' => 2, 'name' => $this->spTextPanel['User Manager'], 'url_section' => 'users');
}
if (isLoggedIn()) {
$menuList[] = array('id' => 3, 'name' => $this->spTextPanel['Reports Manager'], 'url_section' => 'report-manager');
}
if (isAdmin()) {
$menuList[] = array('id' => 4, 'name' => $this->spTextPanel['Seo Tools Manager'], 'url_section' => 'seo-tools-manager');
$menuList[] = array('id' => 5, 'name' => $this->spTextPanel['Seo Plugins Manager'], 'url_section' => 'seo-plugin-manager');
$menuList[] = array('id' => 6, 'name' => $this->spTextPanel['Directory Manager'], 'url_section' => 'directory-manager');
$menuList[] = array('id' => 11, 'name' => $this->spTextPanel['Search Engine Manager'], 'url_section' => 'se-manager');
$menuList[] = array('id' => 9, 'name' => $this->spTextPanel['Proxy Manager'], 'url_section' => 'proxy-manager');
$menuList[] = array('id' => 7, 'name' => $this->spTextPanel['System Settings'], 'url_section' => 'settings');
}
$menuList[] = array('id' => 8, 'name' => $this->spTextPanel['My Profile'], 'url_section' => 'my-profile');
$menuList[] = array('id' => 10, 'name' => $this->spTextPanel['About Us'], 'url_section' => 'about-us');
$menuSelected = empty($info['menu_selected']) ? 'websites' : urldecode($info['menu_selected']);
$this->set('menuList', $menuList);
$this->set('menuSelected', $menuSelected);
$startScript = empty($info['start_script']) ? "websites.php" : urldecode($info['start_script']);
if (!stristr($startScript, '.php')) {
$startScript .= ".php";
}
$arguments = "";
foreach ($info as $key => $value) {
if (!in_array($key, array('menu_selected', 'start_script'))) {
$arguments .= "&{$key}=" . urldecode($value);
}
}
$this->set('startFunction', "scriptDoLoad('{$startScript}', 'content', '{$arguments}')");
$this->render('adminpanel/adminpanel');
}
开发者ID:codegooglecom,项目名称:seopanel,代码行数:35,代码来源:adminpanel.ctrl.php
示例10: listSeoTools
function listSeoTools()
{
$userId = isLoggedIn();
$seoToolList = $this->__getAllSeoTools();
$this->set('list', $seoToolList);
$this->render('seotools/listseotools');
}
开发者ID:codegooglecom,项目名称:seopanel,代码行数:7,代码来源:seotools.ctrl.php
示例11: addVideo
?>
<?php
function addVideo()
{
if (isLoggedIn()) {
if (hasCurrentUserRight("video")) {
开发者ID:tgassner,项目名称:Blechophon,代码行数:7,代码来源:videos.php
示例12: isAdmin
/**
* Determinate if user is admin
*
* @return boolean
*/
public function isAdmin()
{
if (!isLoggedIn()) {
return false;
}
return (bool) $this->user()->site_access;
}
开发者ID:Codex-NG,项目名称:cornexaac,代码行数:12,代码来源:ForumPost.php
示例13: Factory
public static function Factory($default_page = null, $requireLogin = true)
{
$prefs = UserPreferences::Instance(EGS_USERNAME);
$default_page = $prefs->getPreferenceValue('default_page', 'shared');
if ($default_page == null) {
$ao = AccessObject::Instance();
$default_page = 'module,' . $ao->getDefaultModule();
}
if (get_config('SETUP')) {
if (defined('MODULE')) {
$default_page = MODULE;
}
}
$router = RouteParser::Instance();
$modules = array();
if (!$requireLogin || isLoggedIn()) {
foreach ($router->getDispatch() as $key => $dispatch) {
if (($key == 'group' || $key == 'module' || strstr($key, 'submodule')) && !empty($dispatch)) {
$modules[$key] = $dispatch;
}
}
if (empty($modules)) {
// Default page contains permission type and permission name
// i.e. type is group or module
$array = explode(',', $default_page);
$modules[$array[0]] = $array[1];
}
} else {
$modules['module'] = 'login';
}
$al =& AutoLoader::Instance();
return $modules;
}
开发者ID:uzerpllp,项目名称:uzerp,代码行数:33,代码来源:ModuleFactory.php
示例14: __construct
public function __construct()
{
parent::__construct();
ini_set('memory_limit', '-1');
$this->domain = 'http://localhost/cookindo';
$this->webroot = $_SERVER['DOCUMENT_ROOT'] . '/cookindo/';
// $this->domain = 'http://'.$_SERVER['SERVER_NAME'];
// $this->webroot = $_SERVER['DOCUMENT_ROOT'];
if (isLoggedIn()) {
if ($this->session->userdata('userpassword') == 'def' && strtolower($this->router->method) != 'completion' && strtolower($this->router->method) != 'logout') {
$this->load->helper('url');
redirect($this->domain . '/users/completion');
}
$resNotification = $this->db->query('CALL GetNotifications(?)', array($this->session->userdata('userid')));
$notifications = $resNotification->result_array();
$resNotification->next_result();
$this->load->vars(array('notifications' => $notifications));
}
if ($this->session->userdata('redirect_now') == true) {
$this->session->set_userdata('redirect_now', false);
if (!empty($this->session->userdata('redirect_after'))) {
$redirect_after = $this->session->userdata('redirect_after');
$this->session->set_userdata('redirect_after', false);
$this->load->helper('url');
redirect($this->domain . '/' . $redirect_after);
}
}
$this->site_lang = get_cookie('site_lang') ? get_cookie('site_lang') : 'indonesian';
$this->lang->load($this->site_lang, $this->site_lang);
$this->load->vars(array('domain' => $this->domain, 'webroot' => $this->webroot, 'site_lang' => $this->site_lang));
}
开发者ID:angelamuliawan,项目名称:rd,代码行数:31,代码来源:AB_Controller.php
示例15: requireUser
function requireUser($b = true)
{
if ($b && !isLoggedIn()) {
warning('You need to login to view this page.');
redirect($GLOBALS['sLoginPage'] . '?ref=' . str_replace('?logout=true', '', $_SERVER['REQUEST_URI']));
}
}
开发者ID:prymribb,项目名称:starter,代码行数:7,代码来源:user.php
示例16: downloadBook
/**
* Logs in and downloads the book
*
* @param $book
*/
function downloadBook($book)
{
$params = array("email" => ACCOUNT_EMAIL, "password" => ACCOUNT_PASSWORD, "op" => "Login", "form_build_id" => $book['form_build_id'], "form_id" => "packt_user_login_form");
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www.packtpub.com/packt/offers/free-learning');
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/32.0.1700.107 Chrome/32.0.1700.107 Safari/537.36');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_COOKIESESSION, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie-name');
//could be empty, but cause problems on some hosts
curl_setopt($ch, CURLOPT_COOKIEFILE, '/tmp');
//could be empty, but cause problems on some hosts
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$response = curl_exec($ch);
if (curl_error($ch)) {
echo curl_error($ch);
}
$loggedIn = isLoggedIn($response);
$response = false;
if ($loggedIn) {
curl_setopt($ch, CURLOPT_URL, 'https://www.packtpub.com' . $book['book_claim_url']);
curl_setopt($ch, CURLOPT_POST, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, "");
$response = curl_exec($ch);
}
curl_close($ch);
if ($response === false) {
die(1);
}
}
开发者ID:forfolias,项目名称:packtpub-downloader,代码行数:37,代码来源:packtpub-downloader.php
示例17: isValidAdmin
function isValidAdmin()
{
if (isset($_SESSION['valid_admin']) && isLoggedIn()) {
return true;
} else {
return false;
}
}
开发者ID:arewold,项目名称:calcuttagutta,代码行数:8,代码来源:validation.php
示例18: me
function me()
{
if (isLoggedIn()) {
return new User(intval($_SESSION['UID']));
} else {
return false;
}
}
开发者ID:Wayfur,项目名称:OpenSMO,代码行数:8,代码来源:functions.php
示例19: validateSession
public static function validateSession()
{
$status = array("session" => "invalid");
if (isLoggedIn()) {
$status["session"] = "valid";
}
return $status;
}
开发者ID:rquiring,项目名称:klipsmobile,代码行数:8,代码来源:user.model.php
示例20: checkAuthz
function checkAuthz($action)
{
$noAuth = array('login', 'login.do', 'logout', 'main', '', 'register', 'register.do');
if (in_array($action, $noAuth)) {
return true;
}
return isLoggedIn();
}
开发者ID:Raconeisteron,项目名称:posit-mobile,代码行数:8,代码来源:auth.php
注:本文中的isLoggedIn函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论