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

  • Home
  • SEARCH
  • 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 4117908
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T22:53:35+00:00 2026-05-20T22:53:35+00:00

My goal is to require login for certain pages. I am using Zend Framework

  • 0

My goal is to require login for certain pages. I am using Zend Framework MVC, and I’m trying to find examples regarding best practices.

Some notes on what I’m looking for:

  • I want non-logged in users to get a login box, and then return to logged in version of the page, once authenticated
  • I want to use dependency injection, and avoid singletons
  • Small code footprint – tie into Zend mvc structure
  • Should login box be a separate controller and do header redirect? How to return to landing page after auth success? An idea to simply call the login controller action to display the login box in the landing page, or is this a disadvantage regarding search engine indexing?
  • Be able to use external library for handling cookies

Or something completely different. I’m fairly new to the Zend framework, and I want to do it ‘the right way’.

  • 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-20T22:53:36+00:00Added an answer on May 20, 2026 at 10:53 pm
    • I want non-logged in users to get a login box, and then return to logged
      in version of the page, once
      authenticated

    Use a FrontController plugin and redirect or forward them to your loginAction.

    • I want to use dependency injection, and avoid singletons

    Zend Framework, doesn’t currently ship any DI system, however, the Zend_Application_Resource_* actually replace it. What kind of dependency would you need here?

    • Small code footprint – tie into Zend mvc structure

    That’s up to you.

    • Should login box be a separate controller and do header redirect? How
      to return to landing page after auth
      success? An idea to simply call the
      login controller action to display the
      login box in the landing page, or is
      this a disadvantage regarding search
      engine indexing?

    I mostly use a special AuthController with LoginAction & LogoutAction. To redirect the user to the page is was trying to view, I always add a returnUrl element in my forms, and I inject the value of the requested URL to be able to redirect the user, and if none, I redirect him to the index/dashboard, depends.

    • Be able to use external library for handling cookies

    Zend_Auth allows you to set your own storage mechanism, so just implement the interface.

    $auth = Zend_Auth::getInstance();
    $auth->setStorage(new My_Auth_Storage());
    

    But never store authentication result in a cookie, it’s so easy to modify it and access your website.

    You may also take a look to one of my previous answer.

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

Sidebar

Related Questions

Goal: Create Photomosaics programmatically using .NET and C#. Main reason I'd like to do
I've recently started learning/using django; I'm trying to figure out a way to have
I'm trying to create a stream of data to the browser using websocket. The
The goal is to have a single-threaded event-driven framework. The end-user will do something
Goal Java client for Yahoo's HotJobs Resumé Search REST API . Background I'm used
My Goal I would like to have a main processing thread (non GUI), and
My goal is to maintain a web file server separately from my main ASP.NET
My goal here is to create a very simple template language. At the moment,
my goal is to write a stored proc that can collect all field values
The goal: To create a .NET dll i can reference from inside SQL Server

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.