added checked already logged in function #78

Merged
11057122 merged 1 commits from joey-testing into master 2017-01-20 11:54:08 +01:00

View File

@@ -10,6 +10,10 @@
<?php <?php
session_start(); session_start();
if(isset($_SESSION["userID"])){
window.onload=checkLoggedIn();
}
// Define variables and set to empty values // Define variables and set to empty values
$uname = $psw =""; $uname = $psw ="";
$loginErr =""; $loginErr ="";
@@ -42,5 +46,18 @@
/* This view adds login view */ /* This view adds login view */
include("../views/login-view.php"); include("../views/login-view.php");
?> ?>
<script>
function checkLoggedIn() {
if (confirm("You are already logged in!\Do you want to logout?\Press ok to logout.") == true) {
unset($_SESSION["userID"]);
header("Location: login.php");
} else {
header("location: profile.php");
}
document.getElementById("demo").innerHTML = x;
}
</script>
</body> </body>
</html> </html>