-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEvents.php
More file actions
254 lines (227 loc) · 9.68 KB
/
Events.php
File metadata and controls
254 lines (227 loc) · 9.68 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
<?php require_once("include/EventsDB.php"); ?>
<?php require_once("include/Sessions.php"); ?>
<?php require_once("include/Functions.php"); ?>
<?php
if(!isset($_SESSION["Username"])){
$_SESSION["ErrorMessage"] = "Please Register/Login to view content.";
Redirect_to("Blog.php");
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>TechVents | Blog</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="js/search.js" ></script>
<link rel="stylesheet" href="css/main.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/css/all.min.css" integrity="sha256-h20CPZ0QyXlBuAw7A+KluUYx/3pK+c7lYEpqLTlxjYQ=" crossorigin="anonymous" />
</head>
<script>
$(document).ready(function(){
$.ajax({
type: "POST",
url: "Search.php",
data: {
Search: 'everything',
},
success: function (html) {
$("#display").html(html).show();
},
});
})
</script>
<body>
<?php require_once("include/Functions.php"); ?>
<div class="menu-btn">
<i class="fas fa-bars fa-2x"></i>
</div>
<div class="container"id="events">
<!-- NavBar -->
<nav class="nav-main" >
<img src="images/icons8-bluestacks-240.png" alt="Techvents Logo" class="logo">
<img src="images/Techvents-text-removebg-preview.png" alt="Techvents Logo" class="logo-text">
<ul class="main-menu" style="margin-left: 36%;">
<li style="margin-right: 15px;"><a href="Blog.php">Blogs</a></li>
<li style="margin-right: 15px;"><a href="Events.php">Events</a></li>
<li style="margin-right: 15px;"><a href="News.php">News</a></li>
<?php
if(User_Login() || Login()){
echo '<li style="margin-right: 20px;"><a href="Logout.php">Logout</a></li>';
}
else{
echo '<li style="margin-right: 20px;"><a href="Login.php">Login</a></li>';
}
?>
</ul>
<ul class="right-menu">
</ul>
</nav>
</div>
<script>
document.querySelector('.menu-btn').addEventListener(
'click',()=> document.querySelector('.main-menu').classList.toggle('show')
);
</script>
<div class="body-container">
<div class="post-listing">
<?php echo Message(); echo SuccessMessage(); ?>
<?php
$Events = array();
$eventsData;
if(isset($_GET["Type"])){
//Types
// echo "in types";
echo 'Type: <button style=" background-image: linear-gradient(to right top, #2ec771, #4dd163);; padding:8px; border-radius:20px; color:white; border:none; margin-bottom:10px"><b>'.$_GET['Type'].'</b></button>';
$SearchType = $_GET["Type"]." ";
foreach($eventsData as $event)
{
if($event->type1 == $SearchType || $event->type2 == $SearchType)
{
array_push($Events, $event);
}
}
} elseif(isset($_GET["Domain"])) {
//Domain
echo 'Domain: <button style=" background-image: linear-gradient(to right top, #2ec771, #4dd163);; padding:8px; border-radius:20px; color:white; border:none; margin-bottom:10px"><b>'.$_GET['Domain'].'</b></button>';
$SearchDomain = $_GET["Domain"].' ';
foreach($eventsData as $event){
if($event->doamin1 == $SearchDomain || $event->domain2 == $SearchDomain)
{
array_push($Events, $event);
}
}
} else {
//Defualt
$Events = $eventsData;
}
foreach($Events as $event){
if($event->urlToImage == null){
$Image = "uploads/IoT.jpg";
} else { $Image = $event->urlToImage; }
if(strlen($event->title)>75) { $Title = substr($event->title,0,75).".."; }
else { $Title = $event->title; }
?>
<!-- For loop idhar aayega -->
<div class="post-container">
<img src="<?php echo $Image;?>" alt="">
<div class="post-text" id="events">
<div class="first-line">
<h3 class="post-title"><a target="_blank" href="<?php echo $event->url?>"><?php echo $event->title?></a></h3>
<p class="read-time"><?php echo $event->publishedAt;?></p>
</div>
<div class="third-line">
<h4> <?php echo $event->conducted_by?></h4>
</div>
<div class="second-line">
<h6>
Type:
<span class="btn-select"><?php echo $event->type1; ?></span>
<?php
if($event->type2){
echo '<span class="btn-select">'.$event->type2.'</span>';
}
?>
</h6>
<h6>
Domain:
<span class="btn-select"><?php echo $event->doamin1; ?></span>
<?php
if($event->domain2){
echo '<span class="btn-select">'.$event->domain2.'</span>';
}
?>
</h6>
</div>
</div>
</div>
<?php } ?>
</div>
<!-- Right Panel -->
<div class="right-panel">
<!-- About Me -->
<div class="about-me">
<?php
if(isset($_SESSION["Username"])){ ?>
<img src="https://img.icons8.com/ios-filled/150/000000/user-male-circle.png" alt="user-img"/>
<p><b><?php echo $_SESSION["Username"] ?></b></p>
<hr>
<?php
if($_SESSION['Role']=="User"){
echo '<p><a href="dashboard_user.php"> My Dashboard </a></p>';
echo '<p><a href="AddNewPost_User.php"> Write a Post </a></p>';
}
if($_SESSION['Role']=="Admin"){
echo '<p><a href="dashboard.php"> My Dashboard </a></p>';
echo '<p><a href="AddNewPost.php"> Write a Post </a></p>';
}
?>
<?php }
?>
</div>
<!-- Categories -->
<div class="category-container">
<h4>Event Types</h4>
<div class="category-content">
<?php
$eventsData;
foreach($types as $type)
{
if($type){
?>
<span>
<button class="category">
<a href="Events.php?Type=<?php echo $type; ?>"><?php echo $type; ?></a>
</button>
</span>
<?php }} ?>
</div>
</div>
<div class="category-container">
<h4>Domains</h4>
<div class="category-content">
<?php
$eventsData;
foreach($domains as $domain)
{
if($domain){
?>
<span>
<button class="category">
<a href="Events.php?Domain=<?php echo $domain; ?>"><?php echo $domain; ?></a>
</button>
</span>
<?php }} ?>
</div>
</div>
<!-- Recent Posts -->
<div class="recent-posts-container">
<h4>Recent Posts</h4>
<div class="recent-posts-content">
<?php
$ConnectingDB;
$ViewQuery = "SELECT * FROM admin_panel ORDER BY id desc LIMIT 0,5";
$Execute = $Connection->query($ViewQuery);
while($DataRows = $Execute->fetch_assoc()){
$Id = $DataRows["id"];
$Title = $DataRows["title"];
$DateTime = $DataRows["datetime"];
$Image = $DataRows["image"];
if(strlen($DateTime)>11){ $DateTime = substr($DateTime,0,17);}
if(strlen($Title)>11){ $Title = substr($Title,0,40).'...'; }
?>
<div class="recent-postt">
<img src="./uploads/<?php echo htmlentities($Image); ?>" alt="Post-Image">
<div class="recent-post">
<p><a href="FullPost.php?id=<?php echo $Id; ?>"><?php echo htmlentities($Title); ?></a></p>
<p id="time"><?php echo htmlentities($DateTime) ?></p>
</div>
</div>
<?php } ?>
</div>
</div>
</div>
</div>
</body>
</html>