Example #1
0
<?php

// =====================
// = standard includes =
// =====================
require '../includes/basics.php';
// =========================
// = authentication method =
// =========================
require WEBROOT . 'auth/kimai.php';
$authPlugin = new KimaiAuth();
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
$banned = false;
switch ($action) {
    case 'login':
        $name = htmlspecialchars(trim($_REQUEST['name']));
        $password = $_REQUEST['password'];
        // perform login of user
        if ($authPlugin->authenticate($name, $password, $userId)) {
            if ($userId === false) {
                $userId = usr_create(array('usr_name' => $name, 'usr_grp' => $authPlugin->getDefaultGroupId(), 'usr_sts' => 2, 'usr_active' => 1));
            }
            $userData = usr_get_data($userId);
            if ($userData['ban'] < $kga['conf']['loginTries'] || time() - $userData['banTime'] > $kga['conf']['loginBanTime']) {
                // logintries not used up OR
                // bantime is over
                // => grant access
                $keymai = random_code(30);
                setcookie("kimai_key", $keymai);
                setcookie("kimai_usr", $userData['usr_name']);
                loginSetKey($userId, $keymai);
Example #2
0
// =============================
// = Smarty (initialize class) =
// =============================
require_once 'libraries/smarty/Smarty.class.php';
$tpl = new Smarty();
$tpl->template_dir = 'templates/';
$tpl->compile_dir = 'compile/';
// =====================
// = standard includes =
// =====================
require 'includes/basics.php';
// =========================
// = authentication method =
// =========================
require WEBROOT . 'auth/kimai.php';
$authPlugin = new KimaiAuth();
// =====================================
// = send kimai-global-array to smarty =
// =====================================
$tpl->assign('kga', $kga);
// ==========================
// = installation required? =
// ==========================
$ready = @mysql_query(sprintf("select count(*) FROM %susr;", $kga['server_prefix']));
if (!$ready) {
    $tpl->assign('devtimespan', '2006-' . date('y'));
    if (isset($_REQUEST['disagreedGPL'])) {
        $tpl->assign('disagreedGPL', 1);
    } else {
        $tpl->assign('disagreedGPL', 0);
    }