-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathedit.user.profile.php
More file actions
178 lines (140 loc) · 7.16 KB
/
edit.user.profile.php
File metadata and controls
178 lines (140 loc) · 7.16 KB
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
<?php
session_start();
include_once "includes/dbh.inc.php";
include_once 'includes/functions.inc.php';
?>
<html>
<head>
<!--boostrap-->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN"
crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"
integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL"
crossorigin="anonymous"></script>
<title>edit profile</title>
<style type="text/css">
.form-control {
width:400px;
}
.form1 {
margin:0 540px;
}
label {
color: black;
margin-top: 10px;
}
</style>
</head>
<body>
<?php
include_once "navigation.bar.php";
?>
<h2 style="text-align: center; margin-top: 30px; color: black;">Edit Information</h2>
<div class="profile_info" style="text-align: center;">
<h3 style="color: orange;"><?php echo $_SESSION['username']; ?></h3>
</div>
<?php
echo "<div style='text-align: center'>
<img style='border: 3px solid orange; border-color: orange; border-radius: 50%; overflow: hidden; height: 120; width: 120;' src='Image/users.profile.pic/".get_user_pic($conn, $_SESSION['username'])."'>
</div>";
?>
<div class="form1">
<form action="" method="post" enctype="multipart/form-data" style="margin-bottom: 100px;">
<label><h6><b>Profile Picture</b></h6></label>
<input class="form-control row" type="file" name="file">
<label><h6><b>First Name</b></h6></label>
<input class="form-control" type="text" name="first_name" value="<?php echo get_user_fname($conn, $_SESSION["username"]); ?>">
<label><h6><b>Last Name</b></h6></label>
<input class="form-control" type="text" name="last_name" value="<?php echo get_user_lname($conn, $_SESSION["username"]); ?>">
<label><h6><b>Username</b></h6></label>
<input class="form-control" type="text" name="username" value="<?php echo $_SESSION["username"]; ?>">
<label><h6><b>Member ID</b></h6></label>
<input class="form-control" type="text" name="memberid" value="<?php echo get_user_memberid($conn, $_SESSION["username"]); ?>">
<label><h6><b>NIC Number</b></h6></label>
<input class="form-control" type="text" name="nic" value="<?php echo get_user_nic($conn, $_SESSION["username"]); ?>">
<label><h6><b>Birthday</b></h6></label>
<input class="form-control" type="date" name="birthday" value="<?php echo get_user_bday($conn, $_SESSION["username"]); ?>">
<label><h6><b>Address</b></h6></label>
<input class="form-control" type="text" name="address" value="<?php echo get_user_address($conn, $_SESSION["username"]); ?>">
<label><h6><b>Email</b></h6></label>
<input class="form-control" type="text" name="email" value="<?php echo get_user_email($conn, $_SESSION["username"]); ?>">
<label><h6><b>Mobile</b></h6></label>
<input class="form-control" type="text" name="mobile" value="<?php echo get_user_mobile($conn, $_SESSION["username"]); ?>">
<label><h6><b>City</b></h6></label>
<select class="form-select" name="city">
<option value="<?php echo get_user_city($conn, $_SESSION["username"]); ?>"><?php echo get_user_city($conn, $_SESSION["username"]); ?></option>
<option value="Ampara">Ampara</option>
<option value="Anuradhapura">Anuradhapura</option>
<option value="Badulla">Badulla</option>
<option value="Batticaloa">Batticaloa</option>
<option value="Colombo">Colombo</option>
<option value="Galle">Galle</option>
<option value="Gampaha">Gampaha</option>
<option value="Hambantota">Hambantota</option>
<option value="Jaffna">Jaffna</option>
<option value="Kalutara">Kalutara</option>
<option value="Kandy">Kandy</option>
<option value="Kegalle">Kegalle</option>
<option value="Kilinochchi">Kilinochchi</option>
<option value="Kurunegala">Kurunegala</option>
<option value="Monaragala">Monaragala</option>
<option value="Mannar">Mannar</option>
<option value="Matale">Matale</option>
<option value="Matara">Matara</option>
<option value="Mullaitivu">Mullaitivu</option>
<option value="Nuwara_Eliya">Nuwara Eliya</option>
<option value="Polonnaruwa">Polonnaruwa</option>
<option value="Puttalam">Puttalam</option>
<option value="Ratnapura">Ratnapura</option>
<option value="Trincomalee">Trincomalee</option>
<option value="Vavuniya">Vavuniya</option>
</select>
<label><h6><b>Zip</b></h6></label>
<input class="form-control" type="text" name="zip" value="<?php echo get_user_zip($conn, $_SESSION["username"]); ?>">
<label><h6><b>Gender</b></h6></label>
<select class="form-select" name="gen">
<option value="<?php get_user_gender($conn, $_SESSION["username"]); ?>"><?php echo get_user_gender($conn, $_SESSION["username"]); ?></option>
<option value="Male">Male</option>
<option value="Female">Female</option>
</select>
<button class="btn btn-dark" name="submit" type="submit" style="float: right; width: 170px; margin-top: 20px; margin-bottom: 20px;"><img src = "icons\save.svg"> Save Changes</button>
</form>
</div>
<?php
if(isset($_POST['submit'])) {
move_uploaded_file($_FILES['file']['tmp_name'],"Image/users.profile.pic/".$_FILES['file']['name']);
$firstName = $_POST["first_name"];
$lastName = $_POST["last_name"];
$username = $_POST["username"];
$memberId = $_POST["memberid"];
$nic = $_POST["nic"];
$birthday = $_POST["birthday"];
$address = $_POST["address"];
$email = $_POST["email"];
$mobile = $_POST["mobile"];
$city = $_POST["city"];
$zip = $_POST["zip"];
$gen = isset($_POST["gen"]) ? $_POST["gen"] : null;
$pic=$_FILES['file']['name'];
$sql = "UPDATE users SET usersFirstName='$firstName', usersLastName='$lastName', usersUsername='$username', usersMemberId='$memberId', usersNic='$nic', usersBirthday='$birthday', usersAddress='$address', usersEmail='$email', usersMobile='$mobile', usersCity='$city', usersZip='$zip', usersGender='$gen', usersPic='$pic' WHERE usersUsername='".$_SESSION['username']."';";
if(mysqli_query($conn, $sql))
{
?>
<script type="text/javascript">
alert("Saved Successfully");
window.location="user.profile.php";
</script>
<?php
}
}
?>
<!--...................................................................
..................................Footer...............................
....................................................................-->
<?php
include_once 'Footer/footer.php';
?>
</body>
</html>