當前位置: 首頁>>代碼示例>>PHP>>正文


PHP captcha::hash方法代碼示例

本文整理匯總了PHP中captcha::hash方法的典型用法代碼示例。如果您正苦於以下問題:PHP captcha::hash方法的具體用法?PHP captcha::hash怎麽用?PHP captcha::hash使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在captcha的用法示例。


在下文中一共展示了captcha::hash方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: form

    function form($title = "&rarr; retype that here", $more = "<small>Enter the correct letters and numbers from the image into the text box. This small test serves as access restriction against malicious bots. Simply reload the page if this graphic is too hard to read.</small>")
    {
        $pw = captcha::mkpass();
        $hash = captcha::hash($pw);
        $maxsize = strpos("MSIE", $_SERVER["HTTP_USER_AGENT"]) ? 3000 : 6000;
        @header("Vary: User-Agent");
        $img = "data:image/jpeg;base64," . base64_encode(captcha::image($pw, 200, 60, CAPTCHA_INVERSE, $maxsize));
        $alt = htmlentities(captcha::textual_riddle($pw));
        $html = '<table border="0" summary="captcha input"><tr>' . '<td><img name="captcha_image" id="captcha_image" src="' . $img . '" height="60" width="200" alt="' . $alt . '" /></td>' . '<td>' . $title . '<br/><input name="captcha_hash" type="hidden" value="' . $hash . '" />' . '<input name="captcha_input" type="text" size="7" maxlength="16" style="height:46px; font-size:34px; font-weight:450;" />' . '</td><td>' . $more . '</td>' . '</tr></table>';
        $base = "http://{$_SERVER['SERVER_NAME']}:{$_SERVER['SERVER_PORT']}/" . substr(realpath(__FILE__), strlen($_SERVER["DOCUMENT_ROOT"]));
        $html .= <<<END
<script language="Javascript"><!--
if (/Microsoft/.test(navigator.appName)) {
   var img = document.captcha_image;
   img.src = "{$base}?_ddu=" + img.src.substr(23);
} //--></script>
END;
        $html = "<div class=\"captcha\">{$html}</div>";
        return $html;
    }
開發者ID:gpuenteallott,項目名稱:rox,代碼行數:20,代碼來源:captcha.php

示例2: form

 function form()
 {
     #-- stop if user already verified
     if (!empty($_COOKIE[CAPTCHA_COOKIE]) && $_COOKIE[CAPTCHA_COOKIE] == (int) (time() / 1000000)) {
         return "";
     }
     $title = translate('Enter Characters Seen in Graphic');
     $more = translate('Enter the correct letters and numbers from the image into the text box...');
     #-- prepare image text
     $pw = captcha::mkpass();
     $hash = captcha::hash($pw);
     //$alt = htmlentities(captcha::textual_riddle($pw));
     $alt = $title;
     #-- image
     $img = captcha::image($pw, 200, 60, CAPTCHA_INVERSE, CAPTCHA_MAXSIZE);
     if (CAPTCHA_DATA_URLS && !strpos('MSIE', $_SERVER['HTTP_USER_AGENT'])) {
         $img_fn = 'data:image/jpeg;base64,' . base64_encode($img);
     } else {
         $img_fn = CAPTCHA_TEMP_DIR . '/' . captcha::store_image($img) . '.jpg';
     }
     //echo $img_fn;
     #-- emit html form
     $html = '
     <div class="captcha">
       <fieldset style="width:420px">
         <legend>' . translate('Challenge/Response') . '</legend>
         <table border="0" summary="captcha input" width="400px"><tr>
           <td colspan="2"><small>' . $more . '</small></td></tr><tr>
           <td><img name="captcha_image" id="captcha_image" src="' . $img_fn . '" height="60" width="200" alt="' . $alt . '" /></td>
           <td>' . $title . '<br /><input name="captcha_hash" type="hidden" value="' . $hash . '" />
             <input name="captcha_input" type="text" size="7" maxlength="16" style="height:46px;font-size:34px; font-weight:bold;" />
           </td></tr></table>
       </fieldset>
     </div>
   ';
     return $html;
 }
開發者ID:rhertzog,項目名稱:lcs,代碼行數:37,代碼來源:captcha.php


注:本文中的captcha::hash方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。