Created
February 17, 2013 05:12
-
-
Save AstDerek/4970281 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Example on how to handle JSON responses | |
if ($session->logged_in()) { | |
$json_response = array( | |
'error' => FALSE, | |
'user_id' => $session->user_id() | |
); | |
} | |
else { | |
$json_response = array( | |
'error' => TRUE, | |
'reason' => 'The user is not logged in' | |
); | |
} | |
// Some other usage, redirection | |
if (!$session->logged_in()) { | |
/** | |
* redirect() would include: | |
* header(); | |
* exit; | |
*/ | |
$session->redirect(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment