This repository has been archived by the owner. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setting.php
executable file
·43 lines (42 loc) · 1.81 KB
/
setting.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
// TODO solve it
include 'functions.php';
if( ! isset($_SESSION["password"])){
header("location:index.php?er=AccessDenied");
}
if (isset($_POST["submit"]) && ($_SESSION["password"] == md5($_POST["password"]))) {
$id=$_SESSION["id"];
$username=$_POST["username"];
$password=md5($_POST["new-password"]);
$email=$_POST["email"];
$sql="UPDATE `users` SET `username`='$username',`password`='$password',`email`='$email' WHERE id='$id'";
$res=mysqli_query($connect,$sql);
header("location:index.php?er=profileUpdated!");
}
?>
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Setting</title>
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/forms.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<main>
<form class="form" action="setting.php" method="post">
<h1>Edit Profile</h1>
<input class="input" type="text" name="username" value="<?php echo $_SESSION["username"]; ?>" placeholder="username">
<input class="input" type="password" name="password" placeholder="old password">
<input class="input" type="password" name="new-password" placeholder="new password">
<input class="input" type="email" name="email" value="<?php echo $_SESSION["email"]; ?>" placeholder="email">
<input class="submit" type="submit" name="submit" value="Edit">
</form>
<div class="change">
<a href="main.php"><i class="fas fa-home"></i></a>
</div>
</main>
</body>
</html>