Here is what I suggest:
Create a page called secure.php
add the following code as it is: ONLY change " your_login_page "
<?php
session_start();
if (empty($_SESSION['username']))
{
header("location:your_login_page.php");
exit;
}
?>
Then in your other pages that you want secure, add:
<?php
require_once('secure.php');
?>
here is what i have on my login page...:
[ICODE=php]$_SESSION['username'] = $_POST['user'];
$_SESSION['password'] = $md5pass;
logininfo();
header("Location: apHome.php"); [/ICODE=php]
here is what i have on my home page...:
[code=php]
<?php
session_start();
include('./connect.php');
if (isset($_SESSION['username']))
{
$name = $_SESSION['username'];
}
?>
[/code=php]
i have other pages linked from this homepage, and i want to include them in this session ( so that even if i type the direct link in the address bar, i would ot be able to access the page)...
Reputation Points: 12
Solved Threads: 5
Junior Poster in Training
Offline 74 posts
since Jan 2008