| | |
Passsword Strength Checker
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
Passsword Strength Checker
php Syntax (Toggle Plain Text)
<?php function testPassword($password) { if ( strlen( $password ) == 0 ) { return 1; } $strength = 0; /*** get the length of the password ***/ $length = strlen($password); /*** check if password is not all lower case ***/ if(strtolower($password) != $password) { $strength += 1; } /*** check if password is not all upper case ***/ if(strtoupper($password) == $password) { $strength += 1; } /*** check string length is 8 -15 chars ***/ if($length >= 8 && $length <= 15) { $strength += 1; } /*** check if lenth is 16 - 35 chars ***/ if($length >= 16 && $length <=35) { $strength += 2; } /*** check if length greater than 35 chars ***/ if($length > 35) { $strength += 3; } /*** get the numbers in the password ***/ preg_match_all('/[0-9]/', $password, $numbers); $strength += count($numbers[0]); /*** check for special chars ***/ preg_match_all('/[|!@#$%&*\/=?,;.:\-_+~^\\\]/', $password, $specialchars); $strength += sizeof($specialchars[0]); /*** get the number of unique chars ***/ $chars = str_split($password); $num_unique_chars = sizeof( array_unique($chars) ); $strength += $num_unique_chars * 2; /*** strength is a number 1-10; ***/ $strength = $strength > 99 ? 99 : $strength; $strength = floor($strength / 10 + 1); return $strength; } /*** example usage ***/ $password = 'qwer1234'; echo testPassword($password); ?>
Ayesha
Here is an interesting page that could be used to create a password strength meter:
http://www.lockdown.co.uk/?pg=combi
http://www.lockdown.co.uk/?pg=combi
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
![]() |
Similar Threads
- SEO type scripts need eg page rank checker (Existing Scripts)
- Cannot open certain websites, including hotmail (Web Browsers)
- Signal strength from router to computer (Networking Hardware Configuration)
- Wireless Networks: Strength-vs-Speed? (Networking Hardware Configuration)
- how can you increase your signal strength (Networking Hardware Configuration)
- Looking for mail checker (Windows Software)
- creating a grammer checker in c++ (C++)
Other Threads in the PHP Forum
- Previous Thread: Save a webpage?
- Next Thread: Extremely Simple Menu Generator
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl database date directory display download dynamic echo email encode error fcc file files folder form forms function functions google howtowriteathesis href htaccess html image images include insert integration ip java javascript joomla ldap limit link login loop mail menu methods mlm mod_rewrite multiple multipletables mysql oop open parse paypal pdf php problem query radio random recursion regex remote script search server sessions sms soap source space speed sql structure syntax system table template tutorial update upload url validation validator variable video web xml youtube






