This topic is locked
[SOLVED]

 password protect a specific page

5/19/2007 6:32:56 AM
PHPRunner General questions
P
providence author

Hi, just wondering can I use phprunner to password protect a specific page without users being able to access the page directly without login?
sorry if it sounds dumb, Im kind of new to these stuff.
I've tried using the security feature of Phprunner for the login page, and added an event that it goes to index2.html after successful login. that part works.

but users can just type in www.mysite.com/index2.html and see the page.

Sergey Kornilov admin 5/19/2007

You cannot protect HTML page.
Rename your page to index2.php and add the following code snippet in the beginning of the page:

<?php

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

{

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

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

return;

}

?>