Functions:authorizeIsLoggedIn
From Whirlwind eCommerce Wiki
Revision as of 12:50, 25 February 2009 by 71.163.185.8 (Talk)
Description
eV::authorizeIsLoggedIn($redirectOnFalse) checks if a user is currently logged in to the session.
Syntax
$bool = authorizeIsLoggedIn([$redirectOnFalse]);
Paramaters
- $redirectOnFalse STRING OPTIONAL
- URL to forward visitor to, if log in check fails.
Return Values
Returns boolean TRUE/FALSE IF $redirectOnFalse is empty or not passed. Returns TRUE if user is logged in; returns FALSE if user is not logged in.
Examples
- Example using redirect (forwarding)
// typically placed in the pre-process area of the template // forward to home page with a message // if anyone attempts to access a page using this template without being logged in eV::authorizeIsLoggedIn('index.php?message=You must be logged in to view this page');
- Example without using redirect
// just checking log in status in order to show different content $isLoggedIn = eV::authorizeIsLoggedIn(); if($isLoggedIn){ // logged in echo "You are logged in"; } else { // not logged in echo "YOu are not logged in"; };