Example #1
0
 /**
  * Logout processor for admin panel
  */
 function logout()
 {
     initiateSession();
     $this->set("title", "Admin Logout");
     if (!isset($_SESSION['admin_hash'])) {
         header("LOCATION: /admins/index");
     }
     closeSession();
     header("LOCATION: /admins/index");
 }
Example #2
0
<?php

session_start();
function closeSession()
{
    session_destroy();
}
closeSession();
header("Location:../admin");
Example #3
0
 /**
  * Logs the user out
  */
 function logout()
 {
     initiateSession();
     $this->set("title", "IEEE NIEC");
     if (isset($_SESSION['user_id'])) {
         foreach ($_SESSION as $vals) {
             $vals = null;
         }
         closeSession();
         $this->set("message", "You have been logged out");
     } else {
         $this->set("message", "User not logged in");
     }
 }
function catchGoogleExceptions($e)
{
    global $credentialsPath, $client;
    logError("An error occurred " . $e->getCode() . ": " . $e->getMessage());
//    var_dump($e);
    switch ($e->getCode()) {
        case '401':
            refreshToken($client);
            logError("Token refreshed. Please restart app");
            break;
    }
    closeSession();
}
function refreshToken($client)
{
    global $credentialsPath;
    $client->refreshToken($client->getRefreshToken());
    if (file_put_contents($credentialsPath, $client->getAccessToken())) {
//        chown($credentialsPath, 'www-dataa');
        logStatusSuccess("Refreshing Token");
    } else {
        logStatusFailure("Refreshing Token");
        closeSession(false);
    }
    return $client;
}