<?php
session_start();
//datubāzes konfigurācija, saglabājot tos datus mainīgajos
$dbservername = "localhost";
$dbusername = "gamizoge_admins";
$dbpassword = "^uuem[j6kjJ#";
$dbname = "gamizoge_Forums";

// pieslēgties datubāzei
$db = new mysqli($dbservername, $dbusername, $dbpassword, $dbname);
//saglabā esošās sesijas lietotājvārdu mainīgajā
$username = $_SESSION['username'];

// atlasa kolumnu verified no tabulas users kur lietotājvārds ir saglabātais esošais mainīgais
$sql = "SELECT verified FROM users WHERE username='$username'";
$result = $db->query($sql);
$row = $result->fetch_assoc();
// ja tabulas dati no verified NAV 'Y', tad sesiju pamet, noņem nost esošās sesijas lietotājvārdu un aiziet atpakaļ uz login.php lapu
if ($row["verified"] !== 'Y')
{
    session_destroy();
    unset($_SESSION['username']);
    header("location: login.php");
}   // ja nav lietotājvārds, tad parāda ziņu un aiziet uz lapu login.php
if (!isset($_SESSION['username']))
{
    $_SESSION['msg'] = "Jums no sākuma jāpieslēdzas.";
    header('location: login.php');
}
// ja piespiesta poga logout, tad sesiju pamet, noņem nost esošās sesijas lietotājvārdu un aiziet atpakaļ uz login.php lapu
if (isset($_GET['logout']))
{
    session_destroy();
    unset($_SESSION['username']);
    header("location: login.php");
}

?>
<!DOCTYPE html>
<html>
<title>GAMINGFOREVER</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Raleway">
<style>
body,h1,h2,h3,h4,h5 {font-family: "Raleway", sans-serif}
</style>
<body class="w3-light-grey">
    <header class="w3-container w3-dark-grey w3-padding-32 w3-margin-top" style="margin-top:0px!important; text-align: center; background-color: black!important;padding-top: 0px!important;padding-bottom: 0px!important;">
 	<h1 style="font-size: 100px;margin: 0px 0px 0px 0px;">GAMINGFOREVER</h1>
</header>
<header class="w3-container w3-dark-grey w3-padding-32 w3-margin-top" style="margin-top:0px!important; text-align: center; background-color: black!important;padding-top: 0px!important;padding-bottom: 0px!important;">
 	<ul style="list-style-type: none;margin-bottom:10px!important;margin-top:0px!important;padding-left: 0px!important;">
  <li style="display: inline;font-size: 20px;padding-right: 20px!important;"><a href="index.php">SĀKUMLAPA</a></li>
  <li style="display: inline;font-size: 20px;padding-right: 20px!important;"><a href="forumi.php">FORUMI</a></li>
  <li style="display: inline;font-size: 20px;padding-right: 20px!important;"><a href="noteikumi.php">NOTEIKUMI</a></li>
  <li style="display: inline;font-size: 20px;padding-right: 20px!important;"><a href="parmums.php">PAR MUMS</a></li>
  <li style="display: inline;font-size: 20px;padding-right: 20px!important;"><a href="kontakti.php">KONTAKTI</a></li>
</ul>
</header>
<div class="w3-content" style="max-width:1400px">

<div class="w3-row">
<!-- Blog entries -->
<div class="w3-col l8 s12">
  <!-- Blog entry -->
  <div class="w3-card-4 w3-margin w3-white">
    <video src="images/background.mp4" alt="Nature" style="width:100%" autoplay muted loop>
	</video>
    <div class="w3-container">
      <h3><b>Sveicināti GAMINGFOREVER Forumā !</b></h3>
    </div>
  </div>
  <hr>

  <!-- Blog entry -->
  <div class="w3-card-4 w3-margin w3-white">
    <div class="w3-container">
    </div>
    <div class="w3-container">
<div class="row">
  <div class="column" style=" float: left;
  width: 50%;">
   <a href="https://gamingforever.xyz/fortnite.php"><ul class="w3-ul w3-hoverable w3-white">
      <li class="w3-padding-16">
        <img src="ikonas/fortnite.png" alt="FT Image" class="w3-left w3-margin-right" style="width:50px">
        <span class="w3-large">Fortnite</span><br>
        <span>Forums tikai par un ap spēli Fortnite.</span>
      </li></a>
      <a href="https://gamingforever.xyz/counterstrike.php"><ul class="w3-ul w3-hoverable w3-white">
      <li class="w3-padding-16">
        <img src="ikonas/counterstrike.png" alt="CS Image" class="w3-left w3-margin-right" style="width:50px">
        <span class="w3-large">Counter-Strike</span><br>
        <span>Forums tikai par un ap spēli Counter-Strike.</span>
      </li></a>
       <a href="https://gamingforever.xyz/farcry.php"><ul class="w3-ul w3-hoverable w3-white">
      <li class="w3-padding-16">
        <img src="ikonas/farcry.png" alt="farcry Image" class="w3-left w3-margin-right" style="width:50px">
        <span class="w3-large">Far Cry</span><br>
        <span>Forums tikai par un ap spēli Far Cry.</span>
      </li></a>
  </div>
  <div class="column" style=" float: left;
  width: 50%;">
   <a href="https://gamingforever.xyz/fear.php"><ul class="w3-ul w3-hoverable w3-white">
      <li class="w3-padding-16">
        <img src="ikonas/logofeaar.png" alt="Fear Image" class="w3-left w3-margin-right" style="width:50px">
        <span class="w3-large">Fear</span><br>
        <span>Forums tikai par un ap spēli Fear.</span>
      </li></a>
      <a href="https://gamingforever.xyz/gta.php"><ul class="w3-ul w3-hoverable w3-white">
      <li class="w3-padding-16">
        <img src="ikonas/gtalogo.png" alt="GTA Image" class="w3-left w3-margin-right" style="width:50px">
        <span class="w3-large">GTA</span><br>
        <span>Forums tikai par un ap spēli Grand Theft Auto.</span>
      </li></a>
       <a href="https://gamingforever.xyz/mafia.php"><ul class="w3-ul w3-hoverable w3-white">
      <li class="w3-padding-16">
        <img src="ikonas/mafialogo.png" alt="Mafia Image" class="w3-left w3-margin-right" style="width:50px">
        <span class="w3-large">Mafia</span><br>
        <span>Forums tikai par un ap spēli Mafia.</span>
      </li></a>
  </div>
</div>
    </div>
  </div>
<!-- END BLOG ENTRIES -->
</div>

<!-- Introduction menu -->
<div class="w3-col l4">
  <!-- About Card -->
  <div class="w3-card w3-margin w3-margin-top">
      <a href="https://gamingforever.xyz/index.php">
  <img src="images/logo.png" style="width:100%"></a>
    <div class="w3-container w3-white">
        	<?php if (isset($_SESSION['success'])) : ?>
      <div class="error success" >
      	<h3>
          <?php 
          	echo $_SESSION['success']; 
          	unset($_SESSION['success']);
          ?>
      	</h3>
      </div>
  	<?php endif ?>
    <!-- logged in user information -->
    <?php  if (isset($_SESSION['username'])) : ?>
    	<p>Sveicināts - <strong><?php echo $_SESSION['username']; ?></strong></p>
    	<form action="index.php?logout='1'" class="lout">
		<button class="logout" name="logout">Izlogoties</button>
		</form>
    <?php endif ?>
	<form method="post" class="lout">
	<?php
/* LAIKS */
date_default_timezone_set("Europe/Riga");
$today = date("H:i:s");
echo "Laiks Rīgā: ";
echo $today;
echo "<br>";
echo date_default_timezone_get();
?>
    </div>
  </div><hr>
  
  <!-- Posts -->
  <div class="w3-card w3-margin">
    <div class="w3-container w3-padding">
      <h4>Populārākie forumi</h4>
    </div>
    <a href="https://gamingforever.xyz/fortnite.php"><ul class="w3-ul w3-hoverable w3-white">
      <li class="w3-padding-16">
        <img src="ikonas/fortnite.png" alt="FT Image" class="w3-left w3-margin-right" style="width:50px">
        <span class="w3-large">Fortnite</span><br>
        <span>Forums tikai par un ap spēli Fortnite.</span>
      </li></a>
      <a href="https://gamingforever.xyz/counterstrike.php"><ul class="w3-ul w3-hoverable w3-white">
      <li class="w3-padding-16">
        <img src="ikonas/counterstrike.png" alt="CS Image" class="w3-left w3-margin-right" style="width:50px">
        <span class="w3-large">Counter-Strike</span><br>
        <span>Forums tikai par un ap spēli Counter-Strike.</span>
      </li></a>
       <a href="https://gamingforever.xyz/farcry.php"><ul class="w3-ul w3-hoverable w3-white">
      <li class="w3-padding-16">
        <img src="ikonas/farcry.png" alt="farcry Image" class="w3-left w3-margin-right" style="width:50px">
        <span class="w3-large">Far Cry</span><br>
        <span>Forums tikai par un ap spēli Far Cry.</span>
      </li></a>
     
    </ul>
  </div>
  <hr> 
 
 <!-- Labels / tags -->
  <div class="w3-card w3-margin" style=>
  <img src="images/tanks.png" style="width: 100%;height: 100%;object-fit: contain;">
  </div>
  
<!-- END Introduction Menu -->
</div>

<!-- END GRID -->
</div><br>

<!-- END w3-content -->
</div>

<!-- Footer -->
<footer class="w3-container w3-dark-grey w3-padding-32 w3-margin-top" style="margin-top:0px!important; text-align: center; background-color: black!important;padding-top: 10px!important;padding-bottom: 30px!important;">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
* {
  box-sizing: border-box;
}

/* Create three equal columns that floats next to each other */
.column {
  float: left;
  width: 33.33%;
  padding: 10px;
}

/* Clear floats after the columns */
.row:after {
  content: "";
  display: table;
  clear: both;
}
</style>
</head>
<body>
<div class="row">
  <div class="column" style="position:relative;">

  </div>
  <div class="column" style="min-width:200px;position:relative;">
    <h1 style="margin: 30px 0px 0px 0px;">GAMINGFOREVER</h1>
  </div>
  <div class="column" style="text-align: right; min-width:200px;position:relative;">
    <p style="margin: 25px 0px 0px 0px;">Autortiesības Kristaps Švīpis<br>
Jelgavas Tehnikums<br>
e-pasts - forums@gamingforever.xyz<br></p>
  </div>
</div>

</footer>

</body>
</html>
