Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6618113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:47:15+00:00 2026-05-25T20:47:15+00:00

I have setup a CRUD area on my frontendAPI.php file (testing my models)… and

  • 0

I have setup a CRUD area on my frontendAPI.php file (testing my models)… and I even managed to secure it. I would like to do this the proper way… I would like to establish a separate directory/ Page for the Admins. Please advise on this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T20:47:16+00:00Added an answer on May 25, 2026 at 8:47 pm

    Still new at this but I’m trying to do the same for a news page, think i’ve got the login part working but having problems with the CRUD (will post a question on it shortly) – i have a table to populate with data from an rss feed (but will be manually populated with a CRUD to start with) and then have a page on the front end to pull out the details using views to format each news story.

    1. Create a new directory called /page/Admin
    2. Create a new file here based on the function e.g. news.php containing

      class page_admin_news extends Page {
      function init(){
          parent::init();
          $p=$this;
      
          $crud=$p->add('CRUD');
      
          $g=$crud->setModel('News');
          if($crud->grid)
                 $crud->grid->addPaginator(30);
          }
      }
      

    3. In Frontend.php, you need to enable the login – for an admin only access, the BasicAuth may be sufficient but there are also classes to use a database to obtain username and password infromation e.g. for a membership site – heres the basic one.
      // If you wish to restrict access to your pages, use BasicAuth class
      $auth=$this->add(‘BasicAuth’)
      ->allow(‘demo’,’demo’)
      ;

    4. You need to modify Frontend.php to enable pages that can be viewed
      without being logged in

      $auth->allowPage('index');
      $auth->allowPage('news');
      $auth->allowPage('links');
      $auth->allowPage('About');
      if (!$auth->isPageAllowed($this->api->page))
      {
         $auth->check();
      }
      
    5. And also in Frontend.php, you need to create a different menu if logged in. Note the login and logout pages dont actually exist.

      if ($auth->isLoggedIn())
      {
        $this->add('Menu',null,'Menu')
          ->addMenuitem('News','admin_news')
          ->addMenuitem('logout')
        ;
      } else {
        $this->add('Menu',null,'Menu')
          ->addMenuitem('News','news')
          ->addMenuitem('Links','links')
          ->addMenuItem('About')
          ->addMenuItem('Login')
          ;
      }
      
    6. When you login, it goes to page/index.php by default so if you want it to redirect to a particular page when you log in so you can add this to page/index.php

      class page_index extends Page {
      function init(){
        parent::init();
        $p=$this;
      
        if($this->api->auth->isLoggedIn())
          $this->api->redirect('admin_news');
      

    Hope that helps.

    Trev

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have setup a property and implement INotifyPropertyChanged like so... public event PropertyChangedEventHandler PropertyChanged;
I have setup svnserve and for now now I am testing a repository with
I have setup file of winform. but i want to change my icon how
I have setup the following header file to create a Stack which uses an
i have setup a profanity filter with bad words in a XML file and
I have setup an .htaccess and .htpasswd file correctly and my password gets accepted,
I have an existing database (PostgreSQL in my case), and would like to access
I have a simple C (of CRUD) function, and I'd like to send a
I have a fairly large CRUD winform app that is set up to display
I have setup web dav on windows server 2008. It seems to work fine

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.