コード例 #1
0
 public function liquidar($id)
 {
     $cheque = Cheque::find($id);
     // Se o cheque já estiver pago
     // exibe msg e retorna para index
     if ($cheque->lancamento->status == '2' || $cheque->lancamento->status == '3') {
         flash('Cheque já está pago');
         return redirect('/cheques');
     }
     $value['status'] = '2';
     $value['data_pagamento'] = Carbon::now()->format('d/m/Y');
     // Altera o valor para ser formatado pelo model de lancamentos
     $value['valor_pago'] = getMoney($cheque->lancamento->valor);
     // Atualiza o cheque e o lancamento
     $cheque->lancamento->update($value);
     flash()->success('Cheque liquidado com sucesso');
     return redirect('/cheques');
 }
コード例 #2
0
    echo 'Error establishing Connection';
    exit;
}
if (isset($_POST['submit'])) {
    $user = $_POST['user'];
    $pass = $_POST['pass'];
    $_SESSION['user'] = $user;
}
if (verify($user, $pass)) {
    echo 'success';
    $_SESSION['user'] = $user;
    $_SESSION['lines'] = (int) getLines($user);
    $_SESSION['hands'] = (int) getHands($user);
    $_SESSION['cups'] = (int) getCoffee($user);
    $_SESSION['seconds'] = (int) getSeconds($user);
    $_SESSION['money'] = (int) getMoney($user);
    header('Location: menu.php');
} else {
    echo 'incorrect username or password';
}
function verify($username, $password)
{
    global $db;
    $stmt = $db->prepare("SELECT password FROM users WHERE username='******';");
    $stmt->execute();
    $hash = $stmt->fetchColumn();
    return password_verify($password, $hash);
}
function getLines($user)
{
    global $db;