Form / Password / Saving / Overwriting Procedure Question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
diseman
Forum Contributor
Posts: 174
Joined: Mon Jul 26, 2010 1:30 pm
Location: Florida

Form / Password / Saving / Overwriting Procedure Question

Post by diseman »

Not a code question, but a procedure one instead. If it turns out I need more help, I'll post my code.

So, I have this form with my contact information, email address, and password field.

I fill it in and save it to db along with hashed password.

I bring up the form again and look at all my data saved. Looks good! I then decide I want to change my phone number and submit form again.

Now the password has changed in the db 'cause the hashed password that was showing in the password input box was rehashed and sent to the db as a new password when I submitted the form.

What's the standard for dealing with this issue?

Also, while I'm at it. The password input box was showing the hashed password (i.e. ************************) from beginning to end of the password field. Looks dumb. How would I make it so only 7 stars show? 7 is just a random number I picked? Can't find anything on Google relating to this, which is silly 'cause sites to it all the time. I might have a 12 character password, but they only show 6 stars in the field.

Thanks!
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Form / Password / Saving / Overwriting Procedure Questio

Post by Celauran »

I typically do not populate password fields for the very reasons you've just described. I'll either have separate forms for changing passwords, or I'll have the fields present but only update the DB if they're filled in and pass validation.
User avatar
diseman
Forum Contributor
Posts: 174
Joined: Mon Jul 26, 2010 1:30 pm
Location: Florida

Re: Form / Password / Saving / Overwriting Procedure Questio

Post by diseman »

Hi Celauran,

Ok, so I thought of doing that too; where I don't populate the field, but it still sent an empty value on submit.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Form / Password / Saving / Overwriting Procedure Questio

Post by Celauran »

That's expected. If the field is empty, ignore it.
User avatar
diseman
Forum Contributor
Posts: 174
Joined: Mon Jul 26, 2010 1:30 pm
Location: Florida

Re: Form / Password / Saving / Overwriting Procedure Questio

Post by diseman »

Well of course that's how you do it! All seems so logical after you say it. :) Thank you again.
Post Reply