added name to header and changing active nav item
This commit is contained in:
parent
b220e68d1a
commit
ce8d56ead0
18
index.php
18
index.php
@ -23,7 +23,6 @@
|
||||
|
||||
</head>
|
||||
|
||||
|
||||
<body>
|
||||
<!-- PARTICLES JS -->
|
||||
<!-- particles.js container -->
|
||||
@ -46,9 +45,6 @@
|
||||
|
||||
<?php #include('segments/_indexTestLoginVals.php'); ?><!-- For forms testing -->
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Welche seite soll geladen werden-->
|
||||
<?php
|
||||
$page = '_404.html';
|
||||
@ -82,16 +78,12 @@
|
||||
require('segments/'.$page);
|
||||
|
||||
?>
|
||||
<div id="footer">
|
||||
<div id="content">
|
||||
<?php
|
||||
if(isset($_SESSION['username'])){
|
||||
echo("<br><span> Herzlich Willkomen " . $_SESSION['username'] . "</span>");
|
||||
}
|
||||
?>
|
||||
<br>
|
||||
<div id="footer">
|
||||
<div id="content">
|
||||
|
||||
<br>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Include the footer-->
|
||||
<?php include('segments/_footer.html'); ?>
|
||||
|
||||
|
@ -2,7 +2,9 @@ window.addEventListener('load', async () => {
|
||||
console.log("Seite geladen");
|
||||
|
||||
//getNewUniqueLink();
|
||||
setActiveNav();
|
||||
document.getElementById('btnCreateTan').addEventListener('click' , async (event) => getNewUniqueLink());
|
||||
|
||||
})
|
||||
|
||||
async function getNewUniqueLink() {
|
||||
@ -45,3 +47,19 @@ function getCookieValue(a) {
|
||||
var b = document.cookie.match('(^|;)\\s*' + a + '\\s*=\\s*([^;]+)');
|
||||
return b ? b.pop() : '';
|
||||
}
|
||||
|
||||
function setActiveNav(){
|
||||
if(window.location.href.indexOf("?") >= 0){
|
||||
if(window.location.href.indexOf("page=home") >= 0){
|
||||
$("#navItemHome").addClass('active');
|
||||
} else if (window.location.href.indexOf("page=newEntry") >= 0){
|
||||
$("#navItemEntry").addClass('active');
|
||||
} else if (window.location.href.indexOf("page=myFriendsBook") >= 0){
|
||||
$("#navItemDashboard").addClass('active');
|
||||
} else if (window.location.href.indexOf("page=newEntry") >= 0){
|
||||
$("#navItemEntry").addClass('active');
|
||||
}
|
||||
} else {
|
||||
$("#navItemHome").addClass('active');
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
<div id="footer">
|
||||
<h1>This is our Footer it foots you :D</h1>
|
||||
<p>This is a paragraph... ya don´t say</p>
|
||||
</div>
|
||||
<footer id="footer" class="footer">
|
||||
<h1>This is our Footer it foots you :D</h1>
|
||||
<p>This is a paragraph... ya don´t say</p>
|
||||
</footer>
|
||||
|
@ -23,10 +23,10 @@
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
<li class="nav-item active">
|
||||
<li id="navItemHome" class="nav-item">
|
||||
<a class="nav-link" href="index.php?page=home">Home <span class="sr-only">(current)</span></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<li id="navItemEntry" class="nav-item">
|
||||
<a class="nav-link" href="index.php?page=newEntry">New Entry</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -25,13 +25,13 @@
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
<li class="nav-item active">
|
||||
<li id="navItemHome" class="nav-item">
|
||||
<a class="nav-link" href="index.php?page=home">Home <span class="sr-only">(current)</span></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<li id="navItemEntry" class="nav-item">
|
||||
<a class="nav-link" href="index.php?page=newEntry">New Entry</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<li id="navItemDashboard" class="nav-item">
|
||||
<a class="nav-link" href="index.php?page=myFriendsBook">My FriendsBook</a>
|
||||
</li>
|
||||
</ul>
|
||||
@ -40,8 +40,15 @@
|
||||
<!-- Button Logout -->
|
||||
<!-- <button id="btnLogout" onclick=window.location.href = 'http://www.google.com' type="button" class="btn btn-secondary">Logout</button> -->
|
||||
|
||||
|
||||
<form action="" method="post">
|
||||
<?php
|
||||
if(isset($_SESSION['username'])){
|
||||
echo('<input class="btn btn-primary" type="button" value="Herzlich Willkommen ' . $_SESSION['username'] . '"></input>');
|
||||
}
|
||||
?>
|
||||
<input class="btn btn-secondary" onClick="window.location.href = 'php/logout.php'" type="button" value="Logout"></input>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</form>
|
||||
|
Loading…
Reference in New Issue
Block a user