-
Notifications
You must be signed in to change notification settings - Fork 0
/
name.php
88 lines (82 loc) · 2.15 KB
/
name.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
<?php
include("connection.php");
session_start();
error_reporting(0);
?>
<html>
<head>
<title></title>
<style>
h1{
text-align: center;
color: white;
}
.container{
margin-left: 15%;
padding:30px;
}
body{
background:black;
}
p{
color: white;
}
.box{
border-radius: 50px;
height: 30px;
width: 45%;
outline-color: black;
margin: 10px;
padding: 20px;
background:black;
color:white;
}
#upd{
margin:50px;
}
</style>
</head>
<body>
<div class="container">
<h1>Change Account details:</h1>
<form action="" method="GET">
<p>Change the details you want to change</p>
<p>First Name:</p>
<input type="text" class="box" placeholder=" Enter new first name" name="firstname" >
<p>Last Name:</p>
<input type="text" class="box" placeholder=" Enter new last name" name="lastname">
<p>Enter your password to confirm your identity:</p>
<input type="password" class="box" placeholder=" Enter password" name="password" required><br>
<input type="submit" value="UPDATE" id="upd" name="submit">
</form>
</div>
<?php
session_start();
$fname= $_GET['firstname'];
$lname= $_GET['lastname'];
$pwd= $_GET['password'];
if($_GET['submit'])
{
$email=$_SESSION['email'];
$query="SELECT * FROM users where email like '$email'";
$data= mysqli_query($conn,$query);
$result=mysqli_fetch_assoc($data);
if($pwd==$result['pwd'])
{
$query="UPDATE users SET fname='$fname',lname='$lname' where email like '$email'";
$data= mysqli_query($conn,$query);
if($data)
{
echo "updated";
header('location:insert.php');
}
else{
echo "error";
}
}
else
echo "Please enter valid password";
}
?>
</body>
</html>