File "index.php"
Full Path: /home/custbahd/tourismfraternity.com/admin/counter/get-event/index.php
File size: 8.6 KB
MIME-type: text/html
Charset: utf-8
<section class="latest_blog_area section_gap one three">
<div class="container">
<div class="section_title text-center">
<p class="text-uppercase" style="font-size: 18px;">Find Out</p>
<h2 class="title_color">Upcoming Events</h2>
<hr>
<?php
include_once "../../../admin/counter/db/config.php";
include '../../../admin/db/saucerer.php';
$sql = "SELECT * FROM events WHERE deleted=''";
//use for MySQLi-OOP
$query = $conn->query($sql);
if($query->fetch_assoc()==0){
echo '<p class="text-uppercase" style="font-size: 18px;">No events yet</p>';
echo '<video autoplay loop muted width="300px">
<source src="../image/motion/4.mp4">
<video>';
}
?>
</div>
<div class="row mb_30">
<?php
$sql = "SELECT * FROM events WHERE deleted='' ORDER BY id DESC";
//use for MySQLi-OOP
$query = $conn->query($sql);
while($row = $query->fetch_assoc()){
date_default_timezone_set('Africa/Kampala');
$start_date = $row['start_date'];
$end_date = $row['end_date'];
$start_time = $row['start_time'];
$end_time = $row['end_time'];
$start_count = date("Y-m-d ".$start_time."", strtotime($start_date . "+1 days"));
$end_count = date("Y-m-d", strtotime($end_date . "+1 days"));
$today = date("Y-m-d H:i:s",time());
$start_diff = new DateTimeImmutable($start_count);
$endd_diff = new DateTimeImmutable($row['end_date']);
$duration = $start_diff->diff($endd_diff);
$today_diff = new DateTimeImmutable($today);
$days_diff = $today_diff->diff($start_diff);
if ($row["g_maps"]) {
$g_maps = $row["g_maps"];
} else {
$g_maps = '#!';
}
echo '<div class="col-lg-4 col-md-6 col-sm-8">';
echo '<div class="single-recent-blog-post background-overlay-x-radius">';
echo '<div class="thumb">';
echo '<img class="img-fluid" src="admin/events/images/'.$row["image"].'" alt="'.$row["title"].'">';
echo '<span><a href="#">'.$row["cat"].'</a></span>';
echo '<div class="date-post">';
echo '<p>'.date("jS", strtotime($row["start_date"])).'</p>';
echo '<p>'.date("M", strtotime($row["start_date"])).'</p>';
echo '<p>'.date("Y", strtotime($row["start_date"])).'</p>';
echo '</div>';
echo '<div class="details">';
echo ' <a href="#"><h4 class="sec_h4">'.$row["title"].'</h4></a>';
echo '<p>'.$row["description"].'</p>';
echo '<p><a href="'.$g_maps.'"><i class="fa fa-map-marker mr-1"></i> '.$row["venue"].', '.$row["location"].'</a></p>';
echo '</div>';
echo '</div> ';
echo '<div class="one-footer">';
echo '<div class="row">';
echo '<div class="col-md-2 col-2">';
echo '<i class="fa fa-clock-o"></i>';
echo '</div>';
echo '<div class="col-md-2 col-2">';
if ($days_diff->format('%m')<=0) {
echo '<h4 class="sec_h4">00</h4>';
} elseif ($days_diff->format('%m')<10) {
echo '<h4 class="sec_h4">0'.$days_diff->format('%m').'</h4>';
} else {
echo '<h4 class="sec_h4">'.$days_diff->format('%m').'</h4>';
}
if ($days_diff->format('%m')==1) {
echo '<p>Month</p>';
} else {
echo '<p>Months</p>';
}
echo '</div>';
echo '<div class="col-md-2 col-2">';
if ($days_diff->format('%d')<=0) {
echo '<h4 class="sec_h4">00</h4>';
} elseif ($days_diff->format('%d')<10) {
echo '<h4 class="sec_h4">0'.$days_diff->format('%d').'</h4>';
} else {
echo '<h4 class="sec_h4">'.$days_diff->format('%d').'</h4>';
}
if ($days_diff->format('%d')==1) {
echo '<p>Day</p>';
} else {
echo '<p>Days</p>';
}
echo '</div>';
echo '<div class="col-md-2 col-2">';
if ($days_diff->format('%h')<=0) {
echo '<h4 class="sec_h4">00</h4>';
} elseif ($days_diff->format('%h')<10) {
echo '<h4 class="sec_h4">0'.$days_diff->format('%h').'</h4>';
} else {
echo '<h4 class="sec_h4">'.$days_diff->format('%h').'</h4>';
}
if ($days_diff->format('%h')==1) {
echo '<p>Hour</p>';
} else {
echo '<p>Hours</p>';
}
echo '</div>';
echo '<div class="col-md-2 col-2">';
if ($days_diff->format('%i')<=0) {
echo '<h4 class="sec_h4">00</h4>';
} elseif ($days_diff->format('%i')<10) {
echo '<h4 class="sec_h4">0'.$days_diff->format('%i').'</h4>';
} else {
echo '<h4 class="sec_h4">'.$days_diff->format('%i').'</h4>';
}
if ($days_diff->format('%i')==1) {
echo '<p>Min</p>';
} else {
echo '<p>Mins</p>';
}
echo '</div>';
echo '<div class="col-md-2 col-2">';
if ($days_diff->format('%s')<=0) {
echo '<h4 class="sec_h4">00</h4>';
} elseif ($days_diff->format('%s')<10) {
echo '<h4 class="sec_h4">0'.$days_diff->format('%s').'</h4>';
} else {
echo '<h4 class="sec_h4">'.$days_diff->format('%s').'</h4>';
}
if ($days_diff->format('%s')==1) {
echo '<p>Sec</p>';
} else {
echo '<p>Secs</p>';
}
echo '</div>';
echo '</div>';
echo '</div> ';
echo '</div>';
echo '</div>';
}
?>
</div>
<div align="center" class="mt-5"><a href="events" class="button_hover theme_btn">SEE ALL EVENTS <i class="fa fa-caret-right ml-2 float-bounce-right"></i></a></div>
</div>
</section>