Skip to content

Instantly share code, notes, and snippets.

@exitcas
Created November 15, 2021 17:53
Show Gist options
  • Save exitcas/9bf40938d0112b3b3db1f73440bc492c to your computer and use it in GitHub Desktop.
Save exitcas/9bf40938d0112b3b3db1f73440bc492c to your computer and use it in GitHub Desktop.
<?php /* Key generator */
function genKey($n) {
$chars="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz;!#$?%:*,_.";
$id = ''; $thing=0;
for ($i=0; $i<$n; $i++) {
$r = rand(0, strlen($chars)-1);
$id .= $chars[$r];
}
return $id;
}
if(isset($_GET["k"])){$key=$_GET["k"];}else{$key = genKey(9);} echo $key."<br>".password_hash($key, PASSWORD_DEFAULT); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment