hi everyone! I am wondering if anyone can point me in the right direction regarding cookies and sessions. What I need to know is this;
I am developing a website that has mixed html and php pages. I am wanting to have "members" where certain web pages are accessible to them. this is not the problem.
the problem comes when I have a member that is logged in - they are great to surf through ANY of the accessible web pages within the site, however, if they want to visit
an html web page within the site..how can i ensure they are still logged in once they again click on an accessible php page without having to re-log back in? If anyone can point me to a great article or tutorial about how to pull this off, i would be so grateful! I have not been webbing long - but long enough to grasp medium techniques.

The server will store "session cookies" and check against that. It doesn't matter if you do from accessible to limited access pages. Every page should have a

session_start();

usually at the top of the page before any other output. Then if it's a limited access page...

session_start();
if(!isset($_SESSION['login'])){
    header("http://www.example.com/home");
    exit;
}

Instead of doing thins every single time in your limited pages, I'd use an include file...

includes/limited.php

    if(!isset($_SESSION['login'])){
        header("http://www.example.com/home");
        exit;
    }

your limited pages

session_start();
require "includes/limited.php";
//rest of page
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.