/**
  * Logout current user
  * Since the logout doesn't throw an error, we don't throw one either
  */
 public function logout($message = array())
 {
     if ($member = Member::currentUser()) {
         $security = new Security();
         $security->logout(false);
     }
     return true;
 }
 public function logout($redirect = true)
 {
     if (Session::get('Masquerade.Old.loggedInAs')) {
         $oldSession = Session::get('Masquerade.Old');
         Session::clear_all();
         foreach ($oldSession as $name => $val) {
             Session::set($name, $val);
         }
         if ($redirect && !$this->getResponse()->isFinished()) {
             $this->redirectBack();
         }
     } else {
         parent::logout($redirect);
     }
 }
Esempio n. 3
0
<?php

if (Security::logout()) {
    echo "LOGOUT_SUCCESS";
} else {
    echo "LOGOUT_FAILED";
}
Esempio n. 4
0
 /**
  * Log out form handler method
  *
  * This method is called when the user clicks on "logout" on the form
  * created when the parameter <i>$checkCurrentUser</i> of the
  * {@link __construct constructor} was set to TRUE and the user was
  * currently logged in.
  */
 public function logout()
 {
     $s = new Security();
     $s->logout();
 }
Esempio n. 5
0
<?php

session_start();
require_once "includes/Core.php";
require_once "includes/Database.php";
require_once "includes/Security.php";
$core = new Core();
$db = new Database();
$db->opendb();
$security = new Security($core, $db);
$user = $security->checksession();
if (!$user) {
    $core->loadPage("login.php");
}
if (isset($_GET['logout'])) {
    $security->logout();
}
function menuItems($items)
{
    $menu = ["home" => ["text" => "Tickets", "link" => "?"], "newTicket" => ["text" => "Nieuwe ticket", "link" => "?newTicket"]];
    for ($i = 0; $i < count($items); $i++) {
        echo '<li class=""><md-button class="menu_item" href="' . $menu[$items[$i]]['link'] . '">' . $menu[$items[$i]]['text'] . '</md-button></li>';
    }
}
?>


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
Esempio n. 6
0
 public function logout()
 {
     Security::logout(true);
 }
 protected function LogoutAction()
 {
     Security::logout();
 }
 /**
  * Set VerificationString if not set
  * If not verified log out user and display message.
  */
 function onBeforeWrite()
 {
     parent::onBeforeWrite();
     if (!$this->owner->VerificationString) {
         $this->owner->VerificationString = MD5(rand());
     }
     if (!$this->owner->Verified) {
         if (!$this->owner->VerificationEmailSent) {
             if (!self::$hasOnBeforeWrite) {
                 self::$hasOnBeforeWrite = true;
                 $this->owner->sendemail($this->owner, false);
             }
         }
         if (Member::currentUserID() && $this->owner->Email == Member::currentUser()->Email) {
             Security::logout(false);
             if (!is_null(Controller::redirectedTo())) {
                 $messageSet = array('default' => _t('EmailVerifiedMember.EMAILVERIFY', 'Please verify your email address by clicking on the link in the email before logging in.'));
             }
             Session::set("Security.Message.type", 'bad');
             Security::permissionFailure(Controller::curr(), $messageSet);
         } else {
             return;
         }
     } else {
         return;
     }
 }
Esempio n. 9
0
 function logout()
 {
     Security::logout(false);
     if (Member::currentUser()) {
         $this->redirect("user-dashboard/");
     } else {
         $this->redirect("home/");
     }
 }
Esempio n. 10
0
 public function runCommand($command, $usertype, $username, $directory)
 {
     $command = $this->cleanCommand($command);
     if ($command[0] != '') {
         $filesDirectory = new FilesDirectory();
         $security = new Security();
         switch ($command[0]) {
             case 'authenticate':
                 $security->authenticate($username, $directory);
                 break;
             case 'exit':
                 $security->logout();
                 break;
             case 'ls':
                 $filesDirectory->ls($usertype, $username, str_replace('..', '', $directory));
                 break;
             case 'mkdir':
                 if ($command[1] != '') {
                     $filesDirectory->mkdir($usertype, $username, str_replace('..', '', $directory), $command[1]);
                 } else {
                     echo 'directory empty.';
                 }
                 break;
             case 'chkdir':
                 if ($command[1] != '') {
                     $filesDirectory->chkdir($username, str_replace('..', '', $directory), str_replace('..', '', $command[1]));
                 } else {
                     echo 'directory empty.';
                 }
                 break;
             case 'chkfile':
                 if ($command[1] != '') {
                     $filesDirectory->chkfile($username, str_replace('..', '', $directory), str_replace('..', '', $command[1]));
                 } else {
                     echo 'file not found.';
                 }
                 break;
             case 'rm':
                 if ($command[1] != '') {
                     $filesDirectory->rm($usertype, $username, str_replace('..', '', $directory), str_replace('..', '', $command[1]));
                 } else {
                     echo 'file not found.';
                 }
                 break;
             case 'rmdir':
                 if ($command[1] != '') {
                     if (strtoupper($command[2]) == '-R') {
                         $filesDirectory->rmdir($usertype, $username, str_replace('..', '', $directory), str_replace('..', '', $command[1]), true);
                     } else {
                         $filesDirectory->rmdir($usertype, $username, str_replace('..', '', $directory), str_replace('..', '', $command[1]));
                     }
                 } else {
                     echo 'directory empty.';
                 }
                 break;
             case 'cp':
                 if ($command[1] != '') {
                     $opt = strtoupper($command[3]);
                     if ($opt == '-IR' || $opt == '-RI') {
                         echo $filesDirectory->cp($usertype, $username, $command[1], $command[2], true, true);
                     } else {
                         if ($opt == '-I') {
                             echo $filesDirectory->cp($usertype, $username, $command[1], $command[2], true);
                         } else {
                             if ($opt == '-R') {
                                 echo $filesDirectory->cp($usertype, $username, $command[1], $command[2], false, true);
                             } else {
                                 echo $filesDirectory->cp($usertype, $username, $command[1], $command[2]);
                             }
                         }
                     }
                 } else {
                     echo 'directory empty.';
                 }
                 break;
             case 'mv':
                 if ($command[1] != '') {
                     $opt = strtoupper($command[3]);
                     if ($opt == '-IR' || $opt == '-RI') {
                         echo $filesDirectory->mv($usertype, $username, $command[1], $command[2], true, true);
                     } else {
                         if ($opt == '-I') {
                             echo $filesDirectory->mv($usertype, $username, $command[1], $command[2], true);
                         } else {
                             if ($opt == '-R') {
                                 echo $filesDirectory->mv($usertype, $username, $command[1], $command[2], false, true);
                             } else {
                                 echo $filesDirectory->mv($usertype, $username, $command[1], $command[2]);
                             }
                         }
                     }
                 } else {
                     echo 'directory empty.';
                 }
                 break;
             default:
                 echo 'command not found.';
         }
     }
 }
Esempio n. 11
0
 * Copyright (c) 2005, 2011 Nalaka Jayasena <*****@*****.**>
 *
 * Pusthaka is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Pusthaka is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Pusthaka.  If not, see <http://www.gnu.org/licenses/>.
 */

	$allow = "ALL";
	include('../inc/init.php');

    require('../classes/Security.php');
    $sec = new Security;

	if(isset($_REQUEST['btnLogin'])){
		$sUsername = addslashes($_REQUEST["Username"]);
		$sPassword = $_REQUEST["Password"];

        $sec->login($sUsername, $sPassword);
	} else { // Called directly, so logout!
        $sec->logout();
	}
?>
 /**
  * ACTION /logout
  * Logout the user and redirect to the basket.
  */
 public static function logout()
 {
     $security = new Security();
     $security->logout(false);
     return $this->redirect($this->link());
 }
Esempio n. 13
0
 /**
  * This function is replacing the default SilverStripe Logout Form. This form is used to logout the customer and direct
  * the user to the startpage
  *
  * @return null
  *
  * @author Oliver Scheer <*****@*****.**>
  * @since 11.11.2010
  */
 public function logOut()
 {
     Security::logout(false);
     $frontPage = SilvercartPage_Controller::PageByIdentifierCode();
     $this->redirect($frontPage->RelativeLink());
 }
 /**
  * Log the current member out and redirect to home page.
  */
 public function logout()
 {
     Security::logout(false);
     Director::redirect("home/");
 }