-
Notifications
You must be signed in to change notification settings - Fork 2
/
settings.php
213 lines (196 loc) · 7.72 KB
/
settings.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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
<?php include ( "inc/connect.inc.php" ); ?>
<?php
ob_start();
$mysqli=new mysqli($mysql_server,$mysql_username,$mysql_password,$mysql_db);
session_start();
if (!isset($_SESSION['user_login'])) {
header("location: login.php");
}
else {
$user = $_SESSION['user_login'];
$query="SELECT * FROM user WHERE id='$user'";
$result=$mysqli->query($query);
$get_user_email=$result->fetch_assoc();
$uname_db = $get_user_email['firstName'];
$uemail_db = $get_user_email['email'];
$upass = $get_user_email['password'];
$umob_db = $get_user_email['mobile'];
$uadd_db = $get_user_email['address'];
}
if (isset($_REQUEST['uid'])) {
$user2=$mysqli->real_escape_string($_REQUEST['uid']);
if($user != $user2){
header('location: index.php');
}
}else {
header('location: index.php');
}
if (isset($_POST['changesettings'])) {
//declere veriable
$email = $_POST['email'];
$opass = $_POST['opass'];
$npass = $_POST['npass'];
$npass1 = $_POST['npass1'];
//triming name
try {
if(empty($_POST['email'])) {
throw new Exception('Email can not be empty');
}
if(isset($opass) && isset($npass) && isset($npass1) && ($opass != "" && $npass != "" && $npass1 != "")){
if( md5($opass) == $upass){
if($npass == $npass1){
$npass = md5($npass);
$query="UPDATE user SET password='$npass' WHERE id='$user'";
$result=$mysqli->query($query);
$success_message = '
<div class="signupform_text" style="font-size: 18px; text-align: center;">
<font face="bookman">
Password changed.
</font></div>';
}else {
$success_message = '
<div class="signupform_text" style=" color: red; font-size: 18px; text-align: center;">
<font face="bookman">
New password not matched!
</font></div>';
}
}else {
$success_message = '
<div class="signupform_text" style=" color: red; font-size: 18px; text-align: center;">
<font face="bookman">
Fillup password field exactly.
</font></div>';
}
}else {
$success_message = '
<div class="signupform_text" style=" color: red; font-size: 18px; text-align: center;">
<font face="bookman">
Fillup password field exactly.
</font></div>';
}
if($uemail_db != $email) {
$query="UPDATE user SET password='$npass' WHERE id='$user'";
if($result=$mysqli->query($query)){
//success message
$success_message = '
<div class="signupform_text" style="font-size: 18px; text-align: center;">
<font face="bookman">
Settings change successfull.
</font></div>';
}
}
}
catch(Exception $e) {
$error_message = $e->getMessage();
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>SAREE</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body style="background-image: url(image/homebackgrndimg.png);">
<div class="homepageheader">
<div class="signinButton loginButton">
<div class="uiloginbutton signinButton loginButton" style="margin-right: 40px;">
<?php
if ($user!="") {
echo '<a style="text-decoration: none; color: #fff;" href="logout.php">LOG OUT</a>';
}
else {
echo '<a style="text-decoration: none; color: #fff;" href="signin.php">SIGN IN</a>';
}
?>
</div>
<div class="uiloginbutton signinButton loginButton" style="">
<?php
if ($user!="") {
echo '<a style="text-decoration: none; color: #fff;" href="profile.php?uid='.$user.'">Hi '.$uname_db.'</a>';
}
else {
echo '<a style="text-decoration: none; color: #fff;" href="login.php">LOG IN</a>';
}
?>
</div>
</div>
<div style="float: left; margin: 5px 0px 0px 23px;">
<a href="index.php">
<img style=" height: 75px; width: 130px;" src="image/ebuybdlogo.png">
</a>
</div>
<div class="">
<div id="srcheader">
<form id="newsearch" method="get" action="http:https://www.google.com">
<input type="text" class="srctextinput" name="q" size="21" maxlength="120" placeholder="Search Here..."><input type="submit" value="search" class="srcbutton" >
</form>
<div class="srcclear"></div>
</div>
</div>
</div>
<div class="categolis">
<table>
<tr>
<th>
<a href="women/saree.php" style="text-decoration: none;color: #ddd;padding: 4px 12px;background-color: #c7587e;border-radius: 12px;">Saree</a>
</th>
<th><a href="women/ornament.php" style="text-decoration: none;color: #ddd;padding: 4px 12px;background-color: #c7587e;border-radius: 12px;">Ornament</a></th>
<th><a href="women/watch.php" style="text-decoration: none;color: #ddd;padding: 4px 12px;background-color: #c7587e;border-radius: 12px;">Watch</a></th>
<th><a href="women/perfume.php" style="text-decoration: none;color: #ddd;padding: 4px 12px;background-color: #c7587e;border-radius: 12px;">Perfume</a></th>
<th><a href="women/hijab.php" style="text-decoration: none;color: #ddd;padding: 4px 12px;background-color: #c7587e;border-radius: 12px;">Hijab</a></th>
<th><a href="women/tshirt.php" style="text-decoration: none;color: #ddd;padding: 4px 12px;background-color: #c7587e;border-radius: 12px;">T-Shirt</a></th>
<th><a href="women/footwear.php" style="text-decoration: none;color: #ddd;padding: 4px 12px;background-color: #c7587e;border-radius: 12px;">FootWear</a></th>
<th><a href="women/toilatry.php" style="text-decoration: none;color: #ddd;padding: 4px 12px;background-color: #c7587e;border-radius: 12px;">Toilatry</a></th>
</tr>
</table>
</div>
<div style="margin-top: 20px;">
<div style="width: 901px; margin: 0 auto;">
<ul>
<li style="float: left;">
<div class="settingsleftcontent">
<ul>
<li><?php echo '<a href="profile.php?uid='.$user.'" >My Orders</a>'; ?></li>
<li><?php echo '<a href="settings.php?uid='.$user.'" style=" background-color: #169e8f; border-radius: 4px; color: #fff;">Settings</a>'; ?></li>
</ul>
</div>
</li>
<li style="float: right;">
<div class="holecontainer" style=" padding-top: 20px; padding: 0 20%">
<form action="" method="POST" class="registration">
<div class="container signupform_content ">
<div style="text-align: center;font-size: 20px;color: #fff;margin: 0 0 5px 0;">
<td >Change Password:</td>
</div>
<div>
<td><input class="email signupbox" type="password" name="opass" placeholder="Old Password"></td>
</div>
<div>
<td><input class="email signupbox" type="password" name="npass" placeholder="New Password"></td>
</div>
<div>
<td><input class="email signupbox" type="password" name="npass1" placeholder="Repeat Password"></td>
</div>
<div style="text-align: center;font-size: 20px;color: #fff;margin: 0 0 5px 0;">
<td >Change Email:</td>
</div>
<div>
<td><?php echo '<input class="email signupbox" required type="email" name="email" placeholder="New Email" value="'.$uemail_db.'">'; ?></td>
</div>
<div>
<td><input class="uisignupbutton signupbutton" type="submit" name="changesettings" value="Update Settings"></td>
</div>
<div>
<?php if (isset($success_message)) {echo $success_message;} ?>
</div>
</div>
</form>
</div>
</li>
</ul>
</div>
</div>
</body>
</html>