-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate.php
executable file
·71 lines (54 loc) · 1.55 KB
/
update.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
<?php
//if (session_status() !== PHP_SESSION_ACTIVE) {session_start();}
if(session_id() == '' || !isset($_SESSION)){session_start();}
include 'config.php';
$fname = $_POST["fname"];
$lname = $_POST["lname"];
$address = $_POST["address"];
$city = $_POST["city"];
$pin = $_POST["pin"];
$email = $_POST["email"];
$opwd = $_POST["opwd"];
$pwd = $_POST["pwd"];
if($fname!=""){
$result = $mysqli->query('UPDATE users SET fname ="'. $fname .'" WHERE id ='.$_SESSION['id']);
if($result){
}
}
if($lname!=""){
$result = $mysqli->query('UPDATE users SET lname ="'. $lname .'" WHERE id ='.$_SESSION['id']);
if($result){
}
}
if($address!=""){
$result = $mysqli->query('UPDATE users SET address ="'. $address .'" WHERE id ='.$_SESSION['id']);
if($result){
}
}
if($city!=""){
$result = $mysqli->query('UPDATE users SET city ="'. $city .'" WHERE id ='.$_SESSION['id']);
if($result){
}
}
if($pin!=""){
$result = $mysqli->query('UPDATE users SET pin ='. $pin .' WHERE id ='.$_SESSION['id']);
if($result){
}
}
if($email!=""){
$result = $mysqli->query('UPDATE users SET email ="'. $email .'" WHERE id ='.$_SESSION['id']);
if($result) {
}
}
//$result = $mysqli->query('Select password from users WHERE id ='.$_SESSION['id']);
//$obj = $result->fetch_object();
if(/*$opwd === $obj->password &&*/ $pwd!=""){
$query = $mysqli->query('UPDATE users SET password ="'. $pwd .'" WHERE id ='.$_SESSION['id']);
if($query){
}
}
//else {
// echo 'Wrong Password. Please try again. <a href="account.php">Go Back</a>';
//}
header("location:success.php");
?>