Important alert: (current site time 7/15/2013 10:57:30 AM EDT)
 

VB icon

^ A Registration Password Trick

Email
Submitted on: 9/9/2002 12:14:33 AM
By: Darryl Porter 
Level: Beginner
User Rating: By 9 Users
Compatibility: PHP 4.0
Views: 20549
author picture
(About the author)
 
     Ever wonder how when you registered online somewhere, on the next page where your username and password are confirmed, only the first few chars of the p-word are shown and the rest of it are asterisks to keep from prying eyes. Please Rate
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.
				
//**************************************
// Name: ^ A Registration Password Trick
// Description:Ever wonder how when you registered online somewhere, on the next page where your username and password are confirmed, only the first few chars of the p-word are shown and the rest of it are asterisks to keep from prying eyes. <b>Please Rate</b>
// By: Darryl Porter
//
// Inputs:This script processes the username/password registered by the end user.
//
// Assumes:uses two functions--strlen() and substr()--and a "while loop." the strlen() function returns the length of anything that can be stored in a variable. The second, substr(), takes a part of anything that is stored in a variable. Example: $foo = Hello World;
$foofoo = substr($foo, 0, 7);
$foofoo == Hello Wor
//
//This code is copyrighted and has// limited warranties.Please see http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=738&lngWId=8//for details.//**************************************

		
$length = strlen($password); //Gets the length of the Password
$sub_password = substr($password, 0, 4); 
//(Comment for the code above)This takes the original passwords and cuts it length.
//First, I plug-in the original variable. Then, the number at the beginning of the string. 
//The second number controls how much of the password will be revealed.
//Remember that PHP starts counting at 0. 
	
		
$length2 = strlen($sub_password); 
//This gets the length of the password after is has been cut
		
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">";
echo "<html><head><title>$title</title></head>";
echo "<br><br>";
echo "<div align=\"center\">Welcome $username your password is $sub_password";
	 
while($length2 < $length)
	{
	print("*");
	$length2++;
	}	
		
		echo ", all but the first four are hidden for your security.</div>";
//(Comment for the code above)This is a simple While Loop--While the length of the original
//password is greater than the length of the cut password
//there will be "*" printed out. This is to reveal the 
//first few characters of the password after registration, and the last few
//are replaced for security.		
	
	


Other 2 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments
3/18/2003 5:38:40 AM

and the point of this? password should never be shown, not even few chars and this one even reveals lenght of the password...very bad. instead, if2!0you really want to show few chars of the password do it as in code but put like 8 stars after the stars so the real length would not be revealed.
(If this comment was disrespectful, please report it.)

 
3/18/2003 5:39:22 AM

and the point of this? password should never be shown, not even few chars and this one even reveals lenght of the password...very bad. instead, if you really want to show few chars of the password do it as in code but put like 8 stars after the stars so the real length would not be revealed.
(If this comment was disrespectful, please report it.)

 
7/18/2003 9:30:13 PM

i never seen this done anywhere. nowhere should the password be shown.

if the user doesnt know what the passowrd is he must be st00pid.. thats why they have 2 confirm textboxes so u can type them twice!
(If this comment was disrespectful, please report it.)

 
5/11/2004 1:04:01 AMPlasma

heh if you add 8 extra stars people will know to minus 8 to get the real length
(If this comment was disrespectful, please report it.)

 
2/28/2005 4:10:40 PMJohn Avison

Look at an ATM receipt. Its got your card number as ************XXXX
(If this comment was disrespectful, please report it.)

 
3/31/2005 5:20:03 PMChristopher

that might be because all cc numbers are the same length doh?
(If this comment was disrespectful, please report it.)

 
1/13/2006 4:19:52 PMLawrence Cherone

i dont see the reason for this, related to passwords, but this code/idea could be used in other metods like a email template to send the registrant there ****word, nice idea 4*
(If this comment was disrespectful, please report it.)

 
4/2/2006 8:04:38 AMAndrew A

Its why sites ask you to confirm your password when typing it, so you know it.

I hate sites (like some forums) that email you your username/password in plain text.
(If this comment was disrespectful, please report it.)

 
7/10/2006 2:23:30 AMJosef

Sites always ask you to confirm your password so that you can verify if you typed your password correctly not for you to know it.. It's your password so obviously, you know it when you type it.. duh..
(If this comment was disrespectful, please report it.)

 
3/14/2008 12:06:07 AMjasper

ei guys i really need your help... help me and teach me how to make an php codes??? and what is the program that i can use in this .php? pls send me your answers at my email add.. jalu3773@gmail.com.... many Thanks guys!

(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.