Example #1
0
 public function cookies()
 {
     $cookies_eu = Session::getCookie("cookies_eu");
     if (empty($cookies_eu)) {
         $cookies_eu = Session::setCookie("cookies_eu", "visible", 31556926);
     }
 }
Example #2
0
 /**
  * Send storage key in the form of a cookie to the client.
  */
 public static function sendStorageKeyCookie()
 {
     Session::setCookie(self::STORAGE_KEY, Session_StorageKey::generate());
 }
Example #3
0
$pb->assign('blank', $kfc->blank);
$pb->assign('kf', $kf);
$pb->assign('isLogged', $kfc->isLogged());
$pb->assign('pagetitle', strip_tags($kfc->title));
if (isset($_GET['login'])) {
    // Login
    if (!empty($_POST['login']) && !empty($_POST['password'])) {
        if (Session::login($kfc->login, $kfc->hash, $_POST['login'], sha1($_POST['password'] . $_POST['login'] . $kfc->salt))) {
            if (!empty($_POST['longlastingsession'])) {
                // (31536000 seconds = 1 year)
                $_SESSION['longlastingsession'] = 31536000;
                $_SESSION['expires_on'] = time() + $_SESSION['longlastingsession'];
                Session::setCookie($_SESSION['longlastingsession']);
            } else {
                // when browser closes
                Session::setCookie(0);
            }
            session_regenerate_id(true);
            MyTool::redirect();
        }
        if (Session::banCanLogin()) {
            $pb->assign('message', Intl::msg('Login failed!'));
        } else {
            $pb->assign('message', Intl::msg('I said: NO. You are banned for the moment. Go away.'));
        }
        $pb->renderPage('message');
    } else {
        $pb->assign('pagetitle', Intl::msg('Sign in') . ' - ' . strip_tags($kfc->title));
        $pb->assign('token', Session::getToken());
        $pb->renderPage('login');
    }
Example #4
0
    /**
     * Unsets a given key from this plugin's cookie namespace
     *
     * @param string  $key  Key to unset
     * @return void
     */
    public function delete($key)
    {
        $this->load();
        Session::setCookie($this->context->getAddonName() . "__" . $key, "", "-1 day");

        if ($this->exists($key)) {
            unset(self::$cookies[$key]);
        }
    }
Example #5
0
<?php

ob_start();
session_start();
switch ($_GET['root']) {
    case 'cookie':
        include_once '../include/lib/Session.class.php';
        $session = new Session();
        $tmp = explode('\\', $_GET['store']);
        $store = '';
        foreach ($tmp as $char) {
            if (trim($char) != '') {
                $store .= $char . '/';
            }
        }
        $session->setCookie('DIR_STORE', $store, 0);
        break;
    case 'scripts':
        include_once '../include/lib/DriveReader.class.php';
        $tmp = explode('\\', $_GET['store']);
        $store = '';
        foreach ($tmp as $char) {
            if (trim($char) != '') {
                $store .= $char . '/';
            }
        }
        if (is_dir($store)) {
            $pspStore = new DriveReader($store);
            foreach ($pspStore->ListsFile() as $new) {
                echo $new . '<br>';
            }
$session = new Session();
$database = new SyncDatabase();
if ($_REQUEST['user'] == 'login') {
    if (trim($_REQUEST['username']) != '' && trim($_REQUEST['password']) != '') {
        if ($database->Query("SELECT COUNT(*) FROM user WHERE username='******'username']}';")) {
            if ($database->Query("SELECT COUNT(*) FROM user WHERE username='******'username']}' AND password='******'password']}';")) {
                $error = NULL;
                $user = $database->Query("SELECT * FROM user WHERE username='******'username']}' AND password='******'password']}' LIMIT 1;");
                $level = $database->Query("SELECT * FROM user_level WHERE level_id='{$user['level_id']}' LIMIT 1;");
                $text = _LOGIN_TITLE . '<strong>' . $user['fullname'] . '</strong> | ' . _LOGIN_LEVEL . $level['level'];
                $timeCookie = 0;
                if ($user['level_id'] == 4) {
                    $timeCookie = 0;
                }
                $session->setCookie('USER', $user['user_id'], $timeCookie);
                $session->setCookie('LEVEL', $user['level_id'], $timeCookie);
            } else {
                $error .= _LOGIN_ERROR_PASSWORD;
            }
        } else {
            $error .= _LOGIN_ERROR_USERNAME;
        }
    } else {
        $error .= _LOGIN_ERROR_NULL;
    }
    echo json_encode(array('error' => $error, 'text' => $text));
} elseif ($_REQUEST['user'] == 'logout') {
    $session->Delete('USER');
    $session->Delete('LEVEL');
    echo json_encode(array(''));
Example #7
0
            </tr>
          </table>        
        </td>
      </tr>
      <tr><td id="module_below"></td></tr></table></div>
      <br /><p><hr width="80%" /><center><?php 
    echo _SITE_FOOTER;
    ?>
</center></p><br />
    </td>
  </tr>
</table></center>
<?php 
    // Auto Login
    if (isset($_GET['admin'])) {
        $control->setCookie('USER_RENTAL', 'admin', $GLOBALS['TIME_COOKIE']);
    }
    ?>
<script>
$(document).ready(function() {
	$('#username, #password').focus(function() {
		if($(this).val()=='<?php 
    echo _INPUT_LOGIN;
    ?>
') 
		{ 
			$(this).val(''); 
			$(this).css({'color': '#333333'});
		}
	});
	/*
Example #8
0
<?php

ob_start();
session_start();
$obj = array('onError' => false, 'exMessage' => NULL);
if (isset($_POST['ACCESS'])) {
    include "../../libs/SyncDatabase.php";
    include "../../libs/Session.php";
    if ($_POST['username'] == 'admin' && $_POST['password'] == 'admin') {
        $cookie = new Session();
        $cookie->setCookie('ACCESS', 'Admin', 1440);
    } else {
        $obj['onError'] = true;
        if ($_POST['username'] != 'admin') {
            $obj['exMessage'] = "Username wong.";
        }
        if ($_POST['password'] != 'admin') {
            $obj['exMessage'] = "Password wong";
        }
    }
}
echo json_encode($obj);