Last active
November 14, 2023 06:55
-
-
Save antimech/c42e775e44edfaec62be8eccd829d456 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
#!/usr/bin/env php8.1 | |
<?php | |
const CAPTCHA_LENGTH = 6; | |
$captchaSymbolsWhitelist = [ | |
'I', 'U', 'Y', 'D', 'F', 'G', 'J', 'L', 'N', 'Q', 'R', 'S', 'V', 'W', 'Z', | |
'2', '3', '4', '5', '6', '7', '8', '9', | |
]; | |
$whitelistLength = sizeof($captchaSymbolsWhitelist); | |
$captchaString = ''; | |
for ($i = 0; $i < CAPTCHA_LENGTH; $i++) { | |
$rand = random_int(0, $whitelistLength - 1); | |
$captchaString .= $captchaSymbolsWhitelist[$rand]; | |
} | |
echo $captchaString; | |
echo PHP_EOL; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment