-
Notifications
You must be signed in to change notification settings - Fork 0
/
ConsultaConvenio.php
71 lines (66 loc) · 2.19 KB
/
ConsultaConvenio.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
<?php
$host = "localhost";
$user = "root";
$pass = "";
$banco = "user";
$conexao = mysql_connect($host, $user, $pass);
mysql_select_db($banco) or die (mysql_error());
?>
<?php
session_start();
if(!isset($_SESSION["user"]) || !isset($_SESSION["password"])){
header("Location: Login.php");
exit;
} else {
if ($_SESSION["tuser"]==1) {
header("Location: Painel.php");
}
$NomeUser=$_SESSION["user"];
}
?>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
<title>Consulta Convenio</title>
<link rel="shortcut icon" href="css/imagens/parae.ico" type="image/x-icon" />
<center><img src="css/imagens/paraefinal.png" class="img-rounded" width="200" height="205" onclick="location.href='paginicial.php'"></center>
<div align="right"> Olá, <?php echo $NomeUser ?> | <a href="paginicial.php"><i class="icon-home"></i></a> | <a href="logout.php">Sair</a></div>
<center><h3>Convênios Cadastrados</h3></center>
</head>
<body>
<?php
$BD = "SELECT * FROM convenio";
$sql = mysql_query($BD) or die(mysql_error());
$row = mysql_num_rows($sql);
if ($row > 0){
echo '<center><table class="table table-striped"></center>';
echo '<thead><tr>';
echo '<th><center>Convênio</center></th>';
echo '<th><center>Validade</center></th>';
echo '<th><center>Desconto</center></th>';
echo '<th></th>';
echo '<th></th>';
echo '</tr></thead>';
while ($linha = mysql_fetch_array($sql)) {
$status = $linha['status'];
if($status){
$id = $linha['id'];
$nome = $linha['nome'];
$porc = $linha['porc'];
$validade = $linha['validade'];
echo '<tr>';
echo '<td>' .'<center>'. $nome. '</center>'.'</td>';
echo '<td>' .'<center>'. $validade. '</center>'.'</td>';
echo '<td>' .'<center>'. $porc.'%'. '</center>'.'</td>';
echo '<td>' .'<center>'. "<a href='AlteraConvenio.php?id=$id&alt=0&fun=1'>Editar</a>" .'</center>'. '</td>';
echo '<td>' .'<center>'. "<a href='ConfirmaExclusao.php?id=$id&alt=0&fun=2&t=2&nome=$nome'>Remover</a>".'</center>' . '</td>';
echo '</tr>';
}
}
echo "</table>";
}
?>
<center> <p><button class="btn btn-default" type="button" onclick="location.href='paginicial.php'">Voltar</button> </center>
</body>
</html>