后退按钮使用户在注销后返回受保护的页面-zend framework [英] back button takes the user back to protected page after logout -zend framework

查看:97
本文介绍了后退按钮使用户在注销后返回受保护的页面-zend framework的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了一个页面登录,注销以访问控制面板 场景如下:用户登录并访问cpanel页面,然后注销 问题:如果用户单击浏览器的后退"按钮完成登录,即使身份验证完成并设置了会话,用户仍返回登录页面,同时如果用户注销,然后单击后退"按钮,它将返回控制面板页面(如果用户刷新页面,那么一切似乎都很好,并且usr将被重定向到login,而后退按钮不会将其重定向到cpanel.

I have created a pages login , logout to access a control panel scenario goes like this: user logs in and accesss the cpanel page and them logs out Problem : when login is done if user click on browser back button user goes back to login page even though authentication is done and sessions are set, at the same time if user logout , and click back button it will return back to control panel page (if user refresh the page then everything seems to be fine and usr will be redirected to login and back button won't redirect her to cpanel ) .

问题是浏览器缓存,我尝试同时使用php标头和html meta来防止页面缓存,但是我无法成功.有什么解决办法吗?

The problem is browser cache , I tried with both php header and html meta to prevent the page from caching but I could not succeed . Any solution to this?

我的注销操作代码如下

public function logoutAction()
      {   
         $auth=Zend_Auth::getInstance();
      //If logged in then move to index
         if(!$auth->hasIdentity()){
           $this->_redirect('admin/account/redirect');

      }
         $auth->clearIdentity();
      $this->_redirect('admin/account/redirect');

   }   

推荐答案

您始终可以运行一段javascript onLoad,使用AJAX请求另一个PHP页面,然后如果用户登录,则将其重定向回CPanel或登录页面,无论他们应该在哪里.

You could always run a piece of javascript onLoad that requests another PHP page using AJAX and then if the user is logged in then redirect them back to the CPanel or Login page, wherever they are supposed to be.

jQuery帖子将很好地处理此问题. http://api.jquery.com/jQuery.post/

JQuery post would handle this quite nicely. http://api.jquery.com/jQuery.post/

这篇关于后退按钮使用户在注销后返回受保护的页面-zend framework的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆