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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:54:45+00:00 2026-05-28T06:54:45+00:00

In a YII work, I have an init() function which checks whether the session

  • 0

In a YII work, I have an init() function which checks whether the session is set if not redirect to login page.

The problem is that the “login” action is also in the same controller, so it is creating an infinite loop. If I can get the method name in init() function, I can solve this issue.

How I can get the method name in init() function?

  • 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-28T06:54:45+00:00Added an answer on May 28, 2026 at 6:54 am

    Current Controller

    Yii::app()->controller->id 
    

    and
    Current Action

    Yii::app()->controller->action->id
    

    To check action id in all functions other than init(), because init function initializes the controller…

    So the solution for your problem will be let the request come to the actionLogin in your login controller..and there you check if session is not check redirect him from where he is coming..else perform the login action..That way you’ll not face loop problem..

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

Sidebar

Related Questions

I have a Yii dropdown which loads a table of cities, states, zipcodes, lat
I am new to Yii and want to integrate file uploading.Unfortunately I have not
I'm learning Yii and got into url routing problem. I have a controller as
I have a dynamic php (Yii framework based) site. User has to login to
Yii how can i see, which part of code logging a string in Yii
I am using YII framework for my web application . I have a question
I have this register system that doesn't work. Can you please help me!! Also
I have recently made the shift to a framework called the Yii Framework. Really
I know CMap::mergeArray in Yii merges two array. But I have three array and
I am the new user of Yii Framework , Now I have created a

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.