This topic is locked

PHPRunner page protection

7/7/2006 11:34:30 PM
PHPRunner General questions
G
gwhite author

I was given this code to place in my php pages to use as a form of page protection. Meaning after a user logins in, they can visit certain pages and a person not logged in will automatically be sent to the login page.

But it is not working. The site does have certain directories now protected by htaccess and there is an htmaster file. I tried using a directory that was not being protected by htacces, but it still does not work. Here is the code...
[<?php

if(!@$_SESSION["UserID"])

{

$_SESSION["MyURL"]=$_SERVER["SCRIPT_NAME"]."?".$_SERVER["QUERY_STRING"];

header("Location: login.php?message=expired");

return;

}

?>]
without the brackets of course.
This code is also in most if not all of the normal php pages created by PHPRunner.
The rest of the page is just regular html and this code is placed at the very top of the page.
Anyone know why this does not work?
Thanks.
Gene

Alexey admin 7/10/2006

Gene,
make sure that the extension of your pages is .PHP.

Otherwise they won't be processed bt PHP.
If your pages are .PHP files try to put this line just before your code:

<?

session_start();

if(!@$_SESSION["UserID"])

...