会话和域名 [英] sessions and domain names

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

问题描述

大家好。我有一个应用程序在

成功登录后将用户ID转储到会话中。登录页面是 http://www.mydomain.com/login.php


如果用户在没有www的情况下访问我网站上的网页(例如,
http://mydomain.com/foo.php) ,会话正常,登录状态为

维护。


如果他访问了 http://www.mydomain.com /foo.php ,该应用程序放弃了

登录状态。


任何想法如何解决这个问题?我正在运行php 4.4.1 w / linux apache。

解决方案

" magic_hat60622" < ma ************ @ yahoo.com写了留言

新闻:11 ****************** ***@i3g2000cwc.googlegrou ps.com ...


大家好。我有一个应用程序在

成功登录后将用户ID转储到会话中。登录页面是 http://www.mydomain.com/login.php


如果用户在没有www的情况下访问我网站上的网页(例如,
http://mydomain.com/foo.php) ,会话正常,登录状态为

维护。


如果他访问了 http://www.mydomain.com /foo.php ,该应用程序放弃了

登录状态。


任何想法如何解决这个问题?我正在运行php 4.4.1 w / linux apache。



会话数是每个域名。对于 www.mydomain.com ,有一个会话,并且

mydomain.com还有另一个。将所有用户从 www.mydomain.com 重定向到

mydomain。 com或反之亦然。确保域始终相同。所以

它在途中没有变化。这样他们将总是使用相同的

会话。


-

" Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
http://outolempi.net/ahdistus/ - Satunnaisesti p ?ivittyv? nettisarjis
sp**@outolempi.net | rot13(xv *** @ bhgbyrzcv.arg)


文章< 6a ***************** @ reader1 .news.jippii.net>,
sp**@outolempi.net 说...


会话数是每个域名。对于 www.mydomain.com ,有一个会话,并且

mydomain.com有另一个



会话应该是与特定主机的会话。


其实PHP如果你查看PHPSESSID,它会使用会话的主机名,但它会错误地输入域名。因此他的问题。


现在所有的域名正在使用AND注册而没有

特定服务名称(WWW FTP等) - IE作为主机名 - 这将是

对于PHP来说是个大问题,如果它很快就没有排序了。


你可以从历史上看到为什么这个错误并不重要但是在域名注册业务中改变了b
现在这很重要。

交易。


我很惊讶它没有更普遍的报道。我已经看过有关神秘失败的电子商务网站的报道,我根本不会这样做。如果没有连接,我会感到惊讶。


re****@otherlips.com 写道:
< blockquote class =post_quotes>
文章< 6a ***************** @ reader1.news.jippii.net>,
sp ** @ outolempi.net 说...


>>会话是每个域名。对于 www.mydomain.com ,有一个会话,对于
mydomain.com还有其他的




会话应该是与特定主机的会话。


其实PHP如果你查看PHPSESSID,它会使用会话的主机名,但它会错误地输入域名。因此他的问题。


现在所有的域名正在使用AND注册而没有

特定服务名称(WWW FTP等) - IE作为主机名 - 这将是

对于PHP来说是个大问题,如果它很快就没有排序了。


你可以从历史上看到为什么这个错误并不重要但是在域名注册业务中改变了b
现在这很重要。

交易。


我很惊讶它没有更普遍的报道。我已经看过有关神秘故障的电子商务网站的报道,我根本不会这样做。如果没有关联,我会惊讶于b $ b。



example.com和 www.example。根据定义,com 是两个不同的主机。

他们解析到同一物理服务器的事实并不重要。 PHP

在操作中100%正确。


-

=========== =======

删除x来自我的电子邮件地址

Jerry Stuckle

JDS计算机培训公司
js ******* @ attglobal.net

==================

Hi all. I''ve got an app that dumps a user id into a session after
successful login. the login page is http://www.mydomain.com/login.php.

If the user visits pages on my site without the www (i.e.,
http://mydomain.com/foo.php), the session works fine and login state is
maintained.

If he visits http://www.mydomain.com/foo.php, the app drops the
logged-in state.

Any idea how to fix this? I''m running php 4.4.1 w/ linux apache.

解决方案

"magic_hat60622" <ma************@yahoo.comwrote in message
news:11*********************@i3g2000cwc.googlegrou ps.com...

Hi all. I''ve got an app that dumps a user id into a session after
successful login. the login page is http://www.mydomain.com/login.php.

If the user visits pages on my site without the www (i.e.,
http://mydomain.com/foo.php), the session works fine and login state is
maintained.

If he visits http://www.mydomain.com/foo.php, the app drops the
logged-in state.

Any idea how to fix this? I''m running php 4.4.1 w/ linux apache.


Sessions are per domain. For www.mydomain.com there is one session, and for
mydomain.com there is another. Redirect all users from www.mydomain.com to
mydomain.com or vice versa. Make sure the domain is always the same. so that
it doesn''t change on the way. That way they will always use the same
session.

--
"Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
http://outolempi.net/ahdistus/ - Satunnaisesti p?ivittyv? nettisarjis
sp**@outolempi.net | rot13(xv***@bhgbyrzcv.arg)


In article <6a*****************@reader1.news.jippii.net>,
sp**@outolempi.net says...

Sessions are per domain. For www.mydomain.com there is one session, and for
mydomain.com there is anothe

A session is supposed to be a session with a particular host.

Actually PHP uses host names for sessions if you look in PHPSESSID but it
puts the domain name in by mistake. Hence his problem.

Now that all "domains" are being registered both with AND without the
particular service name (WWW FTP etc) - IE as host names - this is going
to be a big problem for PHP if it isn''t sorted real soon.

You can see historically why the bug hasn''t mattered but things have
changed in the domain registration business and now it matters a great
deal.

I''m suprised it hasn''t been reported more generally. I''ve seen reports on
ecommerce web sites about mysterious failures, I wouldn''t be at all
suprised if this wasn''t connected.


re****@otherlips.com wrote:

In article <6a*****************@reader1.news.jippii.net>,
sp**@outolempi.net says...

>>Sessions are per domain. For www.mydomain.com there is one session, and for
mydomain.com there is anothe



A session is supposed to be a session with a particular host.

Actually PHP uses host names for sessions if you look in PHPSESSID but it
puts the domain name in by mistake. Hence his problem.

Now that all "domains" are being registered both with AND without the
particular service name (WWW FTP etc) - IE as host names - this is going
to be a big problem for PHP if it isn''t sorted real soon.

You can see historically why the bug hasn''t mattered but things have
changed in the domain registration business and now it matters a great
deal.

I''m suprised it hasn''t been reported more generally. I''ve seen reports on
ecommerce web sites about mysterious failures, I wouldn''t be at all
suprised if this wasn''t connected.

example.com and www.example.com are, by definition, two different hosts.
The fact they resolve to the same physical server is immaterial. PHP
is 100% correct in its operation.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================


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

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