Last active
February 27, 2016 08:24
-
-
Save susemeee/31004278da406dc96d6f to your computer and use it in GitHub Desktop.
P for predictable
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 | |
mb_internal_encoding("UTF-8"); | |
// Generate CAPTCHA code if not set by user | |
$characters = "가나다라마바사아자차카타파하갸냐댜랴먀뱌샤야쟈챠캬탸퍄햐거너더러머버서어저처커터퍼허겨녀뎌려며벼셔여져쳐켜텨펴혀고노도로모보소오조초코토포호교뇨됴료묘뵤쇼요죠쵸쿄툐표효구누두루무부수우주추쿠투푸후규뉴듀류뮤뷰슈유쥬츄큐튜퓨휴그느드르므브스으즈츠크트프흐기니디리미비시이지치키티피히"; | |
srand(time(0)); | |
$captcha = ''; | |
$length = 5; | |
while( mb_strlen($captcha) < $length ) { | |
$captcha .= mb_substr($characters, rand() % (mb_strlen($characters)), 1); | |
} | |
echo $captcha; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment