Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

PHP and passwords


  • Please log in to reply
3 replies to this topic

#1 Reddoug

Reddoug

  • Members
  • 115 posts
  • OFFLINE
  •  
  • Local time:02:19 AM

Posted 17 March 2013 - 12:15 PM

Hi

 

I am trying to come up with a script that will put out ******** instsead of showing the password.

 

This is waht I am working with. I checks that the password is valid and if it is valid it will show the password

 

if ($_POST['EmailAddress'] == '')
    {
        $EmailAddress = '<span style="color:red;">Email Address omitted.</span>';
    }
    else
    {
    $EmailAddress = $_POST['EmailAddress'];
    }

    if (!preg_match("/^([a-zA-Z0-9])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)+/", $_POST['EmailAddress']))
    {
    die("Invalid e-mail address");
    }

 

I tried adding this but not having any luck getting it to work.

 

$Password1 = 'Password1';

$hash = crypt($Password1);

 

Thanks, Doug

 



BC AdBot (Login to Remove)

 


#2 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:01:19 AM

Posted 18 March 2013 - 12:17 PM

Try preg_replace

http://www.php.net/manual/en/function.preg-replace.php

 

Or you could loop through the string and do a str_replace on each letter.

Or you could do a letter count on the string, and just create a string with that many asterisks.



#3 Grinler

Grinler

    Lawrence Abrams


  • Admin
  • 43,640 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:USA
  • Local time:03:19 AM

Posted 18 March 2013 - 12:17 PM

I am not 100% sure what you are trying to do, but if you want *s when they enter a password in a form, you should use an input type of password.

Examples are shown here:

http://www.w3schools.com/html/tryit.asp?filename=tryhtml_inputpassword

#4 Reddoug

Reddoug
  • Topic Starter

  • Members
  • 115 posts
  • OFFLINE
  •  
  • Local time:02:19 AM

Posted 27 March 2013 - 11:54 AM

Thanks for the links, I will give them a try and see if I can make it work.

 

Doug






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users