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 1102425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:11:04+00:00 2026-05-17T01:11:04+00:00

I am working on an existing project that has two areas that can be

  • 0

I am working on an existing project that has two areas that can be logged into. An admin section and the front end.

Currently the admin section has a login action and the front end has its own login action. Admin logs in using a database table specifically for admin accounts, the front end is logged in using a different table all together.

If the admin is logged in and tries to then log into the front end they are prompted to log in as a front end user (needed because front end users get completely different content based on projects they are associated with and admin is not associated with one particular project).

Once logged in as a front end user, their admin credentials are gone and they have to log in again if they try to reenter the admin section.

I want to make it so that the admin can be logged into the admin section AND log in as a specific front end user. Thus being able to switch back and forth between the two sections of the site without have to re-login.

What is the best way to handle this within the Zend Framework?

So far I am thinking of losing the separate login actions and having just one (there is no need for two, correct?) and then I have to deal with allowing separate credentials.

Currently, logging in as a front end user results in the admin user having to log back in to access the admin area. Is this because some $_SESSION credential is being overwritten? Do I need to somehow create a custom $_SESSION variable to handle this the ZF way?

Obviously I can’t just directly assign a value to $_SESSION[‘front_end’] or $_SESSION[‘admin’] (which I would have done back in the day) so how would I do this within Zend Framework?

Thanks!

  • 1 1 Answer
  • 1 View
  • 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-17T01:11:05+00:00Added an answer on May 17, 2026 at 1:11 am

    First question, do you really need to do this? Assuming admin users can access all projects, the typical approach to something like this would be to give admins a dropdown on the frontend that lists all projects and allows them to switch between them. Once they’ve selected one this selection is stored in their session and they can view data as if they were logged in as one of those users. They can then switch between projects at will.

    If you really need two logins, this certainly should be possible. By default Zend_Auth uses the class Zend_Auth_Storage_Session for storing the result of authentication in the session. This class uses the session namespace ‘Zend_Auth’ by default (i.e. the data is being stored in $_SESSION['Zend_Auth']), so when your frontend user successfully logs into the admin their session auth data is being overwritten by the result of the admin auth. So what you want to do is get Zend_Auth_Storage_Session to use a different namespace for the admin logins (or a custom namespace for each).

    In theory you should be able to do something like this:

    public function loginAction()
    {
        $auth = Zend_Auth::getInstance();
        if (...) { // check some condition that returns true for admin logins
            // setup storage with custom admin namespace (can be any string)
            $authStorage = new Zend_Auth_Storage_Session('Yourapp_Admin_Auth');
        } else {
            // use defaults
            $authStorage = new Zend_Auth_Storage_Session();
        }
        $auth->setStorage($authStorage);
    
        // carry on login as normal
        [...]
    }
    

    so, what this is doing is getting Zend_Auth to use $_SESSION['Yourapp_Admin_Auth'] for admin logins and the default $_SESSION['Zend_Auth'] for frontend ones.

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

Sidebar

Related Questions

I am working on implementing Zend Framework within an existing project that has a
I am working on implementing Zend Framework within an existing project that has 2
I'm working on an existing project that has a text import tool written in
I'm using Git on a new project that has two parallel -- but currently
I am working in a previously existing grails project that has some search functionality
I've integrated ASP.NET MVC 3 project into existing Web Forms project. It was working
I am currently working on a project which has Employee, Manager entities. At the
I recently joined this organisation that I am currently working at that has asked
I'm working in a C/C++ mixed project that has the following situation. I need
I am working on a web application with an existing code base that has

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.