
åæ¯
ä»æ¥ãã€ã³ã¿ãŒãããã«ã¯ããããã«å¯Ÿããä¿è·ãçµç¹åããç¬èªã®æ¹æ³ã«ã€ããŠããŸããŸãªäœè ã説æããç¡æ°ã®æ瀺ãããµããŠããŸãããããã®äœè ã®ã»ãšãã©ããã®èšèªã«ãã³ããæã£ãŠããã®ã¯æ®å¿µã§ãã ããšãã°ã Real PersonãšåŒã°ããjQueryãã©ã°ã€ã³ã¯æ¬¡ã®ããã«ãªããŸããããŒãžäžã«äŒŒããããªãã®ãäœæãããŸãã

ããã«ãç»åã䜿çšããã«ããã¹ãŠã®æåã1ã€ã®ã·ã³ãã«ïŒ ã¢ã¹ã¿ãªã¹ã¯ ïŒã®ã¿ã䜿çšããŠäœæãããããšã«æ³šæãã䟡å€ããããŸãã èè ã®ãµã€ãã«ã¯ãã»ãã¥ãªãã£ã³ãŒããçæããããã«é·ããšæåã»ãããç°¡åã«å€æŽã§ããäŸã瀺ãäŸããããŸãã ãŸããæåã®æ£ããå ¥åããã§ãã¯ããããã®ãµãŒããŒãµã€ãã¹ã¯ãªããã®äŸããããŸãã
if (rpHash($_POST[ 'realPerson' ]) == $_POST[ 'realPersonHash' ]) {
* This source code was highlighted with Source Code Highlighter .
E-mineããããŠããã¯Epic FailïŒ åäŸã®ãªãæãããèè ã¯ããŠãŒã¶ãŒããåãåã£ãããŒã¿ãå®å šã«ä¿¡é Œããããšãææ¡ããŸãã ãã®ãããªãã§ãã¯ã¯ä¿¡é Œã§ããŸã...圌ã¯ãããèªåèªèº«ã§ããä¿¡ããŸããïŒïŒ ãrpHashïŒïŒãé¢æ°ã®ãœãŒã¹ã³ãŒãããã®ãã©ã°ã€ã³ã®äœæè ã®Webãµã€ãã«èšèŒãããŠããããšãèæ ®ãããšããã®ãããªãã¹ããæ確ãªè¯å¿ããã£ãŠæžãããšãã§ããŸããã
if ($_POST[ 'In' ])== $_POST[ 'Out' ]) {
* This source code was highlighted with Source Code Highlighter .
ç§ã®æèŠã§ã¯ãæ»æè ã«ãããã€ãã¹ã®è€éãã«é¢ããŠãäžèšã®2è¡ã®ã³ãŒãã¯å®å šã«åäžã§ãã ããã§ãããã®ã¿ã€ãã®ãã¥ãŒãªã³ã°ãã¹ãã¯éåžžã«ææã§ãããšèããŠããããããã®ãããªä¿è·ã®çµç¹ã«é¢ããç§ã®ããžã§ã³ã説æããããšã«ããŸããã
解決æ¹æ³
ãã®CAPTCHAã¯ãã©ãã³ã¢ã«ãã¡ããããšã¢ã©ãã¢æ°åã®æåã®ã»ããã§ãã åã·ã³ãã«ã¯7x7ãããªãã¯ã¹ã§ãã ãããªãã¯ã¹å ã®ä»»æã®ã»ã«ã¯ãå æãŸãã¯è§£æŸã§ããŸãã 䜿çšäžã®ã»ã«ã¯ãããã©ã«ãã§æãèæ¯ãæã¡ã空ããŠããã»ã«ã¯éæã§ãã

æåãMãã®äŸã
ä»»æã®ã»ã«ã¯ã2ã€ã®åº§æšïŒxããã³yïŒã䜿çšããŠäžæã«æ±ºå®ã§ããŸãã ã·ã³ãã«ãå®å šã«åäœæããã«ã¯ã1çš®é¡ã®ã»ã«ã®åº§æšã®ã¿ãç¥ãã ãã§ååã§ãã å æã»ã«ã®åº§æšã¯ã空ãã»ã«ã®æ°ãããæ°åå°ãªããããæ ŒçŽããã®ã劥åœã§ãã ãã®æ å ±ãä¿åããããã«é åã䜿çšãããŸãã
é åïŒx1ãy1ãx2ãy2 ...ãxNãyNïŒ
äžèšã«åºã¥ããŠãæåãMãã¯æ¬¡ã®ããã«ãªããŸãã
$abc[ 'm' ] = array(1,1,7,1,1,2,2,2,6,2,7,2,1,3,3,3,5,3,7,3,1,4,4,4,7,4,1,5,7,5,1,6,7,6,1,7,7,7);
* This source code was highlighted with Source Code Highlighter .
æååãçæããå ŽåãåŸç¶ã®åæåã®x座æšã®n * 7ã»ã«ã®ã·ãããèæ ®ããå¿ èŠããããŸãïŒnã¯å è¡æåã®æ°ã§ãïŒã

ãããã£ãŠããã®æååã¯ã2ã€ã®é åmïŒxãyïŒãšaïŒx + 7ãyïŒãçµåããçµæã®é åãšããŠåæåã§ããŸãã
è¡åº§æšã®é åã®ãžã§ãã¬ãŒã¿ãŒã¯æ¬¡ã®ããã«ãªããŸãã
Php
*ãã®ãœãŒã¹ã³ãŒãã¯ã ãœãŒã¹ã³ãŒããã€ã©ã€ã¿ãŒã§åŒ·èª¿è¡šç€ºãããŸããã
- //å©çšå¯èœãªãã¹ãŠã®ã¢ã«ãã¡ããã
- $ alphanum = 'abcdefghijkmnopqrstuvxyz0123456789' ;
- //ã«ãŒãããã£ã©ã¯ã¿ãŒçæã
- //ã«ãŒãã®å埩åæ°ã¯æååã®æåæ°ã«çãã
- for ïŒ$ i = 0; $ i <$ the_number_of_letters; ++ $ iïŒ{
- //æåãã©ã³ãã ã«éžæããŸã
- $ letter = $ alphanum [intvalïŒmt_randïŒ0ã33ïŒïŒ];
- //æåã®é åãäœæããŸã$ array_str
- foreach ïŒ$ abc [$ letter] as $ key => $ valïŒ
- //ãæ£ããã座æšãé åã«é 眮ãããŸã
- array_pushïŒ$ array_strãïŒ$ keyïŒ 2 == 0ïŒïŒ$ val +ïŒ$ i * 7ïŒïŒ$ valïŒ;
- //æååèªäœãèšæ¶ãããŸã
- $ di_captcha_strã= $ã¬ã¿ãŒ;
- }
ã·ã³ãã«ã¯ãæå®ãããå·Šæãã®ã¿ã°ã䜿çšããŠèŠèŠåãããŸã-ãããŒãïŒå·Šããã³æ確ã«å®çŸ©ãããé·ããšé«ãã®å¯žæ³ã ååãšããŠãã©ã®ãããã¯èŠçŽ ããã®ç®çã«é©ããŠããŸããã䜿çšå¯èœãªæãçãã¿ã°ã®1ã€ã§ãããããéžæãããã«åœãããŸããã åºåã³ãŒãèªäœïŒ
JavaScriptïŒjQueryïŒ
*ãã®ãœãŒã¹ã³ãŒãã¯ã ãœãŒã¹ã³ãŒããã€ã©ã€ã¿ãŒã§åŒ·èª¿è¡šç€ºãããŸããã
- //ã¿ã°ä»ãã®ãããã¯é·
- //åè¡ã®ã¿ã°ã®æ°ã¯ãã®å€ã«äŸåããŸã
- //æ°åŒnumber_cells + indent_size_between_cells * 7ã§èšç®
- // + double_size_cell-æåéã®ã€ã³ãã³ã
- //ãããŠãããã¯ãã¹ãŠæåæ°nã§ä¹ç®ãããŸã
- $ïŒ '#DICaptchaPic' ïŒ. css ïŒ 'width' ãïŒïŒïŒïŒïŒcell_size + 2ïŒ* 6ïŒ+ïŒ3 * cell_sizeïŒ+1ïŒ* nïŒïŒ;
- //ã¿ã°ãªã¹ããä¿åããå€æ°
- var html_p_tag = '' ;
- //é åå šäœãã»ã«ã§æšªæããã«ãŒã
- for ïŒi = 1; i <= 7 * 7 * n; ++ iïŒ{
- //ã»ã«ã7ã®åæ°ã§ããå Žåãããã¯æåã®æåŸã§ã
- //ãããã£ãŠããã®åŸãã€ã³ãã³ãã¯èšå·éã§å¿ èŠã§ã
- var style =ïŒiïŒ 7 == 0ïŒïŒ 'ããŒãžã³å³ïŒ' + 2 * cell_size + 'px;' ïŒ '' ;
- //ã»ã«ãããžãŒã®å Žåããã®èæ¯ã¯é»ã§ã
- for ïŒj = 0; j <data [1] .length; j + = 2ïŒstyle + =ïŒïŒïŒiïŒ ïŒdata [0] * 7ïŒ== 0ïŒïŒïŒdata [0] * 7ïŒïŒ iïŒ ïŒããŒã¿[0] * 7ïŒïŒ==ããŒã¿[1] [j] && Math.ceilïŒi /ïŒããŒã¿[0] * 7ïŒïŒ==ããŒã¿[1] [j + 1]ïŒïŒ ãèæ¯è²ïŒïŒ000;ã ïŒ '' ;
- //ã¿ã°ãéããŸã
- html_p_tag + = '<p' +ïŒïŒstyle == '' ïŒïŒ '' ïŒ 'style = \' ' + style + ' \ '' ïŒ+ '>' ; }
ã泚æ ãã¹ããããã«ãŒãã®ããããã®ã¢ã«ãŽãªãºã ã®è€éãã¯OïŒn * nïŒãšæšå®ãããŸãã æ¡ä»¶ãæ£åžžã«æºãããããšãã«åŒã³åºãããbreakã³ã³ã¹ãã©ã¯ãã2çªç®ã®ã«ãŒãã«è¿œå ããããšã§æ¹åã§ããŸãã2çªç®ã®ã«ãŒãã§ã¯ãçŸåšã®ããã«é åå šäœã§ã¯ãªãé åã®äžéšã®ã¿ãã¹ãã£ã³ãããŸãã ãŸããå åŽã®ã«ãŒããåé€ããŠãæåã®ã¿ã°ã§ãã¹ãŠã®ã¿ã°ã«äžæã®IDãå²ãåœãŠãããšãã§ããŸããããã«ããã2çªç®ã®ã«ãŒãã§ã¿ã°ãç°¡åã«èªèã§ããŸãã ããã«ããã³ãŒãããããã«å¢å ããŸãããæäœã®é床ã¯èããåäžããŸãã
çµæã¯æ¬¡ã®è¡ã§ãã

æ¹å€ãšä¿®æ£
1. jsã§ããŒããããšãã«ãé åã座æšã§ã€ã³ã¿ãŒã»ãããããã³ãã¬ãŒããšæ¯èŒããŠæååã埩å·åããã ãã§ååã§ãã getïŒïŒé¢æ°ããã®é åãè¿ãåã«ãã¢ãæ··åšããããšããã³ãã¬ãŒãã®äœ¿çšãnåè€éã«ãªããŸãã
ãããã£ãŠã座æšã®é åãè¿ãåã«ãã¯ã©ã¹ã§shuffle2ã¡ãœãããåŒã³åºãããŸãããã®ã¡ãœããã¯ãxãšyã®ãã¢ãæ··åããããšãªããé åãéãã«ã·ã£ããã«ããŸãã
Php
*ãã®ãœãŒã¹ã³ãŒãã¯ã ãœãŒã¹ã³ãŒããã€ã©ã€ã¿ãŒã§åŒ·èª¿è¡šç€ºãããŸããã
- é¢æ°shuffle2ïŒ$é åïŒ{
- for ïŒ$ i = 0; $ i <countïŒ$ arrayïŒ; $ i + = 2ïŒ
- for ïŒ$ j = countïŒ$ arrayïŒ-2; $ j> $ i; $ j-= 2ïŒ
- if ïŒmt_randïŒ0ã1ïŒ> 0ïŒ{
- $ array [$ i] + = $ array [$ j]; $é å[$ j] = $é å[$ i]-$é å[$ j]; $ array [$ i]-= $ array [$ j];
- $ array [$ i + 1] + = $ array [$ j + 1]; $é å[$ j + 1] = $é å[$ i + 1]-$é å[$ j + 1]; $ array [$ i + 1]-= $ array [$ j + 1];
- }
- $é åãè¿ããŸãã
- }
2.ã©ã³ãã ãã€ãºã座æšé åã«è¿œå ãããšãå®éã«ã¯ãã¿ãŒã³ã䜿çšã§ããªããªããŸãã
ãã€ãºã¯2ã€ã®ã¿ã€ãã«ãªããŸããå æã»ã«ãè©°ãŸãããããšã§ãããã解æŸãããã€ãºãšãäžéšã®ç©ºãã»ã«ãå æã«å€æãããããã¯ã°ã©ãŠã³ãã«äŒæãããã€ãºã§ãã
ãããè¡ãããã«ãè¡åº§æšã®é åã®ãžã§ãã¬ãŒã¿ãŒããããã«å€æŽãããŸããã
Php
*ãã®ãœãŒã¹ã³ãŒãã¯ã ãœãŒã¹ã³ãŒããã€ã©ã€ã¿ãŒã§åŒ·èª¿è¡šç€ºãããŸããã
- //ã¯ã©ã¹ãªããžã§ã¯ããäœæããããš$ this-> noiseãåæåãããŸã
- // 0ïŒãã€ãºãªãïŒãã10ãŸã§ã®å€ãåãããšãã§ããŸã
- $ alphanum = 'abcdefghijkmnopqrstuvxyz0123456789' ;
- //ã¡ã€ã³ã«ãŒã
- for ïŒ$ i = 0; $ i <$ this-> the_number_of_letters; ++ $ iïŒ{
- $ letter = $ alphanum [intvalïŒmt_randïŒ0ã33ïŒïŒ];
- for ïŒ$ j = 0; $ j <countïŒ$ this-> abc [$ letter]ïŒ; $ j + = 2ïŒ
- //å éšãã€ãº
- if ïŒmt_randïŒ1ã100ïŒ> $ this-> noise * 5ïŒ
- array_pushïŒ$ this-> array_strã$ this-> abc [$ letter] [$ j] +ïŒ$ i * 7ïŒã$ this-> abc [$ letter] [$ j + 1]ïŒ;
- //èæ¯ã®ãã€ãº
- for ïŒ$ j = 0; $ j <7 * 7 *ïŒ$ this-> noise / 20ïŒ; ++ $ jïŒ{
- array_pushïŒ$ this-> array_strãmt_randïŒ1ã7ïŒ+ïŒ$ i * 7ïŒãmt_randïŒ1ã7ïŒïŒ;
- }
- $ _SESSION [ 'di_captcha_str' ]ã= $ã¬ã¿ãŒ;
- }
- return $ this-> shuffle2ïŒ$ this-> array_strïŒ;
èŠçŽãããšïŒ

å®å šã«æ©èœããäŸ
ã¡ã€ã³ã¯ã©ã¹ïŒ
Php
*ãã®ãœãŒã¹ã³ãŒãã¯ã ãœãŒã¹ã³ãŒããã€ã©ã€ã¿ãŒã§åŒ·èª¿è¡šç€ºãããŸããã
- //ã³ã³ã¹ãã©ã¯ã¿ã¯ãæååã®é·ããããã©ã«ãã§6ã«èšå®ããŸãã
- //ã¯ã©ã¹ã¡ãœããïŒ
- // shuffle2ïŒïŒ-é åãã·ã£ããã«ããŸãã
- // setïŒïŒ-ã¯ã©ã¹ã®äžéšã®ãã£ãŒã«ãã®å€ãå€æŽã§ããŸãã
- // getïŒïŒ-座æšã®é åãè¿ããæååèªäœãã»ãã·ã§ã³ã«å ¥ããŸãã
- // checkïŒïŒ-ãŠãŒã¶ãŒãå ¥åããããã¹ããååŸããã»ãã·ã§ã³ã§èšé²ãããæååãšæ¯èŒããŸãã
- åå空é di;
- ã¯ã©ã¹ captcha {
- private $ strã$ array_str = arrayïŒïŒã$ abc = arrayïŒïŒã$ the_number_of_letters = 6ã$ noise = 1;
- é¢æ°__constructïŒ$ the_number_of_letters = 6ïŒ{
- $ this-> the_number_of_letters = $ the_number_of_letters;
- $ this-> abc [ 'a' ] = arrayïŒ4,1,3,2,5,2,3,3,5,3,2,4,6,4,2,5,3,5,4 ã5ã5ã5ã6ã5ã1ã6ã7ã6ã1ã7ã7ã7ïŒ;
- $ this-> abc [ 'b' ] = arrayïŒ1,1,2,1,3,1,4,1,5,1,6,1,1,2,7,2,1,3,7 ã3ã1ã4ã2ã4ã3ã4ã4ã4ã4ã5ã4ã6ã4ã1ã5ã7ã5ã1ã6ã7ã6ã1ã7ã2ã7 ã3ã7ã4ã7ã5ã7ã6ã7ïŒ;
- $ this-> abc [ 'c' ] = arrayïŒ2,1,3,1,4,1,5,1,6,1,1,2,7,2,1,3,1,4,1 5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ã6ã7ïŒ;
- $ this-> abc [ '4' ] = arrayïŒ5,1,4,2,5,2,3,3,5,3,2,4,5,4,1,5,2,5,3 ã5ã4ã5ã5ã5ã6ã5ã7ã5ã5ã6ã5ã7ïŒ;
- $ this-> abc [ '5' ] = arrayïŒ1,1,2,1,3,1,4,1,5,1,6,1,7,1,1,2,1,3,2 ã3ã3ã3ã4ã3ã5ã3ã6ã3ã7ã4ã7ã5ã1ã6ã7ã6ã2ã7ã3ã7ã4ã7ã5ã7 ã6.7ïŒ;
- $ this-> abc [ '6' ] = arrayïŒ3,1,4,1,5,1,6,1,2,2,1,3,1,4,2,4,3,4,4 4,5,4,6,4,1,5,7,5,1,6,7,6,2,7,3,7,4,7,5,7,6,7ïŒ;
- $ this-> abc [ '7' ] = arrayïŒ1,1,2,1,3,1,4,1,5,1,6,1,7,1,6,2,5,3,4 ã4ã3ã5ã2ã6ã1ã7ïŒ;
- $ this-> abc [ '8' ] = arrayïŒ2,1,3,1,4,1,5,1,6,1,1,2,7,2,1,3,7,3,2 ã4ã3ã4ã4ã4ã5ã4ã6ã4ã1ã5ã7ã5ã1ã6ã7ã6ã2ã7ã3ã7ã4ã7ã5ã7 ã6.7ïŒ;
- $ this-> abc [ '9' ] = arrayïŒ2,1,3,1,4,1,5,1,6,1,1,2,7,2,1,3,7,3,2 ã4ã3ã4ã4ã4ã5ã4ã6ã4ã4ã4ã4ã7ã5ã6ã6ã2ã7ã3ã7ã4ã7ã5ã7ïŒ;
- }
- ãã©ã€ããŒãé¢æ°shuffle2ïŒ$é åïŒ{
- for ïŒ$ i = 0; $ i <countïŒ$ arrayïŒ; $ i + = 2ïŒ
- for ïŒ$ j = countïŒ$ arrayïŒ-2; $ j> $ i; $ j-= 2ïŒ
- if ïŒmt_randïŒ0ã1ïŒ> 0ïŒ{
- $ array [$ i] + = $ array [$ j]; $é å[$ j] = $é å[$ i]-$é å[$ j]; $ array [$ i]-= $ array [$ j];
- $ array [$ i + 1] + = $ array [$ j + 1]; $é å[$ j + 1] = $é å[$ i + 1]-$é å[$ j + 1]; $ array [$ i + 1]-= $ array [$ j + 1];
- }
- $é åãè¿ããŸãã
- }
- é¢æ°ã»ãã ïŒ$ååã$ valïŒ{
- switch ïŒ$ nameïŒ{
- ã±ãŒã¹ ãthe_number_of_lettersã ïŒ
- $ this-> the_number_of_letters =ïŒ int ïŒ$ val;
- äŒæ© ;
- ã±ãŒã¹ ããã€ãºã ïŒ
- $ this-> noise =ïŒ int ïŒ$ val;
- äŒæ© ;
- ããã©ã«ã ïŒ
- falseã è¿ã ãŸã ã
- }
- trueã è¿ã ãŸã ã
- }
- é¢æ°get ïŒïŒ{
- $ alphanum = 'abcdefghijkmnopqrstuvxyz0123456789' ;
- èšå®è§£é€ïŒ$ _ SESSION [ 'di_captcha_str' ]ïŒ;
- for ïŒ$ i = 0; $ i <$ this-> the_number_of_letters; ++ $ iïŒ{
- $ letter = $ alphanum [intvalïŒmt_randïŒ0ã33ïŒïŒ];
- // foreachïŒ$ this-> abc [$ letter] as $ key => $ valïŒ
- // array_pushïŒ$ this-> array_strãïŒ$ keyïŒ 2 == 0ïŒïŒ$ val +ïŒ$ i * 7ïŒïŒ$ valïŒ;
- for ïŒ$ j = 0; $ j <countïŒ$ this-> abc [$ letter]ïŒ; $ j + = 2ïŒ
- if ïŒmt_randïŒ1ã100ïŒ> $ this-> noise * 5ïŒ
- array_pushïŒ$ this-> array_strã$ this-> abc [$ letter] [$ j] +ïŒ$ i * 7ïŒã$ this-> abc [$ letter] [$ j + 1]ïŒ;
- for ïŒ$ j = 0; $ j <7 * 7 *ïŒ$ this-> noise / 20ïŒ; ++ $ jïŒ{
- array_pushïŒ$ this-> array_strãmt_randïŒ1ã7ïŒ+ïŒ$ i * 7ïŒãmt_randïŒ1ã7ïŒïŒ;
- }
- $ _SESSION [ 'di_captcha_str' ]ã= $ã¬ã¿ãŒ;
- }
- return $ this-> shuffle2ïŒ$ this-> array_strïŒ;
- }
- é¢æ°ãã§ãã¯ïŒ$ in_stringïŒ{
- echo in_stringã ã|ã ã$ _ SESSION [ 'di_captcha_str' ];
- return ïŒstrtolowerïŒ$ in_stringïŒ== $ _SESSION [ 'di_captcha_str' ]ïŒïŒ true ïŒ false ;
- }
- }
pharãäœæããŠå§çž®ãããšãééã3.53kbã®ãã¡ã€ã«di_captcha.class.phar.gzãåŸãããŸãã
ã¯ã©ã¹ã®äœ¿çšäŸïŒ
PHP + html
// index.php
//
session_start();
// THE_NUMBER_OF_LETTERS â ,
define( 'THE_NUMBER_OF_LETTERS' , 6);
// js , .
if (isset($_POST[ 'action' ]{14}) && $_POST[ 'action' ] == 'captcha_refresh' ) {
require 'phar://di_captcha.class.phar.gz/di_captcha.class.php' ;
$captcha = new di\captcha();
$captcha-> set ( 'noise' , 0);
echo json_encode(array(THE_NUMBER_OF_LETTERS, $captcha-> get ()));
} else {
? > <br> <! DOCTYPE html > <br> < html > <br> < head > <br> < meta charset ='utf-8' > <br> < title > Test </ title > <br> < link rel ='stylesheet' media ='all' href ='style.css' > <br> < script type ='text/javascript' src ='jquery-1.6.1.min.js' charset ='utf-8' ></ script > <br> src= 'script.js' charset= 'utf-8' > </ script > <br> </ head > <br> < body > <br> < p id ='Title' > -, ! </ p > <br> < p id ='Msg' > <br> <? php <br> if ( isset ($ _POST [ 'action' ]{ 11 }) &# && ; $ _POST [ 'action' ] == 'captcha_send' ) {;<br> require 'phar://di_captcha.class.phar.gz/di_captcha.class.php' ;<br> $ captcha = new di \ captcha ();<br> echo ($ captcha- > check($_POST['text_captcha']))?'- !':' , ...';<br> }<br> ? > <br> </ p > <br> < form action ='index.php' method ='post' > <br> < div id ='DICaptchaPic' ></ div > <br> < p style ='padding: 0 10px;' > <br> < input type ='text' name ='text_captcha' id ='text_captcha' value ='<?php echo $_POST[' text_captcha ']; ? > ' placeholder='6 ' >< br >< label for ='text_captcha' > *a- </ label > < ahref ='#' onclick ='di_captcha_refresh(); return false;' > </ a > <br> </ p > <br> < p style ='padding: 10px 0;' > <br> < input type ='hidden' name ='action' value ='captcha_send' /> <br> < input type ='submit' name ='submit' value ='' /> <br> </ p > <br> </ form > <br> </ body > <br> </ html > <br> <? php<br> } <br> * This source code was highlighted with Source Code Highlighter .
jsããæååã®çæã«ã€ããŠå°ãããããšãæåæ°ãšåº§æšã®é åãè¿ãããŸãã
ãããŠãå®éã«ã¯ãjsã¹ã¯ãªããïŒ
Js
} $ïŒ '#DICaptchaPic' ïŒ.htmlïŒhtml_p_tagïŒ; }ïŒ} $ïŒ document ïŒ.readyïŒ function ïŒïŒ{$ïŒ '#DICaptchaPic' ïŒ. css ïŒ 'overflow' ã 'hidden' ïŒ; $ïŒ '#DICaptchaPic' ïŒ. css ïŒ 'height' ãïŒcell_size + 2ïŒ* 7ïŒ; di_captcha_refreshïŒïŒ; $ïŒ '#DICaptchaPic' ïŒ.clickïŒ function ïŒïŒ{di_captcha_refreshïŒïŒ;}ïŒ; $ïŒ '#text_captcha' ïŒ.focusïŒïŒ}ïŒ *ãã®ãœãŒã¹ã³ãŒãããã€ã©ã€ãããããœãŒã¹ã³ãŒããã€ã©ã€ã¿ãŒã䜿çšããŸãã
- / * script.js * /
- / * cell_size-ãã¯ã»ã«åäœã®ã»ã«ãµã€ãº* /
- var cell_size = 3;
- é¢æ° di_captcha_refreshïŒïŒ{
- $ .postïŒ './index.php'ã{action ïŒ 'captcha_refresh' }ã
- é¢æ° ïŒããŒã¿ïŒ{
- var data = evalïŒdataïŒ;
- $ïŒ '#DICaptchaPic' ïŒ. css ïŒ 'width' ãïŒïŒïŒïŒïŒcell_size + 2ïŒ* 6ïŒ+ïŒ3 * cell_sizeïŒ+1ïŒ* data [0]ïŒïŒ;
- var html_p_tag = '' ;
- for ïŒi = 1; i <= 7 * 7 * data [0]; ++ iïŒ{
- var style =ïŒiïŒ 7 == 0ïŒïŒ 'ããŒãžã³å³ïŒ' + 2 * cell_size + 'px;' ïŒ '' ;
- for ïŒj = 0; j <data [1] .length; j + = 2ïŒstyle + =ïŒïŒïŒiïŒ ïŒdata [0] * 7ïŒ== 0ïŒïŒïŒdata [0] * 7ïŒïŒ iïŒ ïŒããŒã¿[0] * 7ïŒïŒ==ããŒã¿[1] [j] && Math.ceilïŒi /ïŒããŒã¿[0] * 7ïŒïŒ==ããŒã¿[1] [j + 1]ïŒïŒ ãèæ¯è²ïŒïŒ000;ã ïŒ '' ;
- html_p_tag + = '<p' +ïŒïŒstyle == '' ïŒïŒ '' ïŒ 'style = \' ' + style + ' \ '' ïŒ+ '> '

PS
1.æåãã¿ãŒã³ãæååçæã¯ã©ã¹ã«è¿œå ããå Žåãæåããšã«ããã€ãã®ãã¿ãŒã³ãè¿œå ãããšããã¿ãŒã³ã«ãã埩å·åãããã«è€éã«ãªããŸãã
2. _httpïŒ//decaptcher.comã_httpïŒ//captchabot.comããã³_httpïŒ//antigate.com/ã®åŸæ¥å¡ã¯ããã®ãããªcaptchaã«æè¬ããŸãã
3.ãã®èšäºã¯ãæ°æ¥åã«Webéçºã»ã¯ã·ã§ã³ã§ç§ã®å人ã«ãã£ãŠå ¬éããã16ãã€ãã¹ã14ãã©ã¹ã11ã³ã¡ã³ããèšé²ããŸããã ãã®åŸã圌女ã¯ããµã€ãã®ã«ãŒã«ãèªãããšãã§ããªãïŒä»ã®äººã®æçš¿ãå ¬éããæåŸ ãè«ãïŒããšããçç±ã§ã¢ãã¬ãŒã¿ãŒã«åè¬ãããèšäºã¯ãµã€ãå°çšã«äœæããã誰ãæåŸ ãè«ãããšã¯ããŸããã§ãããã圌ã¯èšäºã®èè ã§ã¯ãªãããšãæããã«ããŸããã ãã®åŸã圌女ã¯ãµã³ãããã¯ã¹ã«å ¥ããæåŸ ãç²åŸããŸããã
4. 11åã®ã³ã¡ã³ãã®ç°¡åãªæå³ïŒ
-ãã£ããã£ããã€ãã¹ããã«ã¯ãæçš¿ãªã¯ãšã¹ããã€ã³ã¿ãŒã»ãããããã¿ãŒã³ã«åŸã£ãŠããã¹ãã埩å·åããå¿ èŠããããŸã
-埩å·åäžã«ãã€ãºãšå€§ããªçµå©ããããŸã
-ãã€ãºãããå ŽåãæåãOããšãDãããCããšãGãã¯èªã¿ã«ãããæ··ä¹±ããããšããããŸããã¢ã«ãã¡ãããããé€å€ããæ¹ããã
-ä»»æã®ãã£ããã£ã解èªã§ããŸããäž»ãªããšã¯ãèªã¿ããããšãã€ãã¹ã®è€éãã®éã®åŠ¥åç¹ãèŠã€ããããšã§ã
ãœãŒã¹ãããŠã³ããŒã
ãã¢ïŒ ãã€ãºãªã ã ãã€ãºããïŒ1ïŒ
UPDïŒ é·éã¯ãã±ãŒã¹ã®70ïŒ ã§ãã£ããã£ãæ£åžžã«ãã€ãã¹ããã¹ã¯ãªãããéçºããŸããã