function protect_page() { if (loged_in() === false) { header("Location: protected.php"); exit; } }
<?php include 'core/init.php'; include 'includes/overall/header.php'; ?> <div class="col-sm-9"> <?php if (isset($_GET['success'])) { echo '<div class="alert alert-success">You\'ve been registered successfully. Verification URL sent your Email Address.</div>'; } ?> <h1>Home</h1> <hr> <div>Just a template</div> <?php if (loged_in()) { echo '<div>Loged in</div>'; } else { echo '<div>Not loged in</div>'; } ?> </div><!--end blog-main --> <?php include 'includes/overall/footer.php';
<?php session_start(); require 'database/connect.php'; require 'functions/general.php'; require 'functions/users.php'; if (loged_in() === true) { $session_user_id = $_SESSION['user_id']; //$get_user_data = get_user_data($session_user_id, 'user-id', 'username', 'first_name', 'last_name', 'email'); $user_data = user_data($session_user_id); if (user_active($user_data['username']) === false) { session_destroy(); header('Locatoin: index.php'); exit; } //echo $user_data['username']; } $errors = array();