This repository was archived by the owner on Apr 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfavorite.php
284 lines (269 loc) · 12.7 KB
/
favorite.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
<?php
/**
* Created by PhpStorm.
* User: Алексей
* Date: 14.12.2015
* Time: 21:37
*/
include_once 'db_connection/bd_connect.php';
include_once 'db_connection/functions.php';
sec_session_start(); // start secure session
?>
<?php if (login_check($mysqli) == true) :
mysqli_close($mysqli);
include_once 'db_connection/bd_connect_secure.php';?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/html">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Library">
<title>Favorites</title>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="Bootstrap3/dist/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="js/easyui/easyui.css">
<link rel="stylesheet" type="text/css" href="js/easyui/icon.css">
<link href="Bootstrap3/dist/css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href='https://fonts.googleapis.com/css?family=Lekton:700' rel='stylesheet' type='text/css'>
<link href="css/sidebar.css" rel="stylesheet">
<script type="text/javascript" src="js/easyui/jquery_easy_ui.js"></script>
<script type="text/javascript" src="http://www.jeasyui.com/easyui/datagrid-detailview.js"></script>
<script type="text/JavaScript" src="js/jQuery-Autocomplete/jquery.autocomplete.js"></script>
<!-- <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/demo/demo.css"> -->
<script type="text/JavaScript" src="js/sha512.js"></script>
<script type="text/JavaScript" src="js/loadcity.js"></script>
<script type="text/JavaScript" src="js/load_user.js"></script>
<script type="text/JavaScript" src="js/edit_user.js"></script>
<script type="text/JavaScript" src="js/user_functions.js"></script>
<script type="text/JavaScript" src="js/hash_functions.js"></script>
<script type="text/JavaScript" src="js/book_functions.js"></script>
<body>
<div id="wrapper">
<!-- Sidebar -->
<div id="sidebar-wrapper">
<ul class="sidebar-nav">
<li class="sidebar-brand">
<h3 id="libry">Libry</h3>
</li>
<li>
<div class="welcome">
<h4>
Welcome, <span id="user"><?php echo htmlentities($_SESSION['username']); ?>!</span>
</h4>
</div>
</li>
<li>
<a href="index.php">Main</a>
</li>
<li>
<a href="mybooks.php">My books</a>
</li>
<li>
<a href="#">Favorites</a>
</li>
<li>
<a href="books.php">Libry's books</a>
</li>
<li>
<a href="#">My rentals</a>
</li>
<li>
<a href="profile.php">Profile</a>
</li>
<li>
<a href="https://github.com/AlexWorldD/StudID">About</a>
</li>
</ul>
</div>
<!-- /#sidebar-wrapper -->
<!-- Page Content -->
<div id="page-content-wrapper">
<div class="container-fluid col-md-10 col-md-offset-1 col-xs-12">
<div class="row">
<div class="col-md-6 col-md-offset-6 col-xs-6 col-xs-offset-6">
<h2 class="text-center">Favorites <span class="glyphicon glyphicon-star" aria-hidden="true">
</h2>
</div>
</div>
<div class="row">
<div class="col-md-10 col-md-offset-1">
<div class="panel panel-default">
<div class="panel-heading">
<div class="text-right">
<div class="row">
<!--
<button type="button" class="btn btn-link"
onclick="add_book(<?php echo htmlentities($_SESSION['user_id']); ?>)">Add
<span class="glyphicon glyphicon-plus"></span></button>
<a href="db_connection/get_xml.php?user_id=<?php echo htmlentities($_SESSION['user_id']); ?>"> XML export </a>
-->
<button type="button" class="btn btn-link"
onclick="find_user(<?php echo htmlentities($_SESSION['user_id']); ?>)">Найти владельца
<span class="glyphicon glyphicon-search"></span></button>
</div>
</div>
</div>
<div class="panel-body">
<table id="t_my_books" class="easyui-datagrid" style="height:550px"
data-options="url: 'db_connection/load_favorite_books.php?user_id=<?php echo htmlentities($_SESSION['user_id']); ?>',
striped: 'true',
toolbar: 'toolbar', pagination: 'true',
rownumbers: 'true', fitColumns: 'true', singleSelect: 'true'"
>
<thead>
<tr>
<th field="writing_id" width="0" hidden="true"></th>
<th field="title" width="35%" align="center">Название</th>
<th field="last_name" width="15%" sortable="true">Автор</th>
<th field="first_name" width="20" align="center"></th>
<th field="patronymic" width="20%"></th>
<th field="nums" width="10%" align="center" sortable="true" order="desc">
Наличие
</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
<br>
</div>
<!-- Modal -->
<div class="modal fade" id="m_show_book" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<div class="col-md-10 col-md-offset-1">
<div class="row">
<h4 class="modal-title text-center"><em><span id="l_n"></span>   <span
id="f_n"></span>   <span id="pat"></span></em></h4>
</div>
</div>
</div>
<div class="modal-header">
<div class="col-md-10 col-md-offset-1">
<div class="row">
<h4 class="modal-title text-center"><span id="title_book"> </span> <span>   <span
class="text-muted" id="release_y"></span> </span></h4>
</div>
</div>
</div>
<div class="modal-body text-justify" id="descrip_book">
</div>
<br>
<div class="modal-footer">
<!--
<div class="row">
<div id="b_msg" class="alert alert-success alert-dismissable text-center" hidden>
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
Книга добавлена!
</div>
<div id="b_msg_war" class="alert alert-warning alert-dismissable text-center" hidden>
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
Книга уже в вашем списке Favorites!
</div>
<button type="button" class="btn btn-primary- btn-link" onclick="add_fav(<?php echo htmlentities($_SESSION['user_id']); ?>)">Add to <span class="glyphicon glyphicon-star-empty"></span></button>
</div>
-->
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- Second Modal -->
<div class="modal fade" id="m_show_user" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<div class="col-md-10 col-md-offset-1">
<div class="row">
<h4 class="modal-title text-center"><em>Книга найдена!</em></h4>
</div>
</div>
</div>
<div class="modal-header">
</div>
<div class="modal-body text-justify">
<div class="row">
<div class="col-md-10">
  <strong><span id="user_l"> </span>   </strong> <span id="user_n"> </span>   -   <span id="phone"></span>,   <span id="email"></span>
</div>
</div>
</div>
<div class="modal-footer">
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
</div>
<!-- /#page-content-wrapper -->
<script>
$("#menu-toggle").click(function (e) {
e.preventDefault();
$("#wrapper").toggleClass("toggled");
});
</script>
</div>
</body>
</html>
<?php else : ?>
<?php
include_once 'db_connection/bd_connect.php';
if (login_check($mysqli) == true) {
$logged = 'in';
} else {
$logged = 'out';
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Sign In</title>
<link rel="stylesheet" href="styles/main.css" />
<meta charset="UTF-8">
<title>Login page</title>
<link href="Bootstrap3/dist/css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="css/login_style.css" rel="stylesheet" media="screen">
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="Bootstrap3/dist/js/bootstrap.min.js"></script>
<script type="text/JavaScript" src="js/sha512.js"></script>
<script type="text/JavaScript" src="js/hash_functions.js"></script>
</head>
<body>
<?php
if (isset($_GET['error'])) {
echo '<p class="error">Error Logging In!</p>';
}
?>
<div class="container">
<div class="row">
<div class="col-sm-6 col-md-4 col-md-offset-4">
<h1 class="text-center login-title">Sign In</h1>
<div class="account-wall">
<?php
if (!empty($er_msg)) {
echo '<h4 class="text-center warning">'.$er_msg.'</h4>';
}
?>
<form class="form-signin" action="db_connection/login_process.php" method="post" name="login_form">
<input type="text" class="form-control" placeholder="Username" required autofocus name="username">
<input type="password" class="form-control" placeholder="Password" required name="password">
<input type="button" class="btn btn-lg btn-primary btn-block"
value="Login"
onclick="formhash(this.form, this.form.password);" />
<a href="#" class="pull-right need-help">Need help? </a><span class="clearfix"></span>
</form>
</div>
<a href="register.php" class="text-center new-account">Register </a>
</div>
</div>
</div>
</body>
</html>
<?php endif; ?>