Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 19th, 2005, 11:37 AM
David
Guest
 
Posts: n/a
Default Convert all characters to ' * ' where password is displayed...

Hi,

I have a field from my recordset called RS("Password").
If I wish to display each character as an asterix '*' how do I go
about it.
I've seen the replace function, but cannot work out how to do it for
how ever many characters there are in the record ?


Appreciate your help



David.
  #2  
Old July 19th, 2005, 11:37 AM
Alex Goodey
Guest
 
Posts: n/a
Default Re: Convert all characters to ' * ' where password is displayed...

For i to Len(RS("Password"))
strPass = strPass & "*"
Next

then use strPass iin your display

"David" <david@scene-double.co.uk> wrote in message
news:c178e3e8.0402020918.4f482f7f@posting.google.c om...[color=blue]
> Hi,
>
> I have a field from my recordset called RS("Password").
> If I wish to display each character as an asterix '*' how do I go
> about it.
> I've seen the replace function, but cannot work out how to do it for
> how ever many characters there are in the record ?
>
>
> Appreciate your help
>
>
>
> David.[/color]


  #3  
Old July 19th, 2005, 11:37 AM
David Gordon
Guest
 
Posts: n/a
Default Re: Convert all characters to ' * ' where password is displayed...

Thanks,

I had just started to think about using For I = , but could not think
about the strPass = strPass & "*"


Nice one....Thanks



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #4  
Old July 19th, 2005, 11:37 AM
Evertjan.
Guest
 
Posts: n/a
Default Re: Convert all characters to ' * ' where password is displayed...

Alex Goodey wrote on 02 feb 2004 in
microsoft.public.inetserver.asp.general:[color=blue]
> For i to Len(RS("Password"))
> strPass = strPass & "*"
> Next
>[/color]

strPass = String(Len(RS("Password")),"*")

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
  #5  
Old July 19th, 2005, 11:37 AM
Ray at
Guest
 
Posts: n/a
Default Re: Convert all characters to ' * ' where password is displayed...

strPass = String(Len(strPass), "*")

What is the reason you (OP) want to do this though? Why not just use a
length of *'s that isn't specific to the length of the user's password, if
you aren't going to display it? And you're aware of <input type=password>,
right?

Ray at work


"Alex Goodey" <agoodey@hsfinancial.co.uk> wrote in message
news:bvm0u6$tujqo$1@ID-221525.news.uni-berlin.de...[color=blue]
> For i to Len(RS("Password"))
> strPass = strPass & "*"
> Next
>
> then use strPass iin your display
>
> "David" <david@scene-double.co.uk> wrote in message
> news:c178e3e8.0402020918.4f482f7f@posting.google.c om...[color=green]
> > Hi,
> >
> > I have a field from my recordset called RS("Password").
> > If I wish to display each character as an asterix '*' how do I go
> > about it.
> > I've seen the replace function, but cannot work out how to do it for
> > how ever many characters there are in the record ?
> >
> >
> > Appreciate your help
> >
> >
> >
> > David.[/color]
>
>[/color]


  #6  
Old July 19th, 2005, 11:37 AM
Peter Foti
Guest
 
Posts: n/a
Default Re: Convert all characters to ' * ' where password is displayed...

"Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
message news:udcsTab6DHA.1632@TK2MSFTNGP12.phx.gbl...[color=blue]
> strPass = String(Len(strPass), "*")
>
> What is the reason you (OP) want to do this though? Why not just use a
> length of *'s that isn't specific to the length of the user's password, if
> you aren't going to display it? And you're aware of <input[/color]
type=password>,[color=blue]
> right?[/color]

Ray, I hope you're joking about <input type=password>. That is, I hope you
don't mean something like this:

<%
Response.Write "<input type=""password"" value=""" & RS("Password") & """>"
%>

As I'm sure you know, viewing the source of the document would reveal the
actual value of the password.

Regards,
Peter Foti



  #7  
Old July 19th, 2005, 11:37 AM
Ray at
Guest
 
Posts: n/a
Default Re: Convert all characters to ' * ' where password is displayed...


"Peter Foti" <peter@Idontwantnostinkingemailfromyou.com> wrote in message
news:101tes2bbmmjhac@corp.supernews.com...[color=blue]
>
> Ray, I hope you're joking about <input type=password>. That is, I hope[/color]
you[color=blue]
> don't mean something like this:
>
> <%
> Response.Write "<input type=""password"" value=""" & RS("Password") &[/color]
""">"[color=blue]
> %>
>
> As I'm sure you know, viewing the source of the document would reveal the
> actual value of the password.[/color]


Yes, I know, but I still had to ask if the OP is aware of the password
input.

Ray at work


  #8  
Old July 19th, 2005, 11:37 AM
Curt_C [MVP]
Guest
 
Posts: n/a
Default Re: Convert all characters to ' * ' where password is displayed...

yes, but the person using the password should know it, otherwise why even
put it on the screen?
The reason behind the <input type=password> is so that a passer-by can't
read it over your shoulder.

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com


"Peter Foti" <peter@Idontwantnostinkingemailfromyou.com> wrote in message
news:101tes2bbmmjhac@corp.supernews.com...[color=blue]
> "Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
> message news:udcsTab6DHA.1632@TK2MSFTNGP12.phx.gbl...[color=green]
> > strPass = String(Len(strPass), "*")
> >
> > What is the reason you (OP) want to do this though? Why not just use a
> > length of *'s that isn't specific to the length of the user's password,[/color][/color]
if[color=blue][color=green]
> > you aren't going to display it? And you're aware of <input[/color]
> type=password>,[color=green]
> > right?[/color]
>
> Ray, I hope you're joking about <input type=password>. That is, I hope[/color]
you[color=blue]
> don't mean something like this:
>
> <%
> Response.Write "<input type=""password"" value=""" & RS("Password") &[/color]
""">"[color=blue]
> %>
>
> As I'm sure you know, viewing the source of the document would reveal the
> actual value of the password.
>
> Regards,
> Peter Foti
>
>
>[/color]


  #9  
Old July 19th, 2005, 11:37 AM
Peter Foti
Guest
 
Posts: n/a
Default Re: Convert all characters to ' * ' where password is displayed...

"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
news:%23WFtCFd6DHA.1672@TK2MSFTNGP12.phx.gbl...[color=blue]
> yes, but the person using the password should know it, otherwise why even
> put it on the screen?
> The reason behind the <input type=password> is so that a passer-by can't
> read it over your shoulder.[/color]

Ah, true I suppose. I guess it depends on the context of who the user is
and what they're doing. For example, if this is an admin system listing all
of the users, then it shouldn't be putting the real password value in. But
if this is an individual user, then I suppose the main risk is that the page
could be stored in cache somewhere.

-Peter



  #10  
Old July 19th, 2005, 11:37 AM
Curt_C [MVP]
Guest
 
Posts: n/a
Default Re: Convert all characters to ' * ' where password is displayed...

If it's an admin he shouldn't even be retrieving the password to the screen,
at all.
Guess that's my point, I couldn't think of a single use to read the
password, and display it as *** if the user wasn't supposed to know it.
Seems like the OP was trying to do something "weird" and most likely
incorrect.

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com


"Peter Foti" <peter@Idontwantnostinkingemailfromyou.com> wrote in message
news:101tgjhekkuua0f@corp.supernews.com...[color=blue]
> "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
> news:%23WFtCFd6DHA.1672@TK2MSFTNGP12.phx.gbl...[color=green]
> > yes, but the person using the password should know it, otherwise why[/color][/color]
even[color=blue][color=green]
> > put it on the screen?
> > The reason behind the <input type=password> is so that a passer-by can't
> > read it over your shoulder.[/color]
>
> Ah, true I suppose. I guess it depends on the context of who the user is
> and what they're doing. For example, if this is an admin system listing[/color]
all[color=blue]
> of the users, then it shouldn't be putting the real password value in.[/color]
But[color=blue]
> if this is an individual user, then I suppose the main risk is that the[/color]
page[color=blue]
> could be stored in cache somewhere.
>
> -Peter
>
>
>[/color]


  #11  
Old July 19th, 2005, 11:37 AM
Ray at
Guest
 
Posts: n/a
Default Re: Convert all characters to ' * ' where password is displayed...

Yes, exactly! Unfortunately, the OP has disappeared and we'll probably
never know...

"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
news:%239pOxUd6DHA.1716@TK2MSFTNGP10.phx.gbl...
[color=blue]
> Seems like the OP was trying to do something "weird" and most likely
> incorrect.[/color]


  #12  
Old July 19th, 2005, 11:38 AM
Peter Foti
Guest
 
Posts: n/a
Default Re: Convert all characters to ' * ' where password is displayed...

"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
news:%239pOxUd6DHA.1716@TK2MSFTNGP10.phx.gbl...[color=blue]
> If it's an admin he shouldn't even be retrieving the password to the[/color]
screen,[color=blue]
> at all.[/color]

Well, perhaps for resetting a password (that is, admin never actually sees
the value currently stored, but can reset the password for an end user that
has forgotten it).
[color=blue]
> Guess that's my point, I couldn't think of a single use to read the
> password, and display it as *** if the user wasn't supposed to know it.
> Seems like the OP was trying to do something "weird" and most likely
> incorrect.[/color]

I agree with you there. :)
Regards,
Peter


  #13  
Old July 19th, 2005, 11:38 AM
Jeff Cochran
Guest
 
Posts: n/a
Default Re: Convert all characters to ' * ' where password is displayed...

On Mon, 2 Feb 2004 16:57:56 -0500, "Peter Foti"
<peter@Idontwantnostinkingemailfromyou.com> wrote:
[color=blue]
>"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
>news:%239pOxUd6DHA.1716@TK2MSFTNGP10.phx.gbl...[color=green]
>> If it's an admin he shouldn't even be retrieving the password to the[/color]
>screen,[color=green]
>> at all.[/color]
>
>Well, perhaps for resetting a password (that is, admin never actually sees
>the value currently stored, but can reset the password for an end user that
>has forgotten it).[/color]

Even then, the display doesn't need to show a password or asterisks or
anything. An input to enter the new password and a change password
button is plenty. Of course that input would be Type = Password...
:)

Jeff
[color=blue][color=green]
>> Guess that's my point, I couldn't think of a single use to read the
>> password, and display it as *** if the user wasn't supposed to know it.
>> Seems like the OP was trying to do something "weird" and most likely
>> incorrect.[/color]
>
>I agree with you there. :)
>Regards,
>Peter
>[/color]

  #14  
Old July 19th, 2005, 11:38 AM
Aaron Bertrand [MVP]
Guest
 
Posts: n/a
Default Re: Convert all characters to ' * ' where password is displayed...

> Ah, true I suppose. I guess it depends on the context of who the user is[color=blue]
> and what they're doing. For example, if this is an admin system listing[/color]
all[color=blue]
> of the users, then it shouldn't be putting the real password value in.[/color]
But[color=blue]
> if this is an individual user, then I suppose the main risk is that the[/color]
page[color=blue]
> could be stored in cache somewhere.[/color]

Presumably, the reason for displaying (that there is) a password at all, yet
not showing it, is so that it can be changed.

Unless there is a change to be made, I don't see any reason to display a
password form field at all. IMHO.

Rather than show ****** I think it would be more effective to only show the
password box when the user or admin requests to change it. *THAT* change
should use input type=password.

Even if the user is logged in, it's always a little extra precaution to
require that they enter their old password once (to confirm that someone
didn't happen upon someone else's workstation).

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


  #15  
Old July 19th, 2005, 11:38 AM
David Gordon
Guest
 
Posts: n/a
Default Re: Convert all characters to ' * ' where password is displayed...

Wow,

I did not expect so many replies !..Cool.
This is a simple system for our customers to log in and track their
orders, upload orders etc...

The reason I wanted to hide the password is just for security. They
should have it on their initial set-up email.
I like to show how many characters are in the password as this sometimes
helps jog the users memory as to what is was.

Thanks for all your advice


David



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #16  
Old July 19th, 2005, 11:38 AM
David Gordon
Guest
 
Posts: n/a
Default Re: Convert all characters to ' * ' where password is displayed...

Alex,

This works well, but now I have the following problem.
I have the following code, but all the passwords listed as '*', are
displaying the same number of characters even though they should display
different numbers of characters..

My code....

_____________________________________________
else

For i = 1 to Len(RS("Password"))
strPass = strPass & "*"
Next

response.write blah blah blah....

do until RS.EOF

response.write "<tr><td>" & RS("UserID") & "</TD><TD>" & strPass &
"</TD><TD>" & RS("Email") & "</td></tr>"

RS.movenext

loop

_________________________________________


If I take the For loop out of the Do loop then it lists the passwords as
the first one only...I understand this. If it is left in the do loop, it
just adds the characters on for each user, so, it displays longer &
longer passwords...

I want it to display the number of characters in each users password as
follows:

User 1, password: ****
User 2, password: ********
User 3, password: ******

not...where all passwords shown are for user1

User 1, password: ****
User 2, password: ****
User 3, password: ****

or, where it just appends on to the end each loop

User 1, password: ****
User 2, password: ********
User 3, password: ************

What is the solution.....thanks.

David


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #17  
Old July 19th, 2005, 11:38 AM
Alex Goodey
Guest
 
Posts: n/a
Default Re: Convert all characters to ' * ' where password is displayed...

as some of the others pointed out, you can use this.

String(Len(RS("Password")),"*")

so you get this

response.write "<tr><td>" & RS("UserID") & "</TD><TD>" &
String(Len(RS("Password")),"*") &
"</TD><TD>" & RS("Email") & "</td></tr>"

if you still want to use the other way the FOR loop must be inside the Do
Until loop.


"David Gordon" <david@scene-double.co.uk> wrote in message
news:Ol6nepk6DHA.2572@TK2MSFTNGP09.phx.gbl...[color=blue]
> Alex,
>
> This works well, but now I have the following problem.
> I have the following code, but all the passwords listed as '*', are
> displaying the same number of characters even though they should display
> different numbers of characters..
>
> My code....
>
> _____________________________________________
> else
>
> For i = 1 to Len(RS("Password"))
> strPass = strPass & "*"
> Next
>
> response.write blah blah blah....
>
> do until RS.EOF
>
> response.write "<tr><td>" & RS("UserID") & "</TD><TD>" & strPass &
> "</TD><TD>" & RS("Email") & "</td></tr>"
>
> RS.movenext
>
> loop
>
> _________________________________________
>
>
> If I take the For loop out of the Do loop then it lists the passwords as
> the first one only...I understand this. If it is left in the do loop, it
> just adds the characters on for each user, so, it displays longer &
> longer passwords...
>
> I want it to display the number of characters in each users password as
> follows:
>
> User 1, password: ****
> User 2, password: ********
> User 3, password: ******
>
> not...where all passwords shown are for user1
>
> User 1, password: ****
> User 2, password: ****
> User 3, password: ****
>
> or, where it just appends on to the end each loop
>
> User 1, password: ****
> User 2, password: ********
> User 3, password: ************
>
> What is the solution.....thanks.
>
> David
>
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it![/color]


  #18  
Old July 19th, 2005, 11:38 AM
Bob Barrows
Guest
 
Posts: n/a
Default Re: Convert all characters to ' * ' where password is displayed...

David Gordon wrote:[color=blue]
> Alex,
>
> This works well, but now I have the following problem.
> I have the following code, but all the passwords listed as '*', are
> displaying the same number of characters even though they should
> display different numbers of characters..
>
> My code....
>
> _____________________________________________
> else
>
> For i = 1 to Len(RS("Password"))
> strPass = strPass & "*"
> Next
>
> response.write blah blah blah....
>
> do until RS.EOF
>
> response.write "<tr><td>" & RS("UserID") & "</TD><TD>" & strPass &
> "</TD><TD>" & RS("Email") & "</td></tr>"
>
> RS.movenext
>
> loop
>
> _________________________________________
>
>
> If I take the For loop out of the Do loop then it lists the passwords
> as the first one only...I understand this. If it is left in the do
> loop, it just adds the characters on for each user, so, it displays
> longer & longer passwords...
>
> I want it to display the number of characters in each users password
> as follows:
>
> User 1, password: ****
> User 2, password: ********
> User 3, password: ******
>
> not...where all passwords shown are for user1
>
> User 1, password: ****
> User 2, password: ****
> User 3, password: ****
>
> or, where it just appends on to the end each loop
>
> User 1, password: ****
> User 2, password: ********
> User 3, password: ************
>
> What is the solution.....thanks.
>[/color]
Set the value of strPass IN the loop, not outside it. strPass's value never
changes in your code ...

Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


  #19  
Old July 19th, 2005, 11:38 AM
Alex Goodey
Guest
 
Posts: n/a
Default Re: Convert all characters to ' * ' where password is displayed...

sorry missed the last bit of your post, if you use the original way, just
clear strPass before the for loop

strPass = ""
For i = 1 to Len(RS("Password"))
strPass = strPass & "*"
Next

"Alex Goodey" <agoodey@hsfinancial.co.uk> wrote in message
news:bvo1i2$uov5m$1@ID-221525.news.uni-berlin.de...[color=blue]
> as some of the others pointed out, you can use this.
>
> String(Len(RS("Password")),"*")
>
> so you get this
>
> response.write "<tr><td>" & RS("UserID") & "</TD><TD>" &
> String(Len(RS("Password")),"*") &
> "</TD><TD>" & RS("Email") & "</td></tr>"
>
> if you still want to use the other way the FOR loop must be inside the Do
> Until loop.
>
>
> "David Gordon" <david@scene-double.co.uk> wrote in message
> news:Ol6nepk6DHA.2572@TK2MSFTNGP09.phx.gbl...[color=green]
> > Alex,
> >
> > This works well, but now I have the following problem.
> > I have the following code, but all the passwords listed as '*', are
> > displaying the same number of characters even though they should display
> > different numbers of characters..
> >
> > My code....
> >
> > _____________________________________________
> > else
> >
> > For i = 1 to Len(RS("Password"))
> > strPass = strPass & "*"
> > Next
> >
> > response.write blah blah blah....
> >
> > do until RS.EOF
> >
> > response.write "<tr><td>" & RS("UserID") & "</TD><TD>" & strPass &
> > "</TD><TD>" & RS("Email") & "</td></tr>"
> >
> > RS.movenext
> >
> > loop
> >
> > _________________________________________
> >
> >
> > If I take the For loop out of the Do loop then it lists the passwords as
> > the first one only...I understand this. If it is left in the do loop, it
> > just adds the characters on for each user, so, it displays longer &
> > longer passwords...
> >
> > I want it to display the number of characters in each users password as
> > follows:
> >
> > User 1, password: ****
> > User 2, password: ********
> > User 3, password: ******
> >
> > not...where all passwords shown are for user1
> >
> > User 1, password: ****
> > User 2, password: ****
> > User 3, password: ****
> >
> > or, where it just appends on to the end each loop
> >
> > User 1, password: ****
> > User 2, password: ********
> > User 3, password: ************
> >
> > What is the solution.....thanks.
> >
> > David
> >
> >
> > *** Sent via Developersdex http://www.developersdex.com ***
> > Don't just participate in USENET...get rewarded for it![/color]
>
>[/color]


  #20  
Old July 19th, 2005, 11:38 AM
Chris Barber
Guest
 
Posts: n/a
Default Re: Convert all characters to ' * ' where password is displayed...

Reset strPass to be vbNullString or "" at the start of each loop:

'Loop through the records.
Do Until RS.EOF

'No need to reset the password starts value if we are doing assignment only.
'Determine the correct length and fill with stars.
strPass = String(Len(RS.Fields("Password").Value), "*")

'Write the string to the browser
Response.Write "<tr><td>" & RS.Fields("UserID").Value & "</TD><TD>" &
strPass &
"</TD><TD>" & RS.Fields("Email").Value & "</td></tr>"

RS.MoveNext

Loop

NB: You should also be storing the password 'encrypted' in the DB - depends
on how paranoid you are!

Chris.

"David Gordon" <david@scene-double.co.uk> wrote in message
news:Ol6nepk6DHA.2572@TK2MSFTNGP09.phx.gbl...
Alex,

This works well, but now I have the following problem.
I have the following code, but all the passwords listed as '*', are
displaying the same number of characters even though they should display
different numbers of characters..

My code....

_____________________________________________
else

For i = 1 to Len(RS("Password"))
strPass = strPass & "*"
Next

response.write blah blah blah....

do until RS.EOF

response.write "<tr><td>" & RS("UserID") & "</TD><TD>" & strPass &
"</TD><TD>" & RS("Email") & "</td></tr>"

RS.movenext

loop

_________________________________________


If I take the For loop out of the Do loop then it lists the passwords as
the first one only...I understand this. If it is left in the do loop, it
just adds the characters on for each user, so, it displays longer &
longer passwords...

I want it to display the number of characters in each users password as
follows:

User 1, password: ****
User 2, password: ********
User 3, password: ******

not...where all passwords shown are for user1

User 1, password: ****
User 2, password: ****
User 3, password: ****

or, where it just appends on to the end each loop

User 1, password: ****
User 2, password: ********
User 3, password: ************

What is the solution.....thanks.

David


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


  #21  
Old July 19th, 2005, 11:39 AM
Ravichandran J.V.
Guest
 
Posts: n/a
Default Re: Convert all characters to ' * ' where password is displayed...

Yes, I would agree that Weird is the right word to describe the OP and
the praise for the first answer is even more Awesome! But, for the Admin
the display of passwords is sometimes on in smaller websites where the
number of users are less and are likely to ask for passwords to be sent
to a new email Id (Of course if this is provided for in the FAQ).

with regards,


J.V.Ravichandran
- http://www.geocities.com/
jvravichandran
- http://www.411asp.net/func/search?
qry=Ravichandran+J.V.&cob=aspnetpro
- http://www.southasianoutlook.com
- http://www.MSDNAA.Net
- http://www.csharphelp.com
- http://www.poetry.com/Publications/
display.asp?ID=P3966388&BN=999&PN=2
- Or, just search on "J.V.Ravichandran"
at http://www.Google.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 

Bookmarks

Thread Tools

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

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles