Created
May 22, 2012 21:41
-
-
Save legierski/2771803 to your computer and use it in GitHub Desktop.
php for am-i-logged-in
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
public function am_i_logged_in() { | |
if(!IS_AJAX) { | |
echo 'Hi there!<br><br>In case you were wondering - the address that you\'ve just visited is used by us to check if you\'re still logged into GatherContent, and if, by any chance, your browser logs you out - we will display information within the app to prevent data loss!'; | |
exit; | |
} | |
$json = array(); | |
if(!$u = Current_User::user()) { | |
$json['success'] = false; | |
} | |
else { | |
if(isset($u->id) && $u->id != 0) { | |
$json['success'] = true; | |
} | |
else { | |
$json['success'] = false; | |
} | |
} | |
echo json_encode($json); | |
exit; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment