/
output_fns.php
365 lines (329 loc) · 12.6 KB
/
output_fns.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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
<?php
function do_html_header($title) {
// print an HTML header
?>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://apps.bdimg.com/libs/bootstrap/3.3.0/css/bootstrap.min.css">
<!--
<link rel="icon" href="favicon.ico">
<link href="css/style.css" rel="stylesheet">
<link rel="shortcut icon" href="https://www.wasify.com/assets/assets/favicon.ico">
<link rel="apple-touch-icon" href="https://www.wasify.com/assets/assets/icons/apple-touch-icon-iphone.png" />
<link rel="apple-touch-icon" sizes="72x72" href="https://www.wasify.com/assets/assets/icons/apple-touch-icon-ipad.png" />
<link rel="apple-touch-icon" sizes="114x114" href="https://www.wasify.com/assets/assets/icons/apple-touch-icon-iphone-retina-display.png" />
<link rel="apple-touch-icon" sizes="152x152" href="https://www.wasify.com/assets/assets/icons/apple-touch-icon-ipad-retina-display.png" />
-->
<style>
body { padding-top: 70px; }
.navbar-header .logo { padding-top: 10px; }
</style>
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header logo">
<a class="navbar-brand" href="#">
<img alt="Brand" src="img/logo2.jpg" style="width: 100px">
</a>
</div>
<ul class="nav navbar-nav">
<li class="dropdown"><a href="#" class="dropdown-toggle"
data-toggle="dropdown" role="button" aria-expanded="false">
Customer <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu" onclick="<?php session_start(); if(!$_SESSION['valid_user']) echo"return false";?>">
<li><a href="view_notifications.php?user_id=<?php session_start(); echo $_SESSION['valid_user'];?>">message box</a></li>
<li class="divider"></li>
<li><a href="view_recommendation.php">recommendation food</a></li>
</ul>
</li>
<li class="dropdown"><a href="#" class="dropdown-toggle"
data-toggle="dropdown" role="button" aria-expanded="false">
Merchant <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu" onclick="<?php session_start(); if(!$_SESSION['valid_merchant']) echo"return false";?>">
<li><a href="merchant_upload_food.php">upload food</a></li>
<li class="divider"></li>
<li><a href="food_of_merchant.php?merchant_id=<?php session_start(); echo $_SESSION['valid_merchant'];?>">view my food</a></li>
<li class="divider"></li>
<li><a href="merchant_info_details.php?merchant_id=<?php session_start(); echo $_SESSION['valid_merchant'];?>">my information</a></li>
<li class="divider"></li>
<li><a href="merchant_view_complaints.php?merchant_id=<?php session_start(); echo $_SESSION['valid_merchant'];?>">view comlaints</a></li>
<li class="divider"></li>
<li><a href="view_notifications.php?merchant_id=<?php session_start(); echo $_SESSION['valid_merchant'];?>">message box</a></li>
</ul>
</li>
<li class="dropdown"><a href="#" class="dropdown-toggle"
data-toggle="dropdown" role="button" aria-expanded="false">
Administrator <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu" onclick="<?php session_start(); if(!$_SESSION['valid_admin']) echo"return false";?>">
<li><a href="sensitive_words_management.php">manage black list</a></li>
<li class="divider"></li>
<li><a href="view_malign_accordings.php">monitor</a></li>
</ul>
</li>
</ul>
<form class="navbar-form navbar-left" role="search" action="search_result_by_food_name.php" method="get">
<div class="form-group">
<input type="text" class="form-control" name = "search_key" placeholder="Search food name">
</div>
<button type="submit" class="btn btn-primary">Search</button>
<a href="advanced_search_result.php" class="btn btn-primary" role="button">Advanced Search</a>
</form>
<p class="navbar-text"><b><?php session_start(); if($_SESSION['name']) echo "Logged in as: ".$_SESSION['name']; else echo "Welcome to Food Galaxy";?></b></p>
<a href="login.php" class="btn btn-primary navbar-btn " role="button">Log in</a>
<a href="logout.php" class="btn btn-primary navbar-btn " role="button">Log out</a>
<a href="admin_login.php" class="btn btn-primary navbar-btn " role="button">Admin Log in</a>
</div>
</nav>
<div class="modal fade" id="login" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content login">
<img src="https://www.wasify.com/assets/images/isotipo.png" class="logo" alt="wasify">
<h2>Log in to FoodGalaxy</h2>
<form class="form-signin col-md-6 col-md-offset-3" role="form" method="post" action="login.php">
<div class="form-signin">
<label class="sr-only" for="email">Account email</label>
<input type="text" class="form-control" id="email" name="email" maxlength="50" placeholder="Account email" value="">
<label class="sr-only" for="pass">Password</label>
<input type="password" class="form-control" id="pass" name="pass" maxlength="20" placeholder="Password" value="" data-toggle="fixed-tooltip">
</div>
<br>
<button class="btn btn-success btn-block" type="submit" name="commandLogin" value="1">Log in</button>
<div class="loginLinks">
<a href="https://manager.wasify.com/forgotten_password" rel="nofollow">Forgotten password?</a>
<a href="#" rel="nofollow" data-toggle="modal" data-target="#signUp">Not a client yet? Try FoodGalaxy!</a>
</div>
</form>
</div>
</div>
</div>
<?php
if($title) {
do_html_heading($title);
}
}
function do_html_footer() {
// print an HTML footer
?>
<script src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://apps.bdimg.com/libs/bootstrap/3.3.0/js/bootstrap.min.js"></script>
</body>
</html>
<?php
}
function do_html_heading($heading) {
// print heading
?>
<h2 align="center"><?php echo $heading;?></h2>
<?php
}
function do_html_URL($url, $name) {
// output URL as link and br
?>
<br /><a href="<?php echo $url;?>"><?php echo $name;?></a><br />
<?php
}
function display_site_info() {
// display some marketing info
?>
<ul>
<li>This is food review web system!</li>
<li>Enjoy it!</li>
<li>Share your stories with others!</li>
</ul>
<?php
}
function display_login_form() {
?>
<p><a href="register_form.php">Not a member?</a></p>
<form method="post" action="member.php">
<table bgcolor="#cccccc">
<tr>
<td colspan="2">Members log in here:</td>
<tr>
<td>Username:</td>
<td><input type="text" name="username"/></td></tr>
<tr>
<td>Password:</td>
<td><input type="password" name="passwd"/></td></tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value="Log in"/></td></tr>
<tr>
<td colspan="2"><a href="forgot_form.php">Forgot your password?</a></td>
</tr>
</table></form>
<?php
}
function display_registration_form() {
?>
<form method="post" action="register_new.php">
<table bgcolor="#cccccc">
<tr>
<td>Username <br />(max 16 chars):</td>
<td valign="top"><input type="text" name="username"
size="16" maxlength="16"/></td></tr>
<tr>
<td>Password <br />(between 6 and 16 chars):</td>
<td valign="top"><input type="password" name="passwd"
size="16" maxlength="16"/></td></tr>
<tr>
<td>Confirm password:</td>
<td><input type="password" name="passwd2" size="16" maxlength="16"/></td></tr>
<tr>
<td>Email address:</td>
<td><input type="text" name="email" size="30" maxlength="100"/></td></tr>
<tr>
<td>Phone:</td>
<td><input type="text" name="phone" size="30" maxlength="100"/></td></tr>
<tr>
<td colspan=2 align="center">
<input type="submit" value="Register"></td></tr>
</table></form>
<?php
}
function display_user_urls($url_array) {
// display the table of URLs
// set global variable, so we can test later if this is on the page
global $bm_table;
$bm_table = true;
?>
<br />
<form name="bm_table" action="delete_bms.php" method="post">
<table width="300" cellpadding="2" cellspacing="0">
<?php
$color = "#cccccc";
echo "<tr bgcolor=\"".$color."\"><td><strong>Bookmark</strong></td>";
echo "<td><strong>Delete?</strong></td></tr>";
if ((is_array($url_array)) && (count($url_array) > 0)) {
foreach ($url_array as $url) {
if ($color == "#cccccc") {
$color = "#ffffff";
} else {
$color = "#cccccc";
}
//remember to call htmlspecialchars() when we are displaying user data
echo "<tr bgcolor=\"".$color."\"><td><a href=\"".$url."\">".htmlspecialchars($url)."</a></td>
<td><input type=\"checkbox\" name=\"del_me[]\"
value=\"".$url."\"/></td>
</tr>";
}
} else {
echo "<tr><td>No bookmarks on record</td></tr>";
}
?>
</table>
</form>
<?php
}
function display_user_menu() {
// display the menu options on this page
?>
<hr />
<a href="member.php">Home</a> |
<a href="add_bm_form.php">Add BM</a> |
<?php
// only offer the delete option if bookmark table is on this page
global $bm_table;
if ($bm_table == true) {
echo "<a href=\"#\" onClick=\"bm_table.submit();\">Delete BM</a> | ";
} else {
echo "<span style=\"color: #cccccc\">Delete BM</span> | ";
}
?>
<a href="change_passwd_form.php">Change password</a>
<br />
<a href="recommend.php">Recommend URLs to me</a> |
<a href="logout.php">Logout</a>
<hr />
<?php
}
function display_add_bm_form() {
// display the form for people to enter a new bookmark in
?>
<script type="text/javascript">
var myReq = getXMLHTTPRequest();
</script>
<form>
<table width="250" cellpadding="2" cellspacing="0" bgcolor="#cccccc">
<tr><td>New BM:</td>
<td><input type="text" id="new_url" name="new_url" value="http://"
size="30" maxlength="255"/></td></tr>
<tr><td colspan="2" align="center">
<input type="button" value="Add bookmark"
onClick=" javascript:addNewBookmark();"/></td></tr>
</table>
</form>
<div id="displayresult"></div>
<?php
}
function display_password_form() {
// display html change password form
?>
<br />
<form action="change_passwd.php" method="post">
<table width="250" cellpadding="2" cellspacing="0" bgcolor="#cccccc">
<tr><td>Old password:</td>
<td><input type="password" name="old_passwd"
size="16" maxlength="16"/></td>
</tr>
<tr><td>New password:</td>
<td><input type="password" name="new_passwd"
size="16" maxlength="16"/></td>
</tr>
<tr><td>Repeat new password:</td>
<td><input type="password" name="new_passwd2"
size="16" maxlength="16"/></td>
</tr>
<tr><td colspan="2" align="center">
<input type="submit" value="Change password"/>
</td></tr>
</table>
<br />
<?php
}
function display_forgot_form() {
// display HTML form to reset and email password
?>
<br />
<form action="forgot_passwd.php" method="post">
<table width="250" cellpadding="2" cellspacing="0" bgcolor="#cccccc">
<tr><td>Enter your username</td>
<td><input type="text" name="username" size="16" maxlength="16"/></td>
</tr>
<tr><td colspan=2 align="center">
<input type="submit" value="Change password"/>
</td></tr>
</table>
<br />
<?php
}
function display_recommended_urls($url_array) {
// similar output to display_user_urls
// instead of displaying the users bookmarks, display recomendation
?>
<br />
<table width="300" cellpadding="2" cellspacing="0">
<?php
$color = "#cccccc";
echo "<tr bgcolor=\"".$color."\">
<td><strong>Recommendations</strong></td></tr>";
if ((is_array($url_array)) && (count($url_array)>0)) {
foreach ($url_array as $url) {
if ($color == "#cccccc") {
$color = "#ffffff";
} else {
$color = "#cccccc";
}
echo "<tr bgcolor=\"".$color."\">
<td><a href=\"".$url."\">".htmlspecialchars($url)."</a></td></tr>";
}
} else {
echo "<tr><td>No recommendations for you today.</td></tr>";
}
?>
</table>
<?php
}
?>