This topic is locked

Protect Non-PHP Runner pages

10/8/2007 6:05:12 AM
PHPRunner General questions
buddy author

I am using the PHPRunner to handle member profile information. We are currently using a PHP CMS system for our site and like the flexibility of PHP runner to handle our advance profile needs.
What I would like to accomplish is that certain pages on the main site utilize the security of the PHPRunner system.
For instance
The healthcare provider page is only accessable to those members who are logged in and have HCP group priviledges.
I'm fairly new at PHP sessions and am not sure how to accomplish this.
Thanks for the help in advance.

Sergey Kornilov admin 10/8/2007

Here is the PHP code snippet that needs to be added to the beginning of each PHP page you like to protect:

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

{

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

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

return;

}

if(!CheckSecurity(@$_SESSION["_".$strTableName."_OwnerID"],"Search") && !CheckSecurity(@$_SESSION["_".$strTableName."_OwnerID"],"Add"))

{

echo "<p>You do not have permissions to access this page <a href=\"login.php\">Back to login page</a></p>";

return;

}