Re: very strange session behavior -- fails on port 80, works on 9090

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Shawn,

thank you so much for your reply.  I think this definitely has me on
the right track.  what i need to figure out now is, is it Apache or
PHP that is switching the domain?  all the code uses relative links
(as far as i can tell... i didn't build this project, i inherited it,
so i'm figuring out the code as i go along).  Like I said in my
original post, I actually have 80 & 9090 pointed to the same dir on
the filesystem, and the same db.  However, as you so astutely pointed
out, the 9090 version doesn't switch to SSL, and I'm guessing that has
to do with our SSL cert?  I'm not sure what part of the code handles
that switch, but am currently digging through that.

Do you know if there's a way for PHP to set cookies for
*.mydomain.com?  In other words, have a cookie be valid for all
subdomains across a domain?  Or, do you have any input on where/who
might be switching the domain (apache, php, client-side?)?

Thanks again!

--fjs--



On Fri, Mar 20, 2009 at 08:35, Shawn McKenzie <nospam@xxxxxxxxxxxxx> wrote:
> Shawn McKenzie wrote:
>> francisco j sanchez wrote:
>>> hello. I have been working on this bug for days now, and have scoured
>>> these forums and the web to no avail. I am fairly new to PHP, so
>>> please forgive me if I don't provide the right info.
>>>
>>> here is the problem:
>>> as of 9 days ago, when someone arrives at a document on our site via
>>> google (or directly to a document on our site via any method), and
>>> they add it to their cart, and then navigate to the cart, it is empty.
>>>  if you navigate around the site first, all is well.
>>>
>>> here is the grand anomaly:
>>> i have the EXACT SAME code running on 80 and 9090 (normally, 9090 is a
>>> testing site pointing to its own directory, but since this bug
>>> surfaced, i've changed things).  The bug can be reproduced over and
>>> over again on 80, and never on 9090.  they are also using the same db.
>>>
>>> here is how to recreate it:
>>> go to http://www.examplemotion.com/legaldoc/view.php/112 and add to
>>> cart.  check the cart by clicking the "Cart" link in the nav.  it is
>>> empty.  now, go to
>>> http://www.examplemotion.com:9090/legaldoc/view.php/112 and add to
>>> cart.  check the cart by clicking the same nav link, and the doc is
>>> there, in the cart.   ???  clear your cookies to reproduce, and, don't
>>> be logged in.
>>>
>>> here is some background:
>>> i am using Qcodo 0.5, PHP 5.2.6, apache 2.2, mysql 14.12.  box and
>>> services hosted by godaddy.  i have reverted the repo (SVN) to a known
>>> working version with the same results.  in any file that you land on,
>>> including view.php, there is a call to
>>> require_once(../includes/prepend.inc.php) which calls session_start().
>>>  although, i understand that is implicit with any $_SESSION['foo']
>>> assignments.  in any case, session_start() should be called within
>>> prepend.inc.php.  the id of the doc is successfully added to the
>>> session variable $_SESSION['cart'] in an array, and can be output to
>>> the page after adding the doc, but when you navigate away (either by
>>> going to the cart directly, or clicking 'checkout'), the session
>>> variable has disappeared.  when clicking on checkout, it should take
>>> you to the register/login page, unless the cart is empty, in which
>>> case you are redirected to the search page.
>>>
>>> please let me know if you need any more information.  any help would
>>> be _very_much_appreciated_!!!
>>>
>>> thanks!
>>>
>>> --fjs--
>>>
>>>
>>
>> It's a cookie problem.  When you visit http://www.examplemotion.com and
>> click add to cart and then click any link it the nav the links in the
>> nav point to http://examplemotion.com (notice the absence of www).  The
>> cookie is per domain and www.examplemotion.com is different than
>> examplemotion.com depending on your settings.
>>
>>
>
> Actually I was mostly correct.  It's not the links in the nav, it's some
> redirect when you click Cart.  In the port 80 ver, the Cart url is
> http://www.examplemotion.com/cart/ however you end up on
> https://examplemotion.com/cart/.  This doesn't happen on your 9090 ver.
>
> Also, to complicate things, on your 80 ver, you are redirected to a
> https address which doesn't happen on the 9090 ver.  I'm not sure how to
> share cookies across http and https, if it happens automatically if the
> domain is the same or if you can't do it at all.
>
> --
> Thanks!
> -Shawn
> http://www.spidean.com
>



-- 
francisco j sanchez

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux