-
Notifications
You must be signed in to change notification settings - Fork 0
/
consulta.php
123 lines (92 loc) · 2.54 KB
/
consulta.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<!DOCTYPE html>
<html>
<head>
<title> obi </title>
<meta charset = "utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="obi.css">
<!-- <script type="text/javascript" src="obi.js"></script> -->
</head>
<body>
<!-- <img src="logo.jpg" style='position:fixed;opacity: 0.2; top:0px;left:0px;width:100%;height:100%;z-index:-1;'> -->
<img src="trianglify.png" style='position:fixed;top:0px;left:0px;width:100%;height:100%;z-index:-1;'>
<!-- <header>
title
</header> -->
<ul>
<li> <a href="index.php"> Index </a> </li>
<li> <a href="noticias.php">Notícias</a> </li>
<li> <a href="contato.php">Contato</a> </li>
<li> <a href="eventos.php">Eventos</a> </li>
<li> <a class="active" href="repositorio.php">Repositórios de Provas</a> </li>
<li style="float:right"><a href="sobre.php">Sobre</a></li>
</ul>
<br>
<center>
<table>
<tr>
<th>Problema</th>
<th>Nível</th>
<th>Tag</th>
<th>Ano</th>
<th>PDF</th>
</tr>
<?php
$ano = $_POST["ano"];
$tag = $_POST["tag"];
$nome = $_POST["nome"];
$nivel = $_POST["nivel"];
$link = mysqli_connect("localhost", "root", "nath", "obi");
if (!$link )
die('Não foi possível conectar: ' . mysql_error());
// converter charset do mysql pra utf8
mysqli_set_charset($link, "utf8");
// echo $nome;
if($nome != "" || $tag != "" || $nivel != "" || $ano != ""){
$query = "SELECT * FROM questao WHERE ";
if($nome != ""){
$query .= "nome = '$nome' ";
if($tag != "" || $nivel != "" || $ano != "")
$query .= "AND ";
}
if($tag != ""){
$query .= "tag = '$tag' ";
if($nivel != "" || $ano != "")
$query .= "AND ";
}
if($nivel != ""){
$query .= "nivel = '$nivel' ";
if($ano != "")
$query .= "AND ";
}
if($ano != "")
$query .= "ano = '$ano' ";
$query .= "ORDER BY nome;";
}
else{
print("Você precisa inserir pelo menos um termo de busca!");
}
$result = mysqli_query($link, $query);
while ($row = mysqli_fetch_row($result)) {
// $id = $row[0];
$nome = $row[1]; $nome[0] = strtoupper($nome[0]);
$arq = $row[2];
$nivel = $row[3]; $nivel[0] = strtoupper($nivel[0]);
$tag = $row[4]; $tag[0] = strtoupper($tag[0]);
$ano = $row[5];
$pdf = "questao.php?questao=" . $arq;
echo "
<tr>
<td> $nome </td>
<td> $nivel </td>
<td> $tag </td>
<td> $ano </td>
<td> <a href = $pdf><img src = 'pdf.png' width='30' height='30'> </a> </td>
</tr>
";
}
?>
</table>
</center>
</body>
</html>