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.
<?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();
}
?>
jScript only runs in Internet Explorer 9 and earlier.
There’s no equivalent to that PHP code in either jScript or JavaScript as it is something that must be run on the server.
The best solution would be to configure your server to allow it to run PHP on all the .html pages so you can add the code there. If your site is running on Apache then you just need to add one line to the .htaccess file to do this.
[QUOTE=felgall;5613084The best solution would be to configure your server to allow it to run PHP on all the .html pages so you can add the code there.[/QUOTE]
This seems the best solution, so basically I can then just add the php in as normal at the top of the page, and that will allow it to run.
Cheers
Right OK, so put all those .html files above the root level, and then when calling them, link the link the users uses to see them, to a new .php page with at the top of the page.
Sorry to be a little silly hear too, but how do I call files outside the root level instead of [COLOR=#DD0000][FONT=Courier New]‘http://www.example.com/[/FONT][/COLOR]’ I’m guessing?