-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhome.php
50 lines (36 loc) · 945 Bytes
/
home.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
<?php
session_start();
include "config.php";
include "database.php" ;
include "ajustantes.php" ;
$protocolo = $_SESSION["id_usuario"];
$diretorio = $_COOKIE["login"];
$local = "$diretorio/";
$tem_erros = false;
$erros_validacao = array();
if (tem_post()){
$usuario_id = $_POST['usuario_id'];
if(isset($_FILES['anexo'])){
if (tratar_anexo($_FILES['anexo'], $diretorio)){
$anexo = array();
$anexo['usuario_id'] = $usuario_id;
$anexo['nome'] = $_FILES['anexo']['name'];
$anexo['arquivo'] = $_FILES['anexo']['name'];
}else{
$tem_erros = true;
$erros_validacao['anexo'] = 'Envie apenas anexos nos formatos zip ou pdf';
}
if (!$tem_erros){
gravar_anexo($conexao, $anexo);
header('Location: home');
die();
}
}
}
$anexos = buscar_anexos($conexao, $_SESSION["id_usuario"]);
if (isset($protocolo)){
include ("homework.php");
}else{
header("Location:index.html");
}
?>