I have this written at the very first line on every page of my website.
include(\"restd.php\");
and restd.php contains the following lines
you need declare $_SESSION['id'] :
$_SESSION['id']
file1.php
session_start(); $_SESSION['id'] = '123'
file2.php
include 'file1.php' if(isset($_SESSION['id'])) { } else { header("location:index.php"); }