Get values for ALL cookies?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Adam

    Get values for ALL cookies?

    I'm trying to track who's logged into a site (without setting flags in
    the databses).

    At the moment, each user gets a cookie with "Usr_Name" set if
    authentication goes through OK.

    Is there a way of looping through ALL the values of a particular
    cookie, eg $_COOKIE['Usr_Name'] ... that would give me an output of
    (say):

    Fred
    Doris
    Bert
    etc.

    TIA,

    Adam.
  • Alexey Kulentsov

    #2
    Re: Get values for ALL cookies?

    Adam wrote:[color=blue]
    > I'm trying to track who's logged into a site (without setting flags in
    > the databses).[/color]
    In php script you have cookies for only current user so you can't do
    it without database (SQL or text - doesn't matter)
    [color=blue]
    > At the moment, each user gets a cookie with "Usr_Name" set if
    > authentication goes through OK.
    >
    > Is there a way of looping through ALL the values of a particular
    > cookie, eg $_COOKIE['Usr_Name'] ... that would give me an output of
    > (say):
    >
    > Fred
    > Doris
    > Bert
    > etc.[/color]

    1. Use session for logging users
    2. Make database-driven session handler
    3. Now you can get list of users by regular SQL query.

    You can also parse session files in /tmp directory instead of making
    database-driven handler but I don't think it's good way.

    Comment

    • Adam

      #3
      Re: Get values for ALL cookies?

      On Mon, 12 Sep 2005 10:08:29 +0300, Alexey Kulentsov wrote:
      [color=blue]
      >Adam wrote:[color=green]
      >> I'm trying to track who's logged into a site (without setting flags in
      >> the databses).[/color]
      > In php script you have cookies for only current user so you can't do
      >it without database (SQL or text - doesn't matter)
      >[color=green]
      >> At the moment, each user gets a cookie with "Usr_Name" set if
      >> authentication goes through OK.
      >>
      >> Is there a way of looping through ALL the values of a particular
      >> cookie, eg $_COOKIE['Usr_Name'] ... that would give me an output of
      >> (say):
      >>
      >> Fred
      >> Doris
      >> Bert
      >> etc.[/color]
      >
      > 1. Use session for logging users
      > 2. Make database-driven session handler
      > 3. Now you can get list of users by regular SQL query.[/color]

      I was trying to avoiid touching the current database, but I'll add a
      table if I really have to.
      [color=blue]
      >You can also parse session files in /tmp directory instead of making
      >database-driven handler but I don't think it's good way.[/color]

      Nope - it's on a hosted server anyway, so I wouldn't get access to the
      /tmp directory.

      I guess I'm being lazy, as I thought I could just read the cookies
      (as they're set to timeout after an hour).

      Adam.

      Comment

      • Zoe Brown

        #4
        Re: Get values for ALL cookies?


        "Adam" <anon@nowhere.c om> wrote in message
        news:m2mai1lr4k oupa228ahnil5ut ndtrc0lhv@4ax.c om...[color=blue]
        > On Mon, 12 Sep 2005 10:08:29 +0300, Alexey Kulentsov wrote:
        >[color=green]
        >>Adam wrote:[color=darkred]
        >>> I'm trying to track who's logged into a site (without setting flags in
        >>> the databses).[/color]
        >> In php script you have cookies for only current user so you can't do
        >>it without database (SQL or text - doesn't matter)
        >>[color=darkred]
        >>> At the moment, each user gets a cookie with "Usr_Name" set if
        >>> authentication goes through OK.
        >>>
        >>> Is there a way of looping through ALL the values of a particular
        >>> cookie, eg $_COOKIE['Usr_Name'] ... that would give me an output of
        >>> (say):
        >>>
        >>> Fred
        >>> Doris
        >>> Bert
        >>> etc.[/color]
        >>
        >> 1. Use session for logging users
        >> 2. Make database-driven session handler
        >> 3. Now you can get list of users by regular SQL query.[/color]
        >
        > I was trying to avoiid touching the current database, but I'll add a
        > table if I really have to.
        >[color=green]
        >>You can also parse session files in /tmp directory instead of making
        >>database-driven handler but I don't think it's good way.[/color]
        >
        > Nope - it's on a hosted server anyway, so I wouldn't get access to the
        > /tmp directory.
        >
        > I guess I'm being lazy, as I thought I could just read the cookies
        > (as they're set to timeout after an hour).[/color]

        read the cookies with what ?



        Comment

        • Adam

          #5
          Re: Get values for ALL cookies?

          On Mon, 12 Sep 2005 11:40:18 GMT, Zoe Brown wrote:
          [color=blue]
          >
          >"Adam" <anon@nowhere.c om> wrote in message
          >news:m2mai1lr4 koupa228ahnil5u tndtrc0lhv@4ax. com...[color=green]
          >> On Mon, 12 Sep 2005 10:08:29 +0300, Alexey Kulentsov wrote:
          >>[color=darkred]
          >>>Adam wrote:
          >>>> I'm trying to track who's logged into a site (without setting flags in
          >>>> the databses).
          >>> In php script you have cookies for only current user so you can't do
          >>>it without database (SQL or text - doesn't matter)
          >>>
          >>>> At the moment, each user gets a cookie with "Usr_Name" set if
          >>>> authentication goes through OK.
          >>>>
          >>>> Is there a way of looping through ALL the values of a particular
          >>>> cookie, eg $_COOKIE['Usr_Name'] ... that would give me an output of
          >>>> (say):
          >>>>
          >>>> Fred
          >>>> Doris
          >>>> Bert
          >>>> etc.
          >>>
          >>> 1. Use session for logging users
          >>> 2. Make database-driven session handler
          >>> 3. Now you can get list of users by regular SQL query.[/color]
          >>
          >> I was trying to avoiid touching the current database, but I'll add a
          >> table if I really have to.
          >>[color=darkred]
          >>>You can also parse session files in /tmp directory instead of making
          >>>database-driven handler but I don't think it's good way.[/color]
          >>
          >> Nope - it's on a hosted server anyway, so I wouldn't get access to the
          >> /tmp directory.
          >>
          >> I guess I'm being lazy, as I thought I could just read the cookies
          >> (as they're set to timeout after an hour).[/color]
          >
          >read the cookies with what ?[/color]

          Exactly!! I don't know! As is apparent, I don't know much about
          cookies - other than I thought they were also stored on the server ...
          and therefore [somehow] accessible.

          Of course, it's highly probable that I'm barking up the wrong tree -
          and should read up on session management.

          Adam.

          Comment

          • Zoe Brown

            #6
            Re: Get values for ALL cookies?


            "Adam" <anon@nowhere.c om> wrote in message
            news:4qtai1t10u qmm3n8v5ul18igq 3qniuvfi0@4ax.c om...[color=blue]
            > On Mon, 12 Sep 2005 11:40:18 GMT, Zoe Brown wrote:
            >[color=green]
            >>
            >>"Adam" <anon@nowhere.c om> wrote in message
            >>news:m2mai1lr 4koupa228ahnil5 utndtrc0lhv@4ax .com...[color=darkred]
            >>> On Mon, 12 Sep 2005 10:08:29 +0300, Alexey Kulentsov wrote:
            >>>
            >>>>Adam wrote:
            >>>>> I'm trying to track who's logged into a site (without setting flags in
            >>>>> the databses).
            >>>> In php script you have cookies for only current user so you can't do
            >>>>it without database (SQL or text - doesn't matter)
            >>>>
            >>>>> At the moment, each user gets a cookie with "Usr_Name" set if
            >>>>> authentication goes through OK.
            >>>>>
            >>>>> Is there a way of looping through ALL the values of a particular
            >>>>> cookie, eg $_COOKIE['Usr_Name'] ... that would give me an output of
            >>>>> (say):
            >>>>>
            >>>>> Fred
            >>>>> Doris
            >>>>> Bert
            >>>>> etc.
            >>>>
            >>>> 1. Use session for logging users
            >>>> 2. Make database-driven session handler
            >>>> 3. Now you can get list of users by regular SQL query.
            >>>
            >>> I was trying to avoiid touching the current database, but I'll add a
            >>> table if I really have to.
            >>>
            >>>>You can also parse session files in /tmp directory instead of making
            >>>>database-driven handler but I don't think it's good way.
            >>>
            >>> Nope - it's on a hosted server anyway, so I wouldn't get access to the
            >>> /tmp directory.
            >>>
            >>> I guess I'm being lazy, as I thought I could just read the cookies
            >>> (as they're set to timeout after an hour).[/color]
            >>
            >>read the cookies with what ?[/color]
            >
            > Exactly!! I don't know! As is apparent, I don't know much about
            > cookies - other than I thought they were also stored on the server ...
            > and therefore [somehow] accessible.
            >
            > Of course, it's highly probable that I'm barking up the wrong tree -
            > and should read up on session management.[/color]

            wrong tree, they are stored on the clients machine...
            [color=blue]
            >
            > Adam.[/color]


            Comment

            • Tim Roberts

              #7
              Re: Get values for ALL cookies?

              Adam <anon@nowhere.c om> wrote:
              [color=blue]
              >I'm trying to track who's logged into a site (without setting flags in
              >the databses).
              >
              >At the moment, each user gets a cookie with "Usr_Name" set if
              >authenticati on goes through OK.
              >
              >Is there a way of looping through ALL the values of a particular
              >cookie, eg $_COOKIE['Usr_Name'] ... that would give me an output of
              >(say):[/color]

              No. This information is not stored on your server. Fred's cookie comes in
              with every request Fred sends, but unless you are storing it somewhere, the
              cookie goes away as soon as the request is sent.
              --
              - Tim Roberts, timr@probo.com
              Providenza & Boekelheide, Inc.

              Comment

              • Adam

                #8
                Re: Get values for ALL cookies?

                On Thu, 15 Sep 2005 00:40:29 -0700, Tim Roberts wrote:
                [color=blue]
                >Adam <anon@nowhere.c om> wrote:
                >[color=green]
                >>I'm trying to track who's logged into a site (without setting flags in
                >>the databses).
                >>
                >>At the moment, each user gets a cookie with "Usr_Name" set if
                >>authenticatio n goes through OK.
                >>
                >>Is there a way of looping through ALL the values of a particular
                >>cookie, eg $_COOKIE['Usr_Name'] ... that would give me an output of
                >>(say):[/color]
                >
                >No. This information is not stored on your server. Fred's cookie comes in
                >with every request Fred sends, but unless you are storing it somewhere, the
                >cookie goes away as soon as the request is sent.[/color]

                Yep ... sounds logica. Thanks for the enlightenment (and to all other
                posters). !!

                Adam.

                Comment

                Working...