-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate.php
36 lines (36 loc) · 1.49 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
<?php
include 'connect.php';
?>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css" integrity="sha512-KfkfwYDsLkIlwQp6LFnl8zNdLGxu9YAA1QvwINks4PhcElQSvqcyVLLD9aMhXd13uQjoXtEKNosOWaZqXgel0g==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<script src="script.js" defer></script>
</head>
<body>
<div class="form-container sign-in-container">
<form action="update.php" method="POST">
<h1>Change Password</h1>
<input type="text" placeholder="Username" name="username" />
<input type="password" placeholder="Password" name="password" />
<input type="password" placeholder="Confirm Password" name="cpassword" />
<input type="submit" name="forget" value="Submit" class="btn btn-primary" style="border-radius: 30px; border: 1px solid #20dbc2; background-color: #20dbc2; color: white; font-size: 12px; font-weight: bold; padding: 14px 20px; letter-spacing: 1px; text-transform: uppercase;transition: transform 80ms ease-in; width: 142px;">
</form>
<?php
if(isset($_POST['username']))
{
$user=$_POST['username'];
$pass=$_POST['password'];
$cpass=$_POST['cpassword'];
if($pass==$cpass)
{
$sql="UPDATE user_details SET password='$pass' WHERE username= '$user'";
$result=mysqli_query($con,$sql);
echo "<script> alert('Password has been Successfully Changed'); </script>";
}
else
{
echo "<script> alert('The Confirm Password and Password should be the Same'); </script>";
}
}
?>
</div>
</body>