流动:
- user visits a page say www.mysite.com/somepage/1
- user clicks on Log Out button or times out and logs out
*user log out detected redirect to home page but save the referer URL
*redirect to /login?ref=$_SERVER['HTTP_REFERER'] (actual code test if its set)
- user sees login page and relogs back
- user is redirected back to refere url that is saved in $_GET['ref']
aboe 流程非常适合第一个浏览器选项卡,如果用户打开了多个选项卡$_GET['ref']
,则设置为为第一个选项卡设置的相同 URL。例如:
例子:
Tab 1 : /somepage/hello/world
Tab 2: /another/page/1
当用户从Tab 1注销时被重定向到:
/login?ref=http://site.com/somepage/hello/world (CORRECT)
如果用户刷新选项卡 2上的页面,则会重定向到:
/login?ref=http://site.com/somepage/hello/world
NOT CORRECT, IT SHOULD REDIRECT TO:
/login?ref=http://site.com/another/page/1