-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocessAltCad.php
More file actions
41 lines (29 loc) · 869 Bytes
/
processAltCad.php
File metadata and controls
41 lines (29 loc) · 869 Bytes
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
<?php
if (session_status() !== PHP_SESSION_ACTIVE) {
session_start();
}
include('db_infos.php');
$name=$_POST["name"];
$cellphone=$_POST["cellphone"];
$email=$_POST["email"];
$password=$_POST["password"];
$validpassword=$_POST["validpassword"];
$updateQuery = "UPDATE usuario SET nome = '" . $name . "', telefone = '" . $cellphone . "', email = '" . $email . "', senha = '" . $password ."'
WHERE username = '". $_SESSION['user'] ."'";
if($password==$validpassword){
try{
if($conn->exec($updateQuery)){
$_SESSION['logged']=1;
header("location: index.php");
}
}
catch(PDOException $e){
$_SESSION['altFormFailed']=$e->getMessage();
header("location: alterarDados.php");
}
}
else{
$_SESSION['altFormFailed']="Senhas não coincidem";
header("location: alterarDados.php");
}
?>