-
Notifications
You must be signed in to change notification settings - Fork 2
/
user.php
96 lines (79 loc) · 3.12 KB
/
user.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
<?php
include_once "lib/lib.php";
connect();
Login();
$user = $_SESSION["user"];
$userId = $user['id'];
$login = $user['login'] ? $user['login'] : $user['vkid'];
if ($login == 'wise guest' || $login == 'guest') {
$user = false;
$userId = -1;
$login = false;
}
$movies = array();
$sqlresult = mysqli_query($GLOBALS['mysqli'], "SELECT * FROM movies");
while ($row = mysqli_fetch_assoc($sqlresult))
$movies[(int)$row['id']] = $row;
$sqlresult = mysqli_query($GLOBALS['mysqli'], "SELECT movieId FROM userignore WHERE userId = $userId ORDER BY id DESC");
$ignore = array();
while ($row = mysqli_fetch_assoc($sqlresult))
$ignore[$row['movieId']] = true;
?>
<!DOCTYPE html>
<html lang="en">
<?php
$title = "Cinema.$login";
include "html/head.php";
?>
<body>
<script type="text/javascript">
var userId = <?php echo $userId; ?>;
function unIgnoreMovie(movieId) {
$.post( "ajax.php", { method: "unIgnoreMovie", userId: userId, movieId: movieId })
.done(function( data ) {
$('tr.movieTr'+movieId).fadeOut();
//alert( "Data Loaded: " + data );
});
}
</script>
<?php
$liactive = "history";
include "html/navbar.php";
?>
<div class="container">
<h3>Фильмы в корзине</h3>
<table class='table table-striped table-hover'>
<thead>
<td>Название</td>
<td>рейтинг</td>
<td>Дата премьеры</td>
<td></td>
</thead>
<tbody>
<?php
foreach(array_keys($ignore) as $key) {
$cur = $movies[$key];
if (!$cur)
continue;
$desc = json_decode($cur['description'], true);
$poster = $desc && array_key_exists('Poster', $desc) ? $desc['Poster'] : "";
echo "<tr class='movieTr" . $cur['id'] . "'>\n";
echo "\t<td><a target='_blank' href='"
.(array_key_exists('kinopoiskId', $desc)?(KINOPOISKROOT."/film/".$desc['kinopoiskId']):("http://www.imdb.com/title/".$cur['imdbid']))
."/'><div class='fullDiv'>"
.(array_key_exists('titleRu',$desc)?($desc['titleRu']." (".$cur['title'].")"):$cur['title'])
."</div></a></td>\n";
echo "\t<td><a target='_blank' href='http://www.imdb.com/title/".$cur['imdbid']."/'><div class='fullDiv'>".(float)$desc['imdbRating']."</div></a></td>\n";
echo "\t<td>".$desc['Released']."</td>\n";
echo "\t<td class='button' onclick='unIgnoreMovie(" . $cur['id'] . ")'><img class='delImg' src='img/cross.png'/></td>\n";
echo "</tr>\n";
}
?>
</tbody>
</table>
<?php
include "html/footer.php";
?>
</div>
</body>
</html>