Difference between revisions of "Functions:authorizeIsLoggedIn"

From Whirlwind eCommerce Wiki
Jump to: navigation, search
(New page: == Description == eV::authorizeIsLoggedIn($redirectOnFalse) checks if a user in currently logged in to the session. == Syntax == $bool = authorizeIsLoggedIn([$redirectOnFalse]); == Param...)
 
 
Line 1: Line 1:
 
== Description ==
 
== Description ==
eV::authorizeIsLoggedIn($redirectOnFalse) checks if a user in currently logged in to the session.
+
eV::authorizeIsLoggedIn($redirectOnFalse) checks if a user is currently logged in to the session.
  
 
== Syntax ==
 
== Syntax ==
Line 10: Line 10:
  
 
== Return Values ==
 
== Return Values ==
Returns boolean TRUE/FALSE IF $redirectOnFalse is empty or not passed.
+
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 ==
 
== Examples ==

Latest revision as of 12:50, 25 February 2009

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";
};