Skip to content

Instantly share code, notes, and snippets.

@quisido
Created August 2, 2018 22:31
Show Gist options
  • Save quisido/ad2575bb261cf896b6051c41f4c4bfd1 to your computer and use it in GitHub Desktop.
Save quisido/ad2575bb261cf896b6051c41f4c4bfd1 to your computer and use it in GitHub Desktop.
Establishing a Secure Password Generator for Your User Base
<?php
$characters =
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' .
'0123456789`~!@#$%^&*()_-+=[{]}|;:,.<>/?';
$strlen_characters = strlen($characters);
function password($length) {
$temp = "";
for ($x = 0; $x < $length; $x++)
$temp .= $characters[rand(0, $strlen_characters - 1)];
return $temp;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment