Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

how to login first before see index php

<?php
session_start();
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] == true) {
    $welcomeMessage = "Welcome to the member's area, " . $_SESSION['username'] . "!";
} else {
    header('Location: login.php');
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Index page</title>  
</head>
<body>
<?
    if(!empty($welcomeMessage)) echo $welcomeMessage;
?>
 Index page
</body>
</html>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #login #index #php
ADD COMMENT
Topic
Name
3+9 =