会话和歌剧中的重定向 [英] sessions and redirecting in opera

查看:53
本文介绍了会话和歌剧中的重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我过去曾在comp.lang.php发布了类似的问题,但是没有

有任何回复然后呢。因为

然后我在地毯下扫了一下这个问题。但我真的想一劳永逸地解决这个问题。


问题可能与PHP有关,但由于我只使用

PHP开发应用程序,我不是百分百肯定的。因此,我冒昧地将
交叉插入comp.lang.php和alt。 www.webmaster 。我假设这些团体的大部分经常参与开发会议

管理,所以我有点希望你在这个领域的经验可能会如此/>
解决此问题。


问题如下:


网站上的用户个人资料我正在开发将公开发售

通过:


http://www.example.com/profile/view/<username>


用户自己的个人资料(登录后)将通过以下方式提供:

http://www.example.com/profile/view/
http://www.example.com/profile/ (将重定向到最后一个网址)


所以当一个匿名用户访问这两个页面中的一个,请求的

页面作为参考者存储在会话中,并且用户是重定向的d

http://www.example.com / user / login /

提示用户登录。


成功后,它会被重定向到存储的引用者再次提问。我会假设一个相当的

常用程序。


这适用于IE或Firefox(windows)。但是在Opera中我得到了

在数据库中创建的多个会话,其中一个*包含一个

userId但是Opera再次重定向回登录页面。


只有当我手动输入目标网址时,我才能看到登录的

用户个人资料页面。


我的应用程序检查$ _SERVER [''REQUEST_URI'']以确定要向哪个页面发送
。因此,经过大量测试,我认为它可能与

Opera'的favicon请求有关。


但是在定义了额外的RewriteRule之后/>

RewriteRule ^(。*)favicon.ico /images/favicon.gif [NC,L]


在我的.htaccess文件中,问题仍然存在。


你们中是否有人对此问题有所了解?


我明白如果没有看到任何内容,这可能很难解释/>
代码。但由于代码非常广泛,而且我还没有真正缩小到特定的几行,我认为我首先描述的是没有

代码的问题。也许有人有类似的经历,知道

问题是什么。


但是如果你想查看一些代码,我会很乐意在一个

文件共享服务器上放一些,供你查看。 (例如会话包装类和

其他相关代码)。


感谢您的时间和意见。


干杯。


Hello all,

I have posted a similar question in comp.lang.php in the past, but haven''t
had any response to it then. I kinda swept the problem under the rug since
then. But I would really like to resolve this issue once and for all now.

The problem might be PHP related but since I only develop applications using
PHP, I''m not a hundred percent sure. Therefor I''ve taken the liberty to
crosspost to comp.lang.php and alt.www.webmaster. I assume the majority of
frequent contributors of these groups have dealt with developing session
management also, so I''m kind of hoping your experience in this field might
resolve this issue.

The problem is the following:

User profiles on the site I''m developing will be publically available
through:

http://www.example.com/profile/view/<username>

A users own profile (when logged in) will be available through:

http://www.example.com/profile/view/ or
http://www.example.com/profile/ (which will redirect to last url)

So when an anonymous user visits one of these last two pages, the requested
page is stored as a referer in a session and the user is redirected to

http://www.example.com/user/login/

where the user is prompted to login.

On succes it gets redirected to the stored referer url again. A pretty
common procedure I would assume.

This works fine on either IE or Firefox (windows). But in Opera I get
multiple sessions created in the database of which one *does* contains a
userId but Opera redirects back to the login page again.

Only when I manually enter the target url I do get to see the logged in
users profile page.

My application examins $_SERVER[ ''REQUEST_URI'' ] to determine which page to
serve. So, after much testing, I thought it might have something to do with
Opera''s favicon requests.

But after defining an extra RewriteRule

RewriteRule ^(.*)favicon.ico /images/favicon.gif [NC,L]

in my .htaccess file, the problem still persisted.

Are any of you formiliar with this issue?

I understand that this might be difficult to interpret without seeing any
code. But since the code is pretty extensive, and I haven''t really narrowed
it down to a particular few lines, I thought I describe the problem without
code first. Maybe somebody has had similar experiences and knows what the
problem could be.

But if you desire to examine some code, I''ld be happy to put some up on a
filesharing server for you to view. (e.g. the session wrapper class and
other relevant code).

Thank you for your time and input.

Cheers.


推荐答案

_SERVER [''REQUEST_URI'']确定哪个页面要

发球。因此,经过大量测试,我认为它可能与

Opera'的favicon请求有关。


但是在定义了额外的RewriteRule之后/>

RewriteRule ^(。*)favicon.ico /images/favicon.gif [NC,L]


在我的.htaccess文件中,问题仍然存在。


你们中是否有人对此问题有所了解?


我明白如果没有看到任何内容,这可能很难解释/>
代码。但由于代码非常广泛,而且我还没有真正缩小到特定的几行,我认为我首先描述的是没有

代码的问题。也许有人有类似的经历,知道

问题是什么。


但是如果你想查看一些代码,我会很乐意在一个

文件共享服务器上放一些,供你查看。 (例如会话包装类和

其他相关代码)。


感谢您的时间和意见。


干杯。


_SERVER[ ''REQUEST_URI'' ] to determine which page to
serve. So, after much testing, I thought it might have something to do with
Opera''s favicon requests.

But after defining an extra RewriteRule

RewriteRule ^(.*)favicon.ico /images/favicon.gif [NC,L]

in my .htaccess file, the problem still persisted.

Are any of you formiliar with this issue?

I understand that this might be difficult to interpret without seeing any
code. But since the code is pretty extensive, and I haven''t really narrowed
it down to a particular few lines, I thought I describe the problem without
code first. Maybe somebody has had similar experiences and knows what the
problem could be.

But if you desire to examine some code, I''ld be happy to put some up on a
filesharing server for you to view. (e.g. the session wrapper class and
other relevant code).

Thank you for your time and input.

Cheers.





" amygdala" < no ***** @noreply.comschreef in bericht

news:46 *********************** @ news .kpnplanet.nl ..

"amygdala" <no*****@noreply.comschreef in bericht
news:46***********************@news.kpnplanet.nl.. .

Hello all,
Hello all,



< snip>


PS。:我忘了提到,在重定向之前,我*让PHP执行一个

session_write_close()。

<snip>

PS.: I forgot to mention that, before redirecting, I *do* let PHP perform a
session_write_close().


amygdala写道:
amygdala wrote:

问题可能与PHP有关,但由于我只使用

PHP开发应用程序,我不是百分百肯定。因此,我冒昧地将
交叉插入comp.lang.php和alt。 www.webmaster 。我假设这些团体的大部分经常参与开发会议

管理,所以我有点希望你在这个领域的经验可能会如此/>
解决此问题。
The problem might be PHP related but since I only develop applications using
PHP, I''m not a hundred percent sure. Therefor I''ve taken the liberty to
crosspost to comp.lang.php and alt.www.webmaster. I assume the majority of
frequent contributors of these groups have dealt with developing session
management also, so I''m kind of hoping your experience in this field might
resolve this issue.



我不用PHP代码。我在Perl中编写了自己的会话管理程序

。我将基于PHP使用cookie来管理会话的假设来回答。

I don''t code in PHP. I have written my own session management procedures
in Perl. I will answer based on the assumption that PHP uses cookies to
manage sessions.


我正在开发的网站上的用户个人资料公开发售

通过:


http://www.example.com/profile/view/<username>

用户自己的个人资料(登录后)将通过以下方式提供:

http://www.example.com/profile/view/
http://www.example.com/profile/ (将重定向到最后一个网址)


所以当匿名时用户访问最后两页中的一页,请求的

页面在会话中存储为引用,用户被重定向到

http://www.example.com/user/login/


我们在哪里提示用户登录。


成功后,它会再次被重定向到存储的referer url。我会假设一个相当的

常用程序。


这适用于IE或Firefox(windows)。但是在Opera中,我得到了数据库中创建的多个会话,其中一个*包含一个

userId,但Opera再次重定向回登录页面。
User profiles on the site I''m developing will be publically available
through:

http://www.example.com/profile/view/<username>

A users own profile (when logged in) will be available through:

http://www.example.com/profile/view/ or
http://www.example.com/profile/ (which will redirect to last url)

So when an anonymous user visits one of these last two pages, the requested
page is stored as a referer in a session and the user is redirected to

http://www.example.com/user/login/

where the user is prompted to login.

On succes it gets redirected to the stored referer url again. A pretty
common procedure I would assume.

This works fine on either IE or Firefox (windows). But in Opera I get
multiple sessions created in the database of which one *does* contains a
userId but Opera redirects back to the login page again.



(我意识到我没有剪得很好,但我不知道要删除什么

仍然保留我的上下文中的评论。)


再一次,我不知道PHP如何管理会话,但你说的是什么

这里关于Opera对我来说很奇怪。如果PHP使用cookie在浏览器中存储

会话信息,那么应该只有一个

会话。一个cookie不能有多个值。


BTW,浏览器不会在数据库中创建会话。 PHP正在做

。浏览器将会话信息存储在cookie中,其中只有
包含一个值。

(I realize I haven''t snipped very well, but I don''t know what to remove
and still keep my comments in context.)

Again, I don''t know how PHP manages sessions, but what you are saying
here about Opera seems strange to me. If PHP is using a cookie to store
session information in the browser, then there should only be one
session. One cookie can''t have multiple values.

BTW, the browser doesn''t create sessions in the database. PHP is doing
that. The browser stores session information in a cookie, which can only
contain one value.


我的应用程序检查
My application examins


这篇关于会话和歌剧中的重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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