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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T04:27:26+00:00 2026-05-18T04:27:26+00:00

I’m kind of stuck here – I can write a hack to work around

  • 0

I’m kind of stuck here – I can write a hack to work around this but was wondering if there is a proper way to do this.

I am using Zend ACL to specify which pages are protected and require authentication.
For example if the “UploadVideo.php” is a protected page – when a user clicks on a link to access that page – he is taken to the login page and after login is redirected back to UploadVideo.php page. So this all is taken care of and works fine.

Now on this other page – I have something like a “VOTE” button. A user can only cast vote if he is logged in.

Case 1
When the user is logged in – he clicks on the Vote button – I am using Jquery to call the action the following way:

$.post('/video/vote', {video_id:video_id}, function(data) {
if(data=="OK") .....
}

Now /video/vote is a protected resource and since the user is logged in – the vote action gets called which increases the vote count and sends back an “OK” message and the page is dynamically updated with the new vote count.

Case 2
The user is not logged in – he clicks on the vote button – since the page is protected – the login page is returned thru the ajax call in variable “data”
Ideally, when the user is not logged in – the ajax call should not happen
– the user should be redirected to the login page
– after login he shud be redirected to the /video/vote action which will increment the vote count
– and finally sent back to the page with the vote button

How do I handle this. I can write some hacks and check if user is logged in or not and depending upon that decide whether to make ajax call or redirect user but is that the best way to do this.

I dont know if I have clearly explained the problem.

Thanks for your time

  • 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-18T04:27:27+00:00Added an answer on May 18, 2026 at 4:27 am

    There may be a Zend specific way for this I don’t know about, but I can’t think of anything simpler (and cleaner) than

    • Populate a Javascript variable logged_in depending on whether the user is logged in or not

    • Do a check for logged_in when the user clicks the vote button; offer to redirect if they aren’t

    • Redirect to the login page with a target variable containing the current page’s URL (for that, I’m sure, a Zend Framework specific way exists)

    • obviously, keep all server side checks in place. This is just for convenience.

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

Sidebar

Related Questions

No related questions found

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.