Created
September 5, 2014 15:31
-
-
Save aligoren/f43c561cd314996fbf0d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Random Password Generator | |
* @param $olustur = new SifreOlusturucu(); or $olustur = new SifreOlusturucu(16); | |
* @param $olustur->sifreOlustur(); // output: wIsLiXzH1uP@hqSm | |
* @author Ali GOREN | |
* @copyright Ali GOREN | |
* @link http://blog.aligoren.net | |
* @package: SifreOlusturucu | |
*/ | |
class SifreOlusturucu { | |
//var $boyut; test | |
function __construct($boyut = 8) { // 8 default, 14 or more good and recommended length | |
$this->boyut = $boyut; | |
} | |
function sifreOlustur() { | |
//$this->boyut; | |
$karakterler = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_-=+;:,.?'; | |
$sifre = substr( str_shuffle( $karakterler ), 0, $this->boyut); | |
print_r($sifre); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment