-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprofile_page.html
227 lines (218 loc) · 7.29 KB
/
profile_page.html
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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
<?php
// we will only start the session with session_start() IF the session isn't started yet //
if (session_status() == PHP_SESSION_NONE) {
session_start();
}
?>
<?php
// including the conn.php to establish connection with database //
include "conn.php";
?>
<?php
if (empty($_SESSION['user_id'])) {
echo "<script>alert('Notice: You still didn\'t log in yet, please login first to proceed to Profile Page.');";
echo "window.location.href='logout.php';</script>";
}
?>
<!DOCTYPE HTML>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title> Profile Page | Meal-Debit System </title>
<link rel="icon" href="image/logo_symbol.png" type="image/ico"/>
<!-- Footer Style -->
<link rel="stylesheet" href="vendor/freebie-footer-templates/css/demo.css">
<link rel="stylesheet" href="vendor/freebie-footer-templates/css/footer-distributed-with-address-and-phones.css">
<!-- Vendor Style -->
<link rel="stylesheet" type="text/css" href="vendor/css/all.min.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<!-- Custom Style -->
<link rel="stylesheet" type="text/css" href="css/fundamentals.css">
<link rel="stylesheet" type="text/css" href="css/parallax_slider.css">
<link rel="stylesheet" href="css/loading....css" type="text/css">
<link rel="stylesheet" type="text/css" href="css/welcome_preloader.css">
<link rel="stylesheet" type="text/css" href="css/profile_page.css">
<!-- JQuery -->
<script type="text/javascript" src="vendor/js/prototype.js"></script>
<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
<!-- Custom Font Style -->
<link href='http://fonts.googleapis.com/css?family=Oswald|Open+Sans:400,600' rel='stylesheet' type='text/css'>
<!-- Loading Script -->
<script type="text/javascript">
$(window).on("load",function(){
$(".preloader").addClass("complete")
})
</script>
</head>
<body>
<script type="text/javascript" src="js/scroll_effect.js"></script>
<!-- Loading the Page OP -->
<div class="preloader">
<div class="loader">
</div>
</div>
<!-- Loading the Page ED -->
<script type="text/javascript">
// Appearance of all content
$(function() {
setTimeout(function() {
$(".page").removeClass("hidden");
}, 1500);
})();
</script>
<div class="page hidden">
<span class="menu-toggle">
<i class="menu-open fa fa-bars fa-lg"></i>
<i class="menu-close fa fa-times fa-lg"></i>
</span>
<div class="page hidden">
<span class="menu-toggle"> <i class="menu-open fa fa-bars fa-lg" style="padding-top:10px!important"></i> <i class="menu-close fa fa-times fa-lg"></i> </span>
<ul class="menu-items">
<img class="menu-logo-pic" alt="Meal-Debit System" src="image/logo_symbol.png">
<li>
<a href="homepage.html"><i class="fas fa-home home-icon"></i>Home</a>
</li>
<li>
<a href="public_meal_list.html"><i class="fas fa-clipboard-list faq-icon"></i>List of Meals</a>
</li>
<li>
<a href="homepage.html#about"><i class="fas fa-book about-icon"></i>About</a>
</li>
</ul>
<!-- Stuff inside the page -->
<div id="content" class="content">
<!-- PHP Nav Login -->
<div id="navigation_bar">
<?php
if (isset($_SESSION['user_id'])) {
include "nav_bar_logged.php";
} else {
include "nav_bar_normal.php";
}
?>
</div>
<br><br><br>
<div class="profile" id="profile_section">
<!-- Including the content of the profile page -->
<?php
include_once('profile_page_content.php');
?>
</div>
</div>
</div>
</div>
<!-- Off Canvas Script -->
<script type="text/javascript">
var $page=$(".page");
$(".menu-toggle").on("click",function() {
$page.toggleClass("shazam");
});
$(".content").on("click",function() {
$page.removeClass("shazam");
});
</script>
<!-- Profile Page Ajax Script -->
<script>
$(document).ready(function(){
function fetch_data()
{
$.ajax({
url:"profile_page_content.php",
method:"POST",
success:function(data){
$('#profile_section').html(data);
}
});
}
function fetch_data_nav()
{
$.ajax({
url:"nav_bar_logged.php",
method:"POST",
success:function(data){
$('#navigation_bar').html(data);
}
});
}
function edit_data(id, text, column_name)
{
$.ajax({
url:"edit_profile.php",
method:"POST",
data:{id:id, text:text, column_name:column_name},
dataType:"text",
success:function(data){
alert(data);
//$('#result').html("<div class='alert alert-success'>"+data+"</div>");//
}
});
}
$(document).on('change', '.profile_pic', function(){
var id = $(this).data("id1");
var profile_image = document.getElementById("bran-image-reg").files[0].name;
edit_data(id,"/APU/SDP/image/" + profile_image, "profile_image");
fetch_data();
fetch_data_nav();
});
$(document).on('blur', '.email', function(){
var id = $(this).data("id2");
var email = $(this).text();
edit_data(id,email, "email");
fetch_data();
fetch_data_nav();
});
$(document).on('blur', '.first_name', function(){
var id = $(this).data("id3");
var first_name = $(this).text();
edit_data(id, first_name, "first_name");
fetch_data();
fetch_data_nav();
});
$(document).on('blur', '.last_name', function(){
var id = $(this).data("id4");
var last_name = $(this).text();
edit_data(id,last_name, "last_name");
fetch_data();
fetch_data_nav();
});
$(document).on('click', '.disable_user', function(){
var id=$(this).data("id5");
if(confirm("Are you sure you want to disable your account? This action will be irreversible unless you contact with the Admins."))
{
$.ajax({
url:"disable_profile.php",
method:"POST",
data:{user_id:id},
dataType:"text",
success:function(data){
alert(data);
window.location.reload();
}
});
}
});
});
</script>
<!-- Upload Image and Preview Script -->
<script type='text/javascript'>
function preview_image(event)
{
var reader = new FileReader();
reader.onload = function()
{
var output = document.getElementById('output_image');
output.src = reader.result;
}
reader.readAsDataURL(event.target.files[0]);
}
</script>
<script type='text/javascript'>
function viewInput() {
// your function here
$("input[id='bran-image-reg']").click();
}
</script>
</body>
</html>