-
Notifications
You must be signed in to change notification settings - Fork 0
/
EditProfile.php
133 lines (127 loc) · 4.74 KB
/
EditProfile.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<?php
include 'config.php';
session_start();
if (isset($_SESSION['username'])) {
$login = "<i class=\"fas fa-sign-out-alt\" ></i>";
$loglink = "logout.php";
$signup = "<i class=\"fa fa-user\"></i>";
$siglink = "Profile.php";
}else{
$login = "connexion";
$loglink = "login.php";
$signup = "inscription";
$siglink = "register.php";
}
$user = $_SESSION['username'];
$select = "SELECT * FROM users WHERE username= '$user' ";
$result = mysqli_query($conn, $select);
$row = mysqli_fetch_assoc($result);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="./css/style.css" />
<link rel="stylesheet" href="./css/profile.css" />
<link rel="stylesheet" href="./css/bootstrap.min.css" />
<link rel="stylesheet" href="./css/css2.css" />
<title>store</title>
</head>
<body>
<!--Nav Bar-->
<div class="navbar navbar-expand-md bg-dark navbar-dark sticky-top">
<div class="container">
<a href="index.php" class="logo"
><span style="color: #f7941d">DARIRSETTAF </span>STORE</a
>
<buttond
class="navbar-toggler"
type="button"
data-bs-toggle="collapse"
data-bs-target="#forcola"
>
<span class="navbar-toggler-icon"></span>
</buttond>
<div class="collapse navbar-collapse" id="forcola">
<ul class="navbar-nav ms-auto">
<li class="nav-item">
<a href="index.php" class="nav-link" >Home</a>
</li>
<li class="nav-item">
<a href="store.php" class="nav-link">Store</a>
</li>
<li class="nav-item">
<a href="cart.php" class="nav-link">Cart</a>
</li>
<li class="nav-item">
<a href="checkout.php" class="nav-link">Checkout</a>
</li>
<li class="nav-item">
<a href="FAQ.php" class="nav-link">FAQ</a>
</li>
<li class="nav-item">
<a href="contacter.php" class="nav-link">Contact Us</a>
</li>
<li class="nav-item">
<a href="<?php echo $siglink;?>" class="nav-link" id="active"><?php echo $signup;?></a>
</li>
<li class="nav-item">
<a href="<?php echo $loglink;?>" class="nav-link"><?php echo $login;?></a>
</li>
</ul>
</div>
</div>
</div>
<!--End Nav Bar-->
<div class="container rounded bg-white mt-5 mb-5 ">
<div class="row">
<div class="col-md-3 border-right">
<div class="d-flex flex-column align-items-center text-center p-3 py-5"><img class="rounded-circle mt-5" width="150px" src="./img/profile.jpg"></span></div>
</div>
<div class="col-md-5 border-right">
<div class="p-3 py-5">
<div class="d-flex justify-content-between align-items-center mb-3">
<h4 class="text-right">Profile Settings</h4>
</div>
<div class="row mt-3">
<div class="col-md-12">
<form method="POST">
<label class="labels">Username :</label>
<input class="form-control" type="text" name="username"value="<?php echo $row['username'];?>" required>
<br>
<label class="labels">Email : </label>
<input class="form-control" type="email" name="email" value="<?php echo $row['email'];?>" required>
<br>
<label class="labels">Phone Number : </label>
<input class="form-control" type="text" name="phone" placeholder="Not set" value="" required>
<br>
<label class="labels">Address : </label>
<input class="form-control" type="text" name="address" placeholder="Not set" value="" required>
<div class="mt-5 text-center"><button class="profile-butto" type="button" name="edit"><a href="./profile.php">Save Changes</a></button>
</div>
</form>
</div>
</body>
</html>
<?php
if(isset($_POST['edit'])){
echo"on the rowd";
$username = htmlspecialchars($_POST['username']);
$upemail = htmlspecialchars($_POST['email']);
// $password = md5($_POST['password']);
// $newpassword = md5($_POST['newpassword']);
// $confirmnewpassword = md5($_POST['confirmnewpassword']);
// if($password == $row["password"]) {
// if($newpassword == $confirmnewpassword ){
$update = "UPDATE `users` SET username = '$username' ,email = '$upemail' WHERE username = '$user'";
$res = mysqli_query($conn, $update);
if ($res)
header("location:index.php");
else
echo'Something wrong';
}
// }
// }
?>