added checked already logged in function #78
@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user