I am in the process of adding modules to a website that have been provided to me and because of the way its set up they are .html files, and they exist within my system which works with php.

As they need to be secure I need to add the following script which is in php to the page, so I thought there might be away of doing the same sort of check but instead with jscript so I can put it to the top of th epage to make it secure.

Code:
<?php
session_start();
//Check whether the session variable SESS_MEMBER_ID is present or not
if(!isset($_SESSION['SESS_MEMBER_ID_2']) || (trim($_SESSION['SESS_MEMBER_ID_2']) == '')) {
header("location: index.php");
exit();
}
?>