-
Notifications
You must be signed in to change notification settings - Fork 0
/
bucketlist-page.php
317 lines (257 loc) · 14.9 KB
/
bucketlist-page.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
<?php
session_start();
include('connection.php');
if(!isset($_SESSION['user_id'])){
header("location: index.php");
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Title of the page -->
<title>Flixathon - Bucket List</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet"/>
<!-- Linking external stylesheets -->
<link rel="stylesheet" href="style.css">
<!-- Linking google fonts -->
<link href="https://fonts.googleapis.com/css?family=Arvo&display=swap" rel="stylesheet">
<!-- Linking icons -->
<link rel="icon" href="company-logo.png">
<script type = "text/javascript" src = "//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js" ></script>
</head>
<body>
<!-- Navbar -->
<nav class="navbar navbar-expand navbar-expand-lg navbar-dark">
<a class="navbar-brand" href="#"><img src="company-logo.png" class="logo"></a>
<ul class="nav navbar-nav ml-auto">
<!-- <li class="nav-item navbar-right"><button class="btn-info"></button></li> -->
<li class="nav-item dropdown navbar-left">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<img src="https://s3.eu-central-1.amazonaws.com/bootstrapbaymisc/blog/24_days_bootstrap/fox.jpg" width="40" height="40" class="rounded-circle">
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<a class="dropdown-item" href="./mainpageloggedin.php">Dashboard</a>
<a class="dropdown-item" href="./profile-page.php">Edit Profile</a>
</div>
</li>
<li class="nav-item navbar-right"><a class="btn btn-logout" href="./index.php?logout=1">LOGOUT</a></li>
</ul>
</nav>
<button onclick="topFunction()" id="myBtn" title="Go to top"><i class="fa fa-arrow-up" aria-hidden="true"></i></button>
<div style="margin-top: 100px;" class="container">
<h1 class="welcome-user" style="text-align: center; color: black;">
<span style="background-color: Gold; padding: 5px; border-radius: 10px;">BUCKET LIST</span></h1>
</div>
<div style="margin-top: 50px; text-align: center;" id="mainpagecontainer" class="container">
<!-- The social media icon bar -->
<div class="icon-bar">
<a href="#" class="twitter-bar"><i class="fa fa-twitter"></i></a>
<a href="#" class="whatsapp-bar"><i class="fa fa-whatsapp"></i></a>
<a href="#" class="mail-bar"><i class="fa fa-envelope-o"></i></a>
<a href="#" class="sms-bar"><i class="fa fa-commenting-o"></i></a>
</div>
<div style="margin-bottom: 50px; text-align: center;">
<div class="btn-group" role="group" aria-label="Basic example">
<button type="button" style='border: 1px solid white;' class="btn lists" onclick="window.open('./mainpageloggedin.php', '_self')"><i class="fa fa-arrow-left" aria-hidden="true"></i> BACK</button>
<button type="button" style="border: 1px solid white; margin-left: 10px;" class="btn lists" onclick="window.open('./watched-page.php', '_self')">WATCHED</button>
<button type="button" style="border: 1px solid white; margin-left: 10px;" class="btn lists" onclick="window.open('./favorites-page.php', '_self')">FAVORITES</button>
</div>
</div>
<div id='error'></div>
<div style='min-height: 600px; margin-bottom: 100px;'> <div id='show'></div>
</div>
</div>
<!-- Footer -->
<div style="margin-top: 200px; height: auto; text-align: center;" class="container-fluid">
<div id="footerself">
© Copyright. All rights reserved.
</div>
<div style='margin-top: 5px;' class="btn-group" role="group" aria-label="Basic example">
<button type="button" class="footerbtn"><img id='selfimage' src='./self-image-circle.png'></img></button></button>
<button type="button" style="margin-top: 2px;" class="footerbtn"><span class='foottext' style='color: white;'>Developed by<br></span><span class='foottext' style='color: white;'>Subham Das</span></button>
</div>
<br>
<div style='margin-top: 25px; margin-bottom: 15px;' class="btn-group" role="group" aria-label="Basic example">
<button type="button" class="footerbtn" onclick="window.open('https://github.com/das-jishu')"><img class='footimage' id='github' title='Github' src='./GitHub-Mark-Light-120px-plus.png'></img></button>
<button type="button" class="footerbtn" onclick="window.open('https://www.facebook.com/subham.das.39948')"><img class='footimage' id='facebook' title='Facebook' src='./facebook_logos_PNG19754.png'></img></button>
<button type="button" class="footerbtn" onclick="window.open('https://www.linkedin.com/in/subham-das-51b5bb171/')"><img class='footimage' id='linkedin' title='Linkedin' src='./linkedIn_PNG37.png'></img></button>
<button type="button" class="footerbtn" onclick="window.open('https://twitter.com/lord_danton')"><img class='footimage' id='twitter' title='Twitter' src='./twitter_PNG34.png'></img></button>
</div>
</div>
<!-- Scripts -->
<script>
var mybutton = document.getElementById("myBtn");
//console.log('Active');
// When the user scrolls down 20px from the top of the document, show the button
window.onscroll = function() {
scrollFunction();
};
function scrollFunction() {
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
mybutton.style.display = "block";
} else {
mybutton.style.display = "none";
}
}
// When the user clicks on the button, scroll to the top of the document
function topFunction() {
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
}
//load the bucket list
$.ajax({
type: 'POST',
url: './loadlist.php',
data: { table: 'bucketlist' },
success: function(response) {
$("#show").html(response);
$('#show .elementfav').click(function() {
$(this).find('div.extras').toggleClass('showextra');
var movie_id = $(this).find('table tr td:eq(0)').text();
var titlerelease = $(this).find('table tr td:eq(2)').text();
var cur_title = titlerelease.substring(0,titlerelease.indexOf('-') - 1);
var cur_release = titlerelease.substring(titlerelease.length - 4);
var cur_vote = $(this).find('table tr td:eq(3)').text();
var cur_posterpath = $(this).find('table tr td:eq(4)').text();
var cur_overview = $(this).find('.extras .overview').text();
//console.log(cur_title);
//console.log(cur_release);
//console.log(cur_vote);
//console.log(cur_posterpath);
//console.log(cur_overview);
$(this).find('.delete').click(function() {
$.ajax({
type: 'POST',
url: './deletelist.php',
data: { table: 'bucketlist', movie_id: movie_id },
success: function(response) {
if(response == 'success')
{
location.reload(true);
}
else
{
$("#error").html(response);
//console.log(data);
}
},
error: function() {
$("#error").html("<div class='alert alert-danger'>There was an error with the Ajax Call. Please try again later.</div>");
}
});
});
$(this).find('.addtofavorites').click(function() {
$.ajax({
type: 'POST',
url: './addlist.php',
data: { table: 'favorites', movie_id: movie_id, title: cur_title, releaseyear: cur_release, vote: cur_vote, posterpath: cur_posterpath, overview: cur_overview },
success: function(response) {
if(response == 'success')
{
$("#error").html('<div class="alert alert-success">Successfully added!</div>');
}
else
{
$("#error").html(response);
//console.log(data);
}
},
error: function() {
$("#error").html("<div class='alert alert-danger'>There was an error with the Ajax Call. Please try again later.</div>");
}
});
});
$(this).find('.movetowatched').click(function() {
console.log('gggg');
$.ajax({
type: 'POST',
url: './addlist.php',
data: { table: 'watched', movie_id: movie_id, title: cur_title, releaseyear: cur_release, vote: cur_vote, posterpath: cur_posterpath, overview: cur_overview, event: 'move' },
success: function(response) {
if(response == 'success')
{
$.ajax({
type: 'POST',
url: './deletelist.php',
data: { table: 'bucketlist', movie_id: movie_id },
success: function(response) {
if(response == 'success')
{
location.reload(true);
$('#error').html('<div class="alert alert-success">Successfully moved!</div>');
}
else
{
$("#error").html(response);
//console.log(data);
}
},
error: function() {
$("#error").html("<div class='alert alert-danger'>There was an error with the Ajax Call. Please try again later.</div>");
}
});
}
else
{
$("#error").html(response);
//console.log(data);
}
},
error: function() {
$("#error").html("<div class='alert alert-danger'>There was an error with the Ajax Call. Please try again later.</div>");
}
});
});
});
//create the list to be shared
var shareList = 'Hey! Check my bucket list: \n\n';
var i = 1;
$('.elementfav').each(function() {
var temp = $(this).find('table tr td:eq(2)').text();
var check = temp.substring(0, temp.indexOf('-') - 1);
if(check !== 'NIL')
{
shareList += (i++) + '. ' + check + '.\n';
}
});
shareList += '\nVisit Flixathon to create your own lists: \nhttp://movie-project.epizy.com/index.php?i=1';
//console.log(shareList);
var encodedtext = encodeURIComponent(shareList);
var urlTwitter = 'https://twitter.com/intent/tweet?text=' + encodedtext;
var urlMail = "mailto:?body=" + encodedtext;
var urlWhatsapp = 'https://wa.me/?text='+encodedtext;
var urlSMS = 'sms:?body=' + encodedtext;
if(i !== 1)
{
$('.twitter-bar').click(function() {
window.open(urlTwitter, '_blank');
});
$('.mail-bar').click(function() {
window.open(urlMail, '_blank');
});
$('.whatsapp-bar').click(function() {
window.open(urlWhatsapp, '_blank');
});
$('.sms-bar').click(function() {
window.open(urlSMS, '_blank');
});
}
},
error: function() {
$("#show").html("<div class='alert alert-danger'>There was an error with the Ajax Call. Please try again later.</div>");
}
});
</script>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.1.1.min.js">
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
<script src="./indexscript.js"></script>
<script src="./search.js"></script>
</body>
</html>