Beispiel #1
0
/**
 * Logs the user out
 */
function logout($ID, $notime = false)
{
    global $con;
    $active = getActive($ID);
    //boolean - if the user is active
    $name = getName($ID);
    // get the user's name
    if (!$active) {
        $_SESSION['loginerror'] = "alreadysignedout";
        redirect();
    } else {
        $result = mysqli_query($con, "UPDATE students SET ACTIVE = 0 WHERE ID = '{$ID}'");
        if (!$result) {
            fancydie('Could not set active to false, ' . mysqli_error($con));
        }
        $result = mysqli_query($con, "UPDATE logs SET DATEOUT = now() WHERE DATEOUT = '0000-00-00 00:00:00' AND ID = '{$ID}'");
        if (!$result) {
            fancydie('Could not update logs, ' . mysqli_error($con));
        }
        if (!$notime) {
            $result = mysqli_query($con, "SELECT DATEIN,DATEOUT FROM logs WHERE ID = '{$ID}' ORDER BY NUM desc");
            if (!$result) {
                fancydie('Could not fetch log data, ' . mysqli_error($con));
            }
            $row = mysqli_fetch_array($result);
            $datein = $row['DATEIN'];
            $dateout = $row['DATEOUT'];
            $sessiontime = strtotime($dateout) - strtotime($datein);
            //get current time spent on team
            $result = mysqli_query($con, "SELECT TOTALTIME FROM students WHERE ID = '{$ID}'");
            if (!$result) {
                fancydie('Could not get total time, ' . mysqli_error($con));
            }
            $row = mysqli_fetch_array($result);
            $totaltime = $row['TOTALTIME'] + $sessiontime;
            //new total time
            $result = mysqli_query($con, "UPDATE students SET TOTALTIME = '{$totaltime}' WHERE ID = '{$ID}'");
            if (!$result) {
                fancydie('Could not set total time, ' . mysqli_error($con));
            }
        }
    }
}
Beispiel #2
0
#!/usr/bin/env php
<?php 
require_once __DIR__ . '/app/lib.inc';
// Cron this once a minute. It will subtract one minute from whoever is Active on the computer
$active = getActive();
foreach ($active as $username => $sessions) {
    foreach ($sessions as $session) {
        echo "{$session['USER']} {$session['Display']}\n";
    }
}
Beispiel #3
0
    return '';
}
$mensagemUsuario = "";
$usuario = null;
//Obter o cookie
if (isset($_COOKIE['usuario'])) {
    $usuario = json_decode($_COOKIE['usuario']);
    $mensagemUsuario = "Olá {$usuario->nom_usu} [ <a id='linkPerfil' href='index.php?go=perfil' class='navbar-link'>Perfil</a> - <a id='linkSair' href='#' class='navbar-link'>Sair</a> ] ";
    if (!isset($_SESSION["login_id"])) {
        $_SESSION["login_id"] = $usuario->id_usu;
    }
}
if (isset($usuario)) {
    echo "<li " . getActive('bemVindo') . "> <a href='index.php?go=bemVindo'>Home</a></li>";
    echo "<li " . getActive('tarefas') . "> <a href='index.php?go=tarefas'>Tarefas</a></li>";
    echo "<li " . getActive('relatórios') . "> <a href='index.php?go=relatorios'>Relatórios</a></li>";
}
?>
                        </ul>
                        <p class="navbar-text pull-right"><?php 
echo $mensagemUsuario;
?>
</p>
                    </div> <!--/.nav-collapse -->
                </div>
            </div>
        </div>

        <div class="container">
            <?php 
require $_GET["go"] . ".html";
Beispiel #4
0
$project = getProject($ledger);
$main = 'http://gitpay.org/' . $user['login'] . '#this';
$githubaccount = 'http://github.com/' . $user['login'];
if ($webid && $webid['bitcoin']) {
    $bitcoin = $webid['bitcoin'];
}
if ($webid && $webid['preferredURI']) {
    $preferredURI = $webid['preferredURI'];
}
$turtle = getTurtle($user, $webid, $users, $keys);
insertKeys($keys, $nick, $conn);
writeTurtle($turtle);
if (!empty($_SESSION['login'])) {
    activateUser('https://gitpay.org/' . $_SESSION['login'] . '#this', $conn);
}
$active = getActive('https://gitpay.org/' . $nick . '#this', $conn);
?>



<!doctype html>
<!--
Material Design Lite
Copyright 2015 Google Inc. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0
><a href="?p=products"<?php 
getActive('products');
?>
>Products</a></li>
        <li id="btn_4"<?php 
getActive('services');
?>
><a href="?p=services"<?php 
getActive('services');
?>
>Services</a></li>
        <li id="btn_5"<?php 
getActive('contact');
?>
><a href="?p=contact"<?php 
getActive('contact');
?>
>Contact us</a></li>
      </ul>
    </div>
    <div id="hd">by Sebastian Sulinski</div>
    <div id="cnt">
      <p class="pt">3 state CSS tabs navigation</p>
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
    </div>
  </div>
</div>
<div id="ft">
  <div id="fti">
Beispiel #6
0
        $_SESSION["login_tipo"] = $usuario->tipo;
    }
}
if (isset($usuario)) {
    if ($usuario->tipo == "a") {
        echo "<li " . getActive('bemVindo') . "><a href='index.php?go=bemVindo'>Home</a></li>";
        echo "<li " . getActive('vendedores') . "><a href='index.php?go=vendedores'>Vendedores</a></li>";
        echo "<li " . getActive('clientes') . "><a href='index.php?go=clientes'>Clientes</a></li>";
        echo "<li " . getActive('produtos') . "><a href='index.php?go=produtos'>Produtos</a></li>";
        echo "<li " . getActive('vendasAdmin') . "><a href='index.php?go=vendasAdmin'>Vendas</a></li>";
    }
    if ($usuario->tipo == "v") {
        echo "<li " . getActive('bemVindo') . "><a href='index.php?go=bemVindo'>Home</a></li>";
        echo "<li " . getActive('clientes') . "><a href='index.php?go=clientes'>Clientes</a></li>";
        echo "<li " . getActive('produtos') . "><a href='index.php?go=produtos'>Produtos</a></li>";
        echo "<li " . getActive('pdv') . "><a href='index.php?go=pdv'>PDV</a></li>";
    }
}
?>


                        </ul>

                        <p class="navbar-text pull-right"><?php 
echo $mensagemUsuario;
?>
</p>

                    </div><!--/.nav-collapse -->
                </div>
            </div>