Adding Variable output to an array (beginner)

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 $...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-20-2005
Christopher Richards
 
Posts: n/a
Default 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.


Reply With Quote
  #2 (permalink)  
Old 02-20-2005
Geoff Berrow
 
Posts: n/a
Default Re: Adding Variable output to an array (beginner)

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/
Reply With Quote
  #3 (permalink)  
Old 02-20-2005
Christopher Richards
 
Posts: n/a
Default Re: Adding Variable output to an array (beginner)


"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.


Reply With Quote
  #4 (permalink)  
Old 02-20-2005
Geoff Berrow
 
Posts: n/a
Default Re: Adding Variable output to an array (beginner)

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/
Reply With Quote
  #5 (permalink)  
Old 02-20-2005
Christopher Richards
 
Posts: n/a
Default Re: Adding Variable output to an array (beginner)

>>
>>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


Reply With Quote
  #6 (permalink)  
Old 02-20-2005
Geoff Berrow
 
Posts: n/a
Default Re: Adding Variable output to an array (beginner)

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/
Reply With Quote
  #7 (permalink)  
Old 02-21-2005
Christopher Richards
 
Posts: n/a
Default Re: Adding Variable output to an array (beginner)


> 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.


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 10:52 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0