Adding Variable output to an array (beginner)

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

    #1

    Adding Variable output to an array (beginner)

    I have a variable that stores a temporary password. I'm just learning about
    arrays. I know this is wrong $pwList[]= ($newPW); I want to add the value
    of the $newPW which keeps changing to a unique variable and store each one
    in the array. How do I do that?

    I plan (once I learn how) to compare the password input by the user to those
    stored in the array. Am I going about this the right way?
    Thanks much.


  • Geoff Berrow

    #2
    Re: Adding Variable output to an array (beginner)

    I noticed that Message-ID:
    <O1RRd.3322$Pz7 .1018@newssvr13 .news.prodigy.c om> from Christopher
    Richards contained the following:
    [color=blue]
    >I have a variable that stores a temporary password. I'm just learning about
    >arrays. I know this is wrong $pwList[]= ($newPW); I want to add the value
    >of the $newPW which keeps changing to a unique variable and store each one
    >in the array. How do I do that?[/color]

    If you have
    $pwList[]=$firstPW;
    $pwList[]=$secondPW;
    $pwList[]=$thirdPW;

    then $pwList[0] will contain the first password, $pwList[1] will contain
    the second password and $pwList[2] the third.


    --
    Geoff Berrow (put thecat out to email)
    It's only Usenet, no one dies.
    My opinions, not the committee's, mine.
    Simple RFDs http://www.ckdog.co.uk/rfdmaker/

    Comment

    • Christopher Richards

      #3
      Re: Adding Variable output to an array (beginner)


      "Geoff Berrow" <blthecat@ckdog .co.uk> wrote in message
      news:ronf119gmk 6e21f9jve757i2c o4uvmedtf@4ax.c om...[color=blue]
      >I noticed that Message-ID:
      > <O1RRd.3322$Pz7 .1018@newssvr13 .news.prodigy.c om> from Christopher
      > Richards contained the following:
      >[color=green]
      >>I have a variable that stores a temporary password. I'm just learning
      >>about
      >>arrays. I know this is wrong $pwList[]= ($newPW); I want to add the value
      >>of the $newPW which keeps changing to a unique variable and store each
      >>one
      >>in the array. How do I do that?[/color]
      >
      > If you have
      > $pwList[]=$firstPW;
      > $pwList[]=$secondPW;
      > $pwList[]=$thirdPW;
      >
      > then $pwList[0] will contain the first password, $pwList[1] will contain
      > the second password and $pwList[2] the third.
      >
      >
      > --
      > Geoff Berrow (put thecat out to email)
      > It's only Usenet, no one dies.
      > My opinions, not the committee's, mine.
      > Simple RFDs http://www.ckdog.co.uk/rfdmaker/[/color]

      Thanks. What is confusing is that I need to add to the list each time a new
      password is generated. So I need to automate the procedure.


      Comment

      • Geoff Berrow

        #4
        Re: Adding Variable output to an array (beginner)

        I noticed that Message-ID:
        <JiRRd.3326$Pz7 .1495@newssvr13 .news.prodigy.c om> from Christopher
        Richards contained the following:
        [color=blue]
        >
        >Thanks. What is confusing is that I need to add to the list each time a new
        >password is generated. So I need to automate the procedure.[/color]

        I'm not quite sure what you're after. If you wish to permanently store
        passwords, you are going to have to save them in a file or database.

        --
        Geoff Berrow (put thecat out to email)
        It's only Usenet, no one dies.
        My opinions, not the committee's, mine.
        Simple RFDs http://www.ckdog.co.uk/rfdmaker/

        Comment

        • Christopher Richards

          #5
          Re: Adding Variable output to an array (beginner)

          >>[color=blue][color=green]
          >>Thanks. What is confusing is that I need to add to the list each time a
          >>new
          >>password is generated. So I need to automate the procedure.[/color]
          >
          > I'm not quite sure what you're after. If you wish to permanently store
          > passwords, you are going to have to save them in a file or database.[/color]

          What I want to do is to put each new value of the variable into an array. So
          if $var=="xyz123" I put the string "xyz123" into the array. When the value
          of $var changes to "abc789" I store that in the array. I end up with
          $myArray= array("xyz123", "abc789" and so on.); I don't know how to do that.

          As for what I am trying to do: I am sending the user a random password and
          link by email to a page that they can download a file( I can do that). I
          want to store the password I gave them so that it will match and let them
          into the download page. Then I want to delete the password so they can only
          download the file one time. I may be getting too ambitious for my ability to
          write this stuff but I am trying. Thanks for you help. Hope this explanation
          is clear.
          Christopher


          Comment

          • Geoff Berrow

            #6
            Re: Adding Variable output to an array (beginner)

            I noticed that Message-ID:
            <454Sd.1825$DC6 .1404@newssvr14 .news.prodigy.c om> from Christopher
            Richards contained the following:
            [color=blue][color=green][color=darkred]
            >>>
            >>>Thanks. What is confusing is that I need to add to the list each time a
            >>>new
            >>>password is generated. So I need to automate the procedure.[/color]
            >>
            >> I'm not quite sure what you're after. If you wish to permanently store
            >> passwords, you are going to have to save them in a file or database.[/color]
            >
            >What I want to do is to put each new value of the variable into an array. So
            >if $var=="xyz123" I put the string "xyz123" into the array. When the value
            >of $var changes to "abc789" I store that in the array. I end up with
            >$myArray= array("xyz123", "abc789" and so on.); I don't know how to do that.
            >
            >As for what I am trying to do: I am sending the user a random password and
            >link by email to a page that they can download a file( I can do that). I
            >want to store the password I gave them so that it will match and let them
            >into the download page. Then I want to delete the password so they can only
            >download the file one time. I may be getting too ambitious for my ability to
            >write this stuff but I am trying.[/color]

            An array isn't going to hang around while you wait for the user to
            respond. If you wish to store the password and then match it with the
            one the user supplies, you are going to have to store it in a file or
            preferably in a database. I can't comment on your ability to do this.
            --
            Geoff Berrow (put thecat out to email)
            It's only Usenet, no one dies.
            My opinions, not the committee's, mine.
            Simple RFDs http://www.ckdog.co.uk/rfdmaker/

            Comment

            • Christopher Richards

              #7
              Re: Adding Variable output to an array (beginner)

              [color=blue]
              > An array isn't going to hang around while you wait for the user to
              > respond. If you wish to store the password and then match it with the
              > one the user supplies, you are going to have to store it in a file or
              > preferably in a database. I can't comment on your ability to do this.
              > --
              > Geoff Berrow (put thecat out to email)
              > It's only Usenet, no one dies.
              > My opinions, not the committee's, mine.
              > Simple RFDs http://www.ckdog.co.uk/rfdmaker/[/color]

              Thanks. That's a help.


              Comment

              Working...