FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Partly hiding a password





Ben
I need some help with a registration script that I am creating!

Before the account of a user is created, they have to verify their information that they have submitted. What I want to do is to show their password, but only some of the characters are replaced by an asterix.

For example if the password was 'password', it would show as something like: 'pass****'

Does anybody know how to do this with PHP-4?

Thanks!
Ben
Kaneda
I think I understand the thought behind doing it, but don't agree with it. Usually you'll put two password fields (Confirm password), so the user has already verified the password, and doesn't really need to verify it again. But anyway, to answer the question...

The only thing I guess you're asking for is a statement to replace the last characters of the password value with asterisks. If so, simply do something like:

Code:
<?php
  // $pw is your password un-asterisked
  echo str_pad(substr($pw,0,4),strlen($pw),"*");
?>


To reveal another amount of characters, replace the "4" Wink

I assume you're not actually letting the user modify data on the verification page, since that would call all kinds of other trouble, usability-wise Wink
Ben
Thanks very much for that. I understand the problems with showing some of the password. Although I will show it with asterixes on the verification page, it was mainly for the welcome email that will be sent.

I have used the 'confirm password' technique as well Very Happy

You are right in presuming that the user cannot edit the data on the verification page.

Cheers!
Ben
Related topics
htaccess Password Protection
password problem
Does Frihost's SMTP server require login and password?
HELP! I registered, but never got my confirmation email.
Why are no admins helping me?
Password Protecting Directories?
Daddy's Password
how can i change password in my database?
How to bypass your BIOS Password
Need New Password for account
Cant change my password
(official) Firefox & Thunderbird 1.5 Beta2 Now Available
Password Protected pages
Securely Hiding Your Files In Windows ..
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.