-
Notifications
You must be signed in to change notification settings - Fork 0
/
profile.php
196 lines (167 loc) · 5.37 KB
/
profile.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
<!-- Author Name: Sudipto Ghosh-->
<?php require_once('check_login.php');?>
<?php include('head.php');?>
<?php include('header.php');?>
<?php include('sidebar.php');?>
<?php
include('connect.php');
if(isset($_POST["btn_update"]))
{
extract($_POST);
if($_SESSION['user'] == 'admin'){
$q1="UPDATE admin SET `fname`='$fname',`loginid`='$email',`mobileno`='$contact' where id = '".$_SESSION["id"]."'";
}else if($_SESSION['user'] == 'doctor'){
$q1="UPDATE doctor SET `doctorname`='$fname',`loginid`='$email',`mobileno`='$contact' where doctorid = '".$_SESSION["id"]."'";
}else if($_SESSION['user'] == 'patient'){
$q1="UPDATE patient SET `patientname`='$fname',`loginid`='$email',`mobileno`='$contact' where patientid = '".$_SESSION["id"]."'";
}
if ($conn->query($q1) === TRUE) {
$_SESSION['success']='Record Successfully Updated';
} else {
$_SESSION['error']='Something Went Wrong';
}
?>
<script>
</script>
<?php
}
?>
<?php
if($_SESSION['user'] == 'admin'){
$que="select * from admin where id = '".$_SESSION["id"]."'";
$query=$conn->query($que);
while($row=mysqli_fetch_array($query))
{
//print_r($row);
extract($row);
$fname = $row['fname'];
$email = $row['loginid'];
$contact = $row['mobileno'];
}
}else if($_SESSION['user'] == 'doctor'){
$que="select * from doctor where doctorid = '".$_SESSION["id"]."'";
$query=$conn->query($que);
while($row=mysqli_fetch_array($query))
{
//print_r($row);
extract($row);
$fname = $row['doctorname'];
$email = $row['loginid'];
$contact = $row['mobileno'];
}
}else if($_SESSION['user'] == 'patient'){
$que="select * from patient where patientid = '".$_SESSION["id"]."'";
$query=$conn->query($que);
while($row=mysqli_fetch_array($query))
{
//print_r($row);
extract($row);
$fname = $row['patientname'];
$email = $row['loginid'];
$contact = $row['mobileno'];
}
}
?>
<div class="pcoded-content">
<div class="pcoded-inner-content">
<div class="main-body">
<div class="page-wrapper">
<div class="page-header">
<div class="row align-items-end">
<div class="col-lg-8">
<div class="page-header-title">
<div class="d-inline">
<h4>Profile</h4>
</div>
</div>
</div>
<div class="col-lg-4">
<div class="page-header-breadcrumb">
<ul class="breadcrumb-title">
<li class="breadcrumb-item">
<a href="dashboard.php"> <i class="feather icon-home"></i> </a>
<li class="breadcrumb-item"><a href="profile.php">Profile</a>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="page-body">
<div class="row">
<div class="col-sm-12">
<div class="card">
<div class="card-header">
</div>
<div class="card-block">
<form id="main" method="post" enctype="multipart/form-data">
<div class="form-group row">
<label class="col-sm-2 col-form-label">First Name</label>
<div class="col-sm-4">
<input type="text" class="form-control" name="fname" id="fname" value="<?php echo $fname; ?>" placeholder="Enter first name....">
<span class="messages"></span>
</div>
<label class="col-sm-2 col-form-label">Email</label>
<div class="col-sm-4">
<input type="email" class="form-control" id="email" name="email" value="<?php echo $loginid; ?>" placeholder="Enter valid e-mail address..." pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$" >
<span class="messages"></span>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">Contact</label>
<div class="col-sm-4">
<input type="tel" class="form-control" id="contact" name="contact" value="<?php echo $mobileno;?>" placeholder="Enter valid contact number..." minlength="10" maxlength="10" pattern="^[0][1-9]\d{9}$|^[1-9]\d{9}$">
<span class="messages"></span>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2"></label>
<div class="col-sm-10">
<button type="submit" name="btn_update" class="btn btn-primary m-b-0">Update</button>
</div>
</div>
</form>
</div>
</div>
<?php include('footer.php');?>
<link rel="stylesheet" href="popup_style.css">
<?php if(!empty($_SESSION['success'])) { ?>
<div class="popup popup--icon -success js_success-popup popup--visible">
<div class="popup__background"></div>
<div class="popup__content">
<h3 class="popup__content__title">
Success
</h3>
<p><?php echo $_SESSION['success']; ?></p>
<p>
<!-- <button class="button button--success" data-for="js_success-popup">Close</button> -->
<?php echo "<script>setTimeout(\"location.href = 'profile.php';\",1500);</script>"; ?>
</p>
</div>
</div>
<?php unset($_SESSION["success"]);
} ?>
<?php if(!empty($_SESSION['error'])) { ?>
<div class="popup popup--icon -error js_error-popup popup--visible">
<div class="popup__background"></div>
<div class="popup__content">
<h3 class="popup__content__title">
Error
</h3>
<p><?php echo $_SESSION['error']; ?></p>
<p>
<button class="button button--error" data-for="js_error-popup">Close</button>
</p>
</div>
</div>
<?php unset($_SESSION["error"]); } ?>
<script>
var addButtonTrigger = function addButtonTrigger(el) {
el.addEventListener('click', function () {
var popupEl = document.querySelector('.' + el.dataset.for);
popupEl.classList.toggle('popup--visible');
});
};
Array.from(document.querySelectorAll('button[data-for]')).
forEach(addButtonTrigger);
</script>