This is a discussion on Adding Variable output to an array (beginner) within the PHP Language forums, part of the PHP Programming Forums category; I have a variable that stores a temporary password. I'm just learning about arrays. I know this is wrong $...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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. |
|
|||
|
I noticed that Message-ID:
<O1RRd.3322$Pz7.1018@newssvr13.news.prodigy.com> from Christopher Richards contained the following: >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? 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/ |
|
|||
|
"Geoff Berrow" <blthecat@ckdog.co.uk> wrote in message news:ronf119gmk6e21f9jve757i2co4uvmedtf@4ax.com... >I noticed that Message-ID: > <O1RRd.3322$Pz7.1018@newssvr13.news.prodigy.com> from Christopher > Richards contained the following: > >>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? > > 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/ 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. |
|
|||
|
I noticed that Message-ID:
<JiRRd.3326$Pz7.1495@newssvr13.news.prodigy.com> from Christopher Richards contained the following: > >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. 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/ |
|
|||
|
>>
>>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. > > 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. 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 |
|
|||
|
I noticed that Message-ID:
<454Sd.1825$DC6.1404@newssvr14.news.prodigy.com> from Christopher Richards contained the following: >>> >>>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. >> >> 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. > >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. 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/ |
|
|||
|
> 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/ Thanks. That's a help. |