I am currently working on password protecting some of my site pages and found that I have to use User Defined Tags to be able to add PHP to my cms pages. I created a tag called pass_protect_files and added the following code:
Code: Select all
// starts sessionen
session_start();
// if there's no session with the right username or password, the login page is shown
if (!isset($_SESSION["login"]) || $_SESSION["login"] !== true) {
header("Location: /db_files/login.php");
exit;
}
// If the session exist, login was successful and the protected pages are shown
I am quite new to PHP and the cms so feel free to explain as if I were 10 years old.

