Skip to content

Instantly share code, notes, and snippets.

@legierski
Created May 22, 2012 21:41
Show Gist options
  • Save legierski/2771803 to your computer and use it in GitHub Desktop.
Save legierski/2771803 to your computer and use it in GitHub Desktop.
php for am-i-logged-in
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