1

validatedbpassword

validate_db_password
SYNOPSIS

validate_db_password($s)

DESCRIPTION

validate_db_password returns true if $s is a secure password for a DB connector, otherwise false.

CODE
  1. function validate_db_password($s) {
  2.     $charset = array('ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz', '0123456789', '~!@#$%^&*()_-+={}[]/<>,.;?:|');
  3.  
  4.     if (strlen($s) < 10) {
  5.         return false;
  6.     }
  7.  
  8.     foreach ($charset as $chars) {
  9.         if (preg_match_all('/[' . preg_quote($chars, '/') . ']/', $s) < 2) {
  10.             return false;
  11.         }
  12.     }
  13.  
  14.     return true;
  15. }
SEE ALSO

newdbpassword, validatepassword

Comments

Your comment:
[p] [b] [i] [u] [s] [quote] [pre] [br] [code] [url] [email] strip help 2000

Enter a maximum of 2000 characters.
Improve the presentation of your text with the following formatting tags:
[p]paragraph[/p], [b]bold[/b], [i]italics[/i], [u]underline[/u], [s]strike[/s], [quote]citation[/quote], [pre]as is[/pre], [br]line break,
[url]http://www.izend.org[/url], [url=http://www.izend.org]site[/url], [email]izend@izend.org[/email], [email=izend@izend.org]izend[/email],
[code]command[/code], [code=language]source code in c, java, php, html, javascript, xml, css, sql, bash, dos, make, etc.[/code].