-
Notifications
You must be signed in to change notification settings - Fork 0
/
mural_de_recados.php
96 lines (90 loc) · 2.97 KB
/
mural_de_recados.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
<?php
session_start();
include_once('crud/conexao.php');
?>
<?php include_once "header.php"?>
<?php include_once "menuresp.php"?>
<style>
body{
background-color: #EAD7FE;
background-size: cover;
max-width: 100%;
height:auto;
margin-top: -1%;
}
form{
margin-left: 23%;
}
@media (max-width: 768px){
form{
margin-left: 1%;
}
}
</style>
<body>
<?php
if($_SERVER['REQUEST_METHOD']=='POST'){
$request = (implode($_POST));
if(isset($_SESSION['ultima_request']) && $_SESSION['ultima_request'] == $request){
echo "";
}else{
$_SESSION['ultima_request'] = $request;
if(isset($_POST['usuario'])){
$usuario = $_POST['usuario'];
$recado = $_POST['recado'];
$result_recado = "INSERT INTO recados (nome, recado, created) VALUES ('$usuario', '$recado', NOW())";
$resultado_recados= mysqli_query($conn, $result_recado);
//Enviar e-mail
}
}
}
?>
<div class="container theme-showcase" role="main">
<div class="page-header">
<!--<h2 style="text-align: center; margin-top:3%;">Descreva seu Relato aqui</h2>-->
<form action="" method="POST">
<div class="form-group">
<label for="exampleInputEmail1" style="margin-top: 5%;"><strong>Nome:</strong></label>
<input type="text" name="usuario" class="form-control" placeholder="Nome Completo" required>
</div>
<!--<div class="form-group">
<label for="exampleInputEmail1">Email:</label>
<input type="email" name="email" class="form-control" placeholder="Email" required>
</div> -->
<div class="form-group">
<label for="exampleInputEmail1"><strong>Relato:</strong></label>
<textarea name="recado" class="form-control" placeholder="Descreva seu Relato aqui..." rows="3"></textarea>
</div>
<input type="submit" class="btn btn-dark" value="Enviar">
<br>
</form>
<hr>
<h2 style="text-align: center;">Relatos feitos</h2>
<?php
$result_recado_bd = "SELECT * FROM recados ORDER BY id DESC";
$resultado_recado_bd = mysqli_query($conn, $result_recado_bd);
if(mysqli_num_rows($resultado_recado_bd) <= 0 ){
echo "Nenhum recado...";
}else{
while($rows = mysqli_fetch_assoc($resultado_recado_bd)){
?>
<div class="media">
<div class="media-body">
<div style="color: #777; background-color:#d8d8d8; text-align:center; padding:50px 80px; text-align: justify;
margin-top: 1%;">
<h6 class="media-heading" style="color:black;"><?php echo $rows['nome']; ?></h6>
<?php echo $rows['recado']; ?>
</div>
</div>
</div>
<?php
}
}
?>
</div>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
</body>