Skip to content

Instantly share code, notes, and snippets.

@aligoren
Created September 5, 2014 15:31
Show Gist options
  • Save aligoren/f43c561cd314996fbf0d to your computer and use it in GitHub Desktop.
Save aligoren/f43c561cd314996fbf0d to your computer and use it in GitHub Desktop.
<?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