-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
152 lines (106 loc) · 4.22 KB
/
index.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
<?php require_once 'controllers/crudController.php';
require_once 'controllers/loginSessionController.php';?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>Algorithms</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/css/all.min.css" integrity="sha512-L7MWcK7FNPcwNqnLdZq86lTHYLdQqZaz5YcAgE+5cnGmlw8JT03QB2+oxL100UeB6RlzZLUxCGSS4/++mNZdxw==" crossorigin="anonymous" />
<link href='https://fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'>
<!-- Custom styles for this template -->
<link href="clean-blog.min.css" rel="stylesheet">
</head>
<body>
<!-- Navigation -->
<nav class="navbar navbar-expand-lg navbar-light fixed-top" id="mainNav">
<div class="container">
<a class="navbar-brand" href="index.php">Algorithm Blog</a>
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
Menu
<i class="fas fa-bars"></i>
</button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="about.php">About</a>
</li>
<?php
if($logged_in){
echo '<li class="nav-item">
<a class="nav-link" href="create_post.php">Create Posts</a>
</li>';
echo '<li class="nav-item">
<a class="nav-link" href="dboardall.php">Dashboard</a>
</li>';
}
?>
<?php
if($logged_in){
echo '<li class="nav-item">
<a class="nav-link" href="logout.php">Logout</a>
</li>';
}
else{
echo '<li class="nav-item">
<a class="nav-link" href="login.php">Login/Register</a>
</li>';
}
?>
</ul>
</div>
</div>
</nav>
<!-- Page Header -->
<header class="masthead" style="background-image: url('img/home-bg.jpg')">
<div class="overlay"></div>
<div class="container">
<div class="row">
<div class="col-lg-8 col-md-10 mx-auto">
<div class="site-heading">
<h1>Think twice Code Once</h1>
<span class="subheading">A Blog on Algorithms</span>
</div>
</div>
</div>
</div>
</header>
<!-- Main Content -->
<div class="container">
<div class="row">
<div class="col-lg-8 col-md-10 mx-auto">
<?php
$posts = getMyApprovedAllPosts($user_id);
foreach($posts as $post) { ?>
<div class="post-preview">
<a href="view_post.php?id=<?php echo $post['id'];?>">
<h2 class="post-title">
<?php echo $post['title'];?>
</h2>
<h3 class="post-subtitle">
<?php echo $post['tag'];?>
</h3>
</a>
<p class="post-meta">Posted by
<a href="view_post.php?id=<?php echo $post['id'];?>"> <?php echo $post['username'];?></a>
on <?php echo $post['date'];?></p>
</div>
<hr>
<?php } ?>
<!-- Pager -->
</div>
</div>
</div>
<hr>
<!-- Footer -->
<!-- Bootstrap core JavaScript -->
<script src="https://startbootstrap.github.io/startbootstrap-clean-blog/vendor/jquery/jquery.min.js"></script>
<script src="https://startbootstrap.github.io/startbootstrap-clean-blog/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- Custom scripts for this template -->
<script src="https://startbootstrap.github.io/startbootstrap-clean-blog/js/clean-blog.min.js"></script>
</body>
</html>