Link to home
Start Free TrialLog in
Avatar of annesmith
annesmith

asked on

Giving users username & password

I am trying to give users who enter the site a username & corresponding password.

I can put the username & password into an associative array like this:

%username = ("ABC",101,
             "DEF",102,
             "GHI",103);

Alternatively is it better to put them seperatley into an array as follows:

@username=("ABC","DEF","GHI");
@password=("101","102","103");

I am trying to generate a different password and a different username to be given to the user whenever the site is visited.

I thought that this may involve a loop of some sort.

when the value os given to the user then the value is incremented some how.

I know how to return values from the arrays above by using $username{ABC} for the associative array and $password[0] for the array's.

If anyone has any ideas as to the above or any alternatives that may be easier please let me know.

thank you

Anne.




Avatar of maneshr
maneshr

here is what i understand from your requirement above...

you want to generate a different password and a different username to users visiting your site.

if that is indeed the case i have a couple of Q's

* would you give a user a username and password from a pre-defined set of usernames and passwords??

Eg . you have 1000 usernames and passwords already created and stored somewhere and you just give them out one-by-one to every user visiting your site (kind of like a token).

* why cant you generate a username/password for the user once and let the user use it to log on to your system?? that way you dont have to worry about having to generate a new username/password fora user who is re-visiting your site.

let me know.
Avatar of annesmith

ASKER

yes I am wanting to give the users a password and username as they enter the sytem as you said above like a token.

However the other way seems a little more complicated.  If it is this does not matter as long as I can find a way to give out usernames and passwords randomly to users.  i.e from an associative array.

Any of the ways above you have mentioned would work fine.  it depends I suppose upon yourself a simple way would be fine for me such as the token you mentioned above as I could then save this users password and username to a file.

Thanks.

Anne.
i personally prefer going for the 2nd method. create username/password once and validate every time after that.

pl. let me know if this is fine with you and i will write a small piece of code that will do the same.

Rgds
Thanks for your reply Maneshr.
Yes that is fine going with your 2nd method.  

It is actualy probably the better of the two.

I just thought it may be a bit tricker but hey after all your the expert.

thanks again.

Anne.
ASKER CERTIFIED SOLUTION
Avatar of maneshr
maneshr

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks very much for your Help.

The program is working perfectly thanks to your expert help.

thanks you.

Anne.
Glad to know that your problem was solved.

most welcome :-)


Rgds