-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscience.php
More file actions
592 lines (485 loc) · 21.4 KB
/
science.php
File metadata and controls
592 lines (485 loc) · 21.4 KB
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
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
<?php
session_start();
include_once "./php/config.php";
if(isset($_SESSION['status']) == "Active now") {
$sql = mysqli_query($conn, "SELECT* FROM register WHERE id = '{$_SESSION['id']}'");
if(mysqli_num_rows($sql) > 0 ){
$row = mysqli_fetch_assoc($sql);
$_SESSION['img'] = $row['img'];
} ?>
<?php
}elseif(isset($_SESSION['admin_id'])){
$sql_admin = mysqli_query($conn, "SELECT* FROM admintable WHERE admin_id = '{$_SESSION['admin_id']}'");
if(mysqli_num_rows($sql_admin) > 0 ){
$row_admin = mysqli_fetch_assoc($sql_admin);
}
} else{
?>
<div class="please alert alert-danger fixed-bottom text-dark" style="width: 100%; bottom: 0" role="alert" >
Please <a href="login.php"> signin</a> for better features <button class="btn pleasebtn"><i class="fa fa-times bg-dark text-light py-2 px-3"></i></button>
</div>
<script type="text/javascript">
const please = document.querySelector('.please');
const pleaseBtn = document.querySelector('.pleasebtn i');
pleaseBtn.onclick = ()=>{
please.style.display = "none";
console.log("Clicked")
}
</script>
<?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.0">
<link rel="shortcut icon" href="./images/PERISTERALOGO2.jpg" type="image/x-icon" />
<!-- Style CSS link -->
<link rel="stylesheet" href="./css/all.css" />
<link rel="stylesheet" href="./css/owl.carousel.min.css" />
<link rel="stylesheet" href="./css/owl.theme.default.css" />
<link rel="stylesheet" href="./css/boot4.css" />
<link rel="stylesheet" href="./css/aos.css">
<link rel="stylesheet" href="./css/index.css" />
<!-- Style CSS link -->
<title>Peristera Technologies</title>
</head>
<body>
<!--==================== Navbar ====================== -->
<nav class="navbar navbar-expand-sm" style="width: 100%;">
<a class="navbar-brand" href="nav_index.php"><img src="./images/PERISTERALOGO2.jpg" style="width: 60px;"></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
<span class="navbar-toggler-icon"><i class="fas fa-align-right"></i></span>
</button>
<div class="collapse navbar-collapse row-nav-grid" id="collapsibleNavbar">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link " href="index.php" target="_self">Home</a>
</li>
<li class="nav-item drop-btn">
<button class="btn" href="services.php" target="_self">News <i class="fa fa-caret-down"></i></button>
<div class="dropdown">
<a href="education.php" class="drop-nav">Education</a>
<a href="science.php" class="drop-nav active">Science</a>
<a href="fashion.php" class="drop-nav">Fashion</a>
</div>
</li>
<li class="nav-item">
<a class="nav-link" href="contact.php">Contact us</a>
</li>
</ul>
<div class="search">
<a href="search.php" class="btn btn-primary btn-hover nav-search" target="_blank"><i class="fas fa-search "></i></a>
</div>
<!-- Profile -->
<div class="profile active">
<div class="profile-img"> <a href="#">
<?php
if(isset($_SESSION['img']) !== '0' && isset($_SESSION['status']) == "Active now"){ ?>
<img src="php/Upload/<?php echo $row['img'] ?>" class="img-fluid rounded-circle" style=" height: 40px;" alt=""></a>
<?php }elseif(isset($_SESSION['admin_id'])){ ?>
<img src="./admin/Uploads/<?php echo $row_admin['img'] ?>" class="img-fluid rounded-circle" style=" height: 40px; width: 40px" alt=""></a>
<?php } elseif(isset($_SESSION['status']) == "Active now" && isset($_SESSION['img']) == '0'){ ?>
<img src="./images/profile.png" class="img-fluid rounded-circle" style=" height: 40px;" alt=""></a>
<?php
}else {
echo ('<img src="./images/profile.png" class="img-fluid rounded-circle" style=" height: 40px;" alt=""></a>');
} ?>
</div>
<span class="user text-center py-2">
<?php
if(isset($_SESSION['status']) == "Active now") {
echo $row['FirstName'];
}elseif(isset($_SESSION['admin_id'])) {
echo $row_admin['FirstName'];
}else{
echo "<span class='text-uppercase text-bold'> User</span>";
}?>
<i class="fa fa-caret-down"></i></span>
<div class="dropdown">
<?php if(isset($_SESSION['status']) == "Active now" && isset($_SESSION['img']) !== '0') {
echo ('<span type="btn" id="addProfile"> <button type="button" class="btn" data-toggle="modal" data-target="#addprofile"> Add Profile</button></span>');
}else if(isset($_SESSION['status']) == "Active now" && isset($_SESSION['img']) == '0'){
echo ('<span type="btn" id="addProfile"> <button type="button" class="btn"> Add Profile</button></span>');
}else if(isset($_SESSION['admin_id'])){
echo ('<span type="btn"> <a href="admin/index.php">Admin panel</a></span>');
}
?>
<hr>
<!-- Modal -->
<div class="modal fade" id="addprofile" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel"> Change you profile </h5>
<button type="button" class="btn btn-close" data-toggle="modal" data-target="#addprofile" data-bs-dismiss="modal" aria-label="Close"> <i class="fa fa-times"></i> </button>
</div>
<form action="php/profile.php" method="POST" enctype="multipart/form-data">
<div class="modal-body d-flex justify-content-space-between">
<div class="image_input mr-5">
<input type="file" name="image" id="image">
</div>
<?php
if(isset($_SESSION['status']) == "Active now" && isset($_SESSION['img']) !== '0'){ ?>
<button type="button" class="btn btn-primary text-light" data-toggle="modal" data-target="#deleteprofile">
<i class="fa fa-trash text-light"></i>
</button>
<?php } ?>
<input type="text" name="pre_img" hidden value="<?php echo $row['img'] ?>">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary text-light" data-toggle="modal" data-target="#addprofile" data-bs-dismiss="modal">Close</button>
<button type="submit" name="Upload_image" class="btn btn-primary text-light" id="delete">Upload</button>
</div>
</form>
</div>
</div>
</div>
<div class="modal fade" id="deleteprofile" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
<button type="button" class="btn btn-close" data-toggle="modal" data-target="#deleteprofile" data-bs-dismiss="modal" aria-label="Close"> <i class="fa fa-times"></i> </button>
</div>
<form action="php/profile.php" method="POST">
<div class="modal-body">
<h4> <i class="fa fa-bell"></i> Do you want to delete your profile?</h4>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-toggle="modal" data-target="#deleteprofile" data-bs-dismiss="modal">Close</button>
<button type="submit" name="deleteProfile" class="btn btn-primary" id="delete">Delete Profile</button>
</div>
</form>
</div>
</div>
</div>
<span class="mt-2">
<?php
if(isset($_SESSION['status']) == "Active now") {
?>
<a href="logout.php">Logout</a>
<?php
}elseif(isset($_SESSION['admin_id']) == "Active now") {
echo "<span class='text-primary'><i class='fa fa-user'></i> You are an admin</span>";
?>
<?php
}else{
echo ('<a href="login.php">Login</a>');
} ?>
</span>
</div>
</div>
<!-- Socials -->
<div class="social">
<a href="#"><i class="fab fa-facebook-f"></i></a>
<a href="#"><i class="fab fa-twitter"></i></a>
<a href="#"><i class="fab fa-instagram"></i></a>
<a href="#"><i class="fab fa-telegram"></i></a>
</div>
</div>
</nav>
<!--==============x===== Navbar ==========x=========== -->
<!--==================== Main site section ================== -->
<main>
<!--==================== Blog carousel ================== -->
<section class="Carousel" style="overflow: hidden;" data-aos="fade-left" data-aos-easing="ease-out-cubic" data-aos-duration="500">
<?php
if(isset($_SESSION['img_success']) && $_SESSION['img_success'] != ' '){
echo '<h2 class="bg-success mb-3 text-center p-2 text-light"> <i class="fa fa-bell"></i> '. $_SESSION['img_success']. ' </h2>';
unset($_SESSION['img_success']);
}else if(isset($_SESSION['img_failed']) && $_SESSION['img_failed'] != ' '){
echo '<h2 class="bg-danger mb-3 text-center p-2 text-light"> <i class="fa fa-bell"></i> '. $_SESSION['img_failed']. ' </h2>';
unset($_SESSION['img_failed']);
}
?>
<div class="owl-carousel owl-theme blog-post">
<?php
$sql_slide = "SELECT* FROM blog_posts WHERE blog_type = 'Special' ORDER BY blog_id desc LIMIT 10";
$carousel_call = mysqli_query($conn, $sql_slide);
if(mysqli_num_rows($carousel_call) > 0){
while($row2 = mysqli_fetch_array($carousel_call)){
$blog_id = $row2['blog_id'];
$num_comments = mysqli_query($conn, "SELECT * FROM comments WHERE blog_id = $blog_id ");
$comment_count = mysqli_num_rows($num_comments);
$comments = '';
if($comment_count == 1){
$comments .= $comment_count ." ";
}else{
$comments .= $comment_count . " ";
}
$title = $row2['blog_title'];
(strlen($title) > 28) ? $head = substr($title, 0, 28).'...' : $head = $title;
?>
<div class="blog-content">
<img src="./admin/php/blog/<?php echo $row2['blog_img'] ?>" alt="">
<div class="blog-title">
<h3> <?php echo $head ?></h3>
<a href="view.php?blog_id=<?php echo $row2['blog_id']; ?> ">
<button class="btn btn-blog">Read More</button>
</a>
<span> <i class="fa fa-calendar-alt"></i> <?php echo $row2['time'] ?></span>
<div class="infos">
<span> <a href="#"><i class="fa fa-comments"></i> <b class="numb"><?php echo $comments ?>
</b></a></span>
</div>
</div>
</div>
<?php
}
}
?>
</div>
<div class="owl-navigation">
<span class="owl-nav-prev"><i class="fa fa-long-arrow-alt-left"></i></span>
<span class="owl-nav-next"><i class="fa fa-long-arrow-alt-right"></i></span>
</div>
</section>
<!--============x======= Blog carousel ========x========= -->
<!--=================== Site Main section ================= -->
<section class="section-2 container-fluid mt-5" id="sticky-activator">
<div class="row">
<div class="posts">
<div class="row">
<!-- =============== Cards for posts ======================== -->
<?php include "php/blog_sci.php" ?>
</div>
<div class="pagination">
<?php
$pr_sql = "SELECT* FROM blog_posts WHERE blog_category = 'Science'";
$pr_result = mysqli_query($conn, $pr_sql);
$total_record = mysqli_num_rows($pr_result);
$total_page = ceil($total_record/$num_per_page);
if($page >1){
echo("
<a href='./science.php?page=". ($page-1) ."' class='btn btn-primary text-light btn-hover px-2 py-2'> <i class='fa fa-arrow-left'></i> Prev</a> ");
}
if($page >= 1 && $page <= $total_page){
echo("<a href='./science.php?page=". ($page+1)."' class='btn btn-primary text-light btn-hover px-2 py-2'>Next <i class='fa fa-arrow-right'></i></a>");
}
?>
</div>
</div>
<aside class="sidebar">
<div class="advert">
<div class="advert-img">
<img src="./images2/bbb.jpg" class="img-fluid rounded-lg" alt="advert">
</div>
</div>
<div class="advert">
<div class="advert-img">
<img src="./images2/bbb.jpg" class="img-fluid rounded-lg" alt="advert">
</div>
</div>
<div class="advert">
<div class="advert-img">
<img src="./images2/bbb.jpg" class="img-fluid rounded-lg" alt="advert">
</div>
</div>
<br>
<br>
<!-- Old posts -->
<div class="old-posts">
<h3>Old Posts</h3>
<div class="posts col-md-12 ol-sm-12">
<div class="row">
<?php
?>
<!-- =============== Cards for posts ======================== -->
<?php include_once './php/old_call.php' ?>
</div>
</div>
</div>
</aside>
</div>
</section>
<!--==============x==== Site Main section ======x========== -->
</main>
<!--==================== Main site section ================== -->
<!--==================== Footer Section ================== -->
<footer class="footer">
<div class="container">
<div class="about-us">
<h2>About us</h2>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Earum temporibus nihil illo expedita quia.
Harum, sunt sit. Reiciendis, doloremque voluptatem.</p>
</div>
<div class="newsletter">
<h2>Newsletter</h2>
<p>Stay updated with our latest</p>
<div class="form-element">
<input type="text" placeholder="Email"><span>
<button class="btn"><i class="fas fa-chevron-right"></i></button>
</span>
</div>
</div>
<div class="links" data-aos="fade-right">
<h2>Quick Links</h2>
<ul>
<a href="index.php">
<i class="fas fa-caret-right"></i>
<li>Home</li>
</a>
<a href="./contact.php">
<i class="fas fa-caret-right"></i>
<li>Contact us</li>
</a>
<a href="education.php">
<i class="fas fa-caret-right"></i>
<li>Education</li>
</a>
<a href="fashion.php">
<i class="fas fa-caret-right"></i>
<li>Fashion</li>
</a>
<a href="science.php">
<i class="fas fa-caret-right"></i>
<li>Science</li>
</a>
</ul>
</div>
<div class="follow" data-aos="fade-left">
<h2>Contact us</h2>
<p>Let us be social</p>
<div class="contacts">
<span class="text-light"> <i class="fa fa-phone-square"></i> +23463278784</span>
<span class="text-light"> <i class="fa fa-map-marker-alt"></i>8 Hq Road, +++++ Street</span>
</div>
</div>
</div>
<div class="rights">
<h4 class="text-gray">
Copyright ©<?php echo date('Y'); ?> All rights reserved | made by <a href="#">Peristera Technologies</a>
</h4>
</div>
<div class="move-up">
<span><i class="fas fa-chevron-up fa-2x"></i></span>
</div>
</footer>
<!--===========x======== Footer Section ==========x======= -->
<!-- script jquery -->
<script src="./js/jquery3.4.1.min.js"></script>
<!-- <script src="./js/jquery.min.js"></script> -->
<!-- Owl Carousel -->
<script src="./js/owl.carousel.min.js"></script>
<!-- script bootstrap -->
<script src="./js/aos.js"></script>
<!-- script bootstrap -->
<script src="./js/bootstrap4.js"></script>
<!-- custom script -->
<script>
AOS.init({
offset: 400,
duration: 1000,
});
$(document).ready(function(){
let navbar = $('.navbar');
$(window).scroll(function(){
let oTop = $('#sticky-activator').offset().top - window.innerHeight;
if ($(window).scrollTop()>oTop) {
navbar.addClass("sticky");
}else{
navbar.removeClass("sticky");
}
});
$('#Upload').click(function(){
$.ajax({
type: 'POST',
url: 'php/profile.php',
data:{
form: $('#form').val()
},
beforeSend:function(){
$('#loader').show();
},
success:function(data){
$('#Upload').html(data);
$('#loader').hide();
$('#Upload').show();
},
});
});
const responsive = {
0:{
items: 1
},
320:{
items: 1
},
560:{
items: 2
},
960:{
items: 3
}
}
$('.owl-carousel').owlCarousel({
loop: true,
autoplay: true,
autoplayTimeout: 7000,
dots: false,
nav: true,
navText: [$('.owl-navigation .owl-nav-prev'), $('.owl-navigation .owl-nav-next')],
responsive: responsive
});
$(' footer .move-up span').click(function(){
$('html, body').animate({
scrollTop: 0,
}, 1000)
})
});
// add active class in selected list item
let list = document.querySelectorAll('.nav-link');
for (let i = 0; i < list.length; i++) {
list[i].onclick = function () {
let j = 0;
while (j < list.length) {
list[j++].className = 'nav-link';
}
list[i].className = 'nav-link active';
}
}
let dropNav = document.querySelectorAll('.drop-nav');
for (let e = 0; e < dropNav.length; e++) {
dropNav[e].onclick = function () {
let j = 0;
while (j < dropNav.length) {
dropNav[j++].className = 'drop-nav';
}
dropNav[e].className = 'drop-nav active';
}
}
/** active nav menu */
var searchBtn = document.querySelector('.search button');
var searchIcon = document.querySelector('.search button i');
var searchBar = document.querySelector('.search input');
searchBtn.onclick = ()=>{
searchBar.classList.toggle("active");
searchBar.value = "";
searchBar.focus();
searchIcon.classList.toggle("active");
}
$(document).ready(function(){
$("#search_val").keypress(function(){
location.href = "search.php";
$.ajax({
type: 'POST',
url: 'php/search.php',
data:{
name: $("#search").val(),
},
beforeSend: function(){
$('#loader').show();
},
success:function(data){
$("#output").html(data);
$('#loader').hide();
}
});
});
});
</script>
<!-- <script src="./js/index.js"></script> -->
<!-- <script src="./js/blog_call.js"></script> -->
</body>
</html>