PHP Classes

protected page in other directory

Recommend this page to a friend!

      Access user Class  >  All threads  >  protected page in other directory  >  (Un) Subscribe thread alerts  
Subject:protected page in other directory
Summary:access denied
Messages:2
Author:Martin-S
Date:2005-09-28 16:31:09
Update:2005-09-28 19:20:38
 

  1. protected page in other directory   Reply   Report abuse  
Picture of Martin-S Martin-S - 2005-09-28 16:31:09
I Olaf,
First I'd like to say thank's for the great script.

I'm having problem protect page in other directory.
The class is in /users/
the pages to be protected are in /admin/

I use the following code to protect the menu page /admin/index.php

include($_SERVER['DOCUMENT_ROOT']."/users/access_user_class.php");
$test_page_protect = new Access_user;
$test_page_protect->login_page = "../users/login.php";
$test_page_protect->access_page($_SERVER['PHP_SELF'], $_SERVER['QUERY_STRING'],5);
if (isset($_GET['action']) && $_GET['action'] == "log_out"){
$test_page_protect->log_out(); // the method to log off
}

/admin/index.php has a link to other pages: /admin/go.php
protected whit the same code.

/admin/index.php redirect me to the /users/login.php, I then login and the /admin/index.php page load. So far so good.
After accessing the page go.php from the menu page, if I go back to /admin/index.php I get Access denied!

Help please
Thanks,

Martin




  2. Re: protected page in other directory   Reply   Report abuse  
Picture of Olaf Lederer Olaf Lederer - 2005-09-28 19:20:38 - In reply to message 1 from Martin-S
Hi,

I think I know the problem, the object from the admin page is a diiferent one then from the other pages (note teh extension at the top).

Try to put all methods from the admin_user file into the main class.

(I'm not sure that this is the solution, but this would be my first try)