-
Notifications
You must be signed in to change notification settings - Fork 0
/
processCad.php
43 lines (34 loc) · 952 Bytes
/
processCad.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
<?php
if (session_status() !== PHP_SESSION_ACTIVE) {
session_start();
}
include('db_infos.php');
//form
$name=$_POST["name"];
$cellphone=$_POST["cellphone"];
$user=$_POST["user"];
$cpf=$_POST["cpf"];
$email=$_POST["email"];
$password=$_POST["password"];
$validpassword=$_POST["validpassword"];
$date=$_POST["date"];
$insertQuery= "INSERT INTO usuario (cpf, nome, username, dtnasc, telefone, email, senha)
VALUES ('".$cpf."', '".$name."', '".$user."', '".$date."', '".$cellphone."', '".$email."', '".$password."')";
//validação form
if($password==$validpassword){
try{
if($conn->exec($insertQuery)){
$_SESSION['logged']=1;
header("location: index.php");
}
}
catch(PDOException $e){
$_SESSION['formFailed']=$e->getMessage();
header("location: cadastro.php");
}
}
else{
$_SESSION['formFailed']="Senhas não coincidem";
header("location: cadastro.php");
}
?>