Forum Moderators: coopster
In my login script on a successful login I set the session variable for valid user.
$valid_user = $username;
session_register("valid_user");
Then in my other pages I want to test if the session variable is set otherwise send them to the login page.
<?php
session_start();
error_reporting(E_ALL);
if (!isset($_SESSION['valid_user']) {
header("Location:members.htm");
exit;
}
?>
This is the code I'm trying to put at the top of my pages.
It works if the page I'm going to is a php extension page, but if it is an htm page it seems to ignore it.
I also tried using cookies, but haven't had much luck with them either.
Any suggestions are appreciated.
AddHandler application/x-httpd-php .php .htm
and get this error on my php page
HTTP 405 - Resource not allowed
Internet Explorer
I have also tried adding
AddType application/x-httpd-php .php .htm
This option takes my htm file with embedded php and displays the page, but does not execute the php. I viewed the source and I see the php code, but it should have redirected me since I was accessing the page with no session variables set.
See above for code that was added to the htm page.
We are here speaking about modifying your HTTPD.conf file.
Do some search about it to get an idea on "How to"
BE AWARE: If you new config is somehow wrong you might (after restarting your server) Be looking at blank pages!
As such you need to contact your ISP for guidance.
AddType x-mapp-php4 .html .htm
My only concern would be when and if they upgrade to another version of php I'm assuming this statement would have to change (i.e. php5)
Thanks for your patience and hope this helps someone else using oneandone and hosting server.