-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
80 lines (62 loc) · 1.47 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
session_start();
require 'config.php';
if(isset($_SESSION['banco']) && empty($_SESSION['banco']) == false){
$id = $_SESSION['banco'];
$sql = $pdo->prepare("SELECT * FROM contas WHERE id = :id");
$sql->bindValue(":id", $id);
$sql->execute();
if($sql->rowCount() > 0) {
$info = $sql->fetch();
} else {
header("Location: login.php");
exit;
}
}else{
header("Location: login.php");
exit;
}
?>
<html>
<head>
<title>Caixa Eletronico</title>
</head>
<body>
<h1>Banco Izzy</h1>
Titular: <?php echo $info['titular']; ?><br/>
Agência: <?php echo $info['agencia']; ?><br/>
Conta: <?php echo $info['conta']; ?><br/>
Saldo: <?php echo $info['saldo']; ?><br/>
<a href="sair.php">Sair</a>
<hr/>
<h3>Movimentação/Extrato</h3>
<a href="add-transacao.php">Adicionar Transação</a><br/><br/>
<table border="1" width="400">
<tr>
<th>Data</th>
<th>Valor</th>
</tr>
<?php
$sql = $pdo->prepare("SELECT * FROM historico WHERE id_conta = :id_conta");
$sql->bindValue(":id_conta", $id);
$sql->execute();
if($sql->rowCount() > 0){
foreach($sql->fetchAll() as $item){
?>
<tr>
<td><?php echo date('d/m/Y H:i', strtotime($item['data_operacao'])); ?></td>
<td>
<?php if($item['tipo'] == '0'): ?>
<font color="green">R$ <?php echo $item['valor'] ?></font>
<?php else: ?>
<font color="red">-R$ <?php echo $item['valor'] ?></font>
<?php endif; ?>
</td>
</tr>
<?php
}
}
?>
</table>
</body>
</html>