не могу поставить куки

Discussion in 'PHP' started by Дикс, 10 Apr 2009.

  1. Дикс

    Дикс Elder - Старейшина

    Joined:
    16 Apr 2006
    Messages:
    1,194
    Likes Received:
    227
    Reputations:
    26
    создал в апаче два вирт. хоста:
    golem.tbilet
    и
    tbilet

    на первом ставлю куку:

    setcookie("sessionid", "значение", time() + 60*60*24*10, "/", ".tbilet", 0);

    но она ставится только для golem.tbilet, а для .tbilet - не ставится, хотя функция возвращает 1

    в чем тут может быть дело??
     
  2. astrologer

    astrologer Elder - Старейшина

    Joined:
    30 Aug 2007
    Messages:
    837
    Likes Received:
    267
    Reputations:
    59
    Представь, что у тебя было бы не tbilet, а ru, com или org, например.
     
  3. Дикс

    Дикс Elder - Старейшина

    Joined:
    16 Apr 2006
    Messages:
    1,194
    Likes Received:
    227
    Reputations:
    26
    бляцтво, оказывается надо было вешать секурный вирт. хост на то же имя, но другой порт.
    т.е. рабочая стуктура такая:

    tbilet - главный сайт
    tbilet:443 - ССЛ, для авторизации и прочей хрени
     
  4. Дикс

    Дикс Elder - Старейшина

    Joined:
    16 Apr 2006
    Messages:
    1,194
    Likes Received:
    227
    Reputations:
    26
    astrologer
    и че? локальному апачу и пхп плевать на длину имени хоста
     
  5. astrologer

    astrologer Elder - Старейшина

    Joined:
    30 Aug 2007
    Messages:
    837
    Likes Received:
    267
    Reputations:
    59
    Дело не в длине.
    Code:
    4.3.2  Rejecting Cookies
    
       To prevent possible security or privacy violations, a user agent
       rejects a cookie (shall not store its information) if any of the
       following is true:
    
       * The value for the Path attribute is not a prefix of the request-
         URI.
    
       * The value for the Domain attribute contains no embedded dots or
         does not start with a dot.
    
       * The value for the request-host does not domain-match the Domain
         attribute.
    
       * The request-host is a FQDN (not IP address) and has the form HD,
         where D is the value of the Domain attribute, and H is a string
         that contains one or more dots.
    
       Examples:
    
       * A Set-Cookie from request-host y.x.foo.com for Domain=.foo.com
         would be rejected, because H is y.x and contains a dot.
    
       * A Set-Cookie from request-host x.foo.com for Domain=.foo.com would
         be accepted.
    
       * A Set-Cookie with Domain=.com or Domain=.com., will always be
         rejected, because there is no embedded dot.
    
       * A Set-Cookie with Domain=ajax.com will be rejected because the
         value for Domain does not begin with a dot.
    2109, 4.3.2 Rejecting Cookies
    2965, 3.3.2 Rejecting Cookies