<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >Crack Functions</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="PHP 手册" HREF="index.html"><LINK REL="UP" TITLE="函数参考" HREF="funcref.html"><LINK REL="PREVIOUS" TITLE="variant_xor" HREF="function.variant-xor.html"><LINK REL="NEXT" TITLE="crack_check" HREF="function.crack-check.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8"></HEAD ><BODY CLASS="reference" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP 手册</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.variant-xor.html" ACCESSKEY="P" >上一页</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.crack-check.html" ACCESSKEY="N" >下一页</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="reference" ><A NAME="ref.crack" ></A ><DIV CLASS="TITLEPAGE" ><H1 CLASS="title" >XVI. Crack Functions</H1 ><DIV CLASS="PARTINTRO" ><A NAME="AEN23441" ></A ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="crack.intro" >简介</A ></H1 ><P > These functions allow you to use the CrackLib library to test the 'strength' of a password. The 'strength' of a password is tested by that checks length, use of upper and lower case and checked against the specified CrackLib dictionary. CrackLib will also give helpful diagnostic messages that will help 'strengthen' the password. </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >注意: </B > 本扩展已被移动到 <A HREF="http://pecl.php.net" TARGET="_top" >PECL</A > 库中且自以下版本起不再被绑定到 PHP 中:5.0.0. </P ></BLOCKQUOTE ></DIV ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="crack.requirements" >需求</A ></H1 ><P > More information regarding CrackLib along with the library can be found at <A HREF="http://sourceforge.net/projects/cracklib" TARGET="_top" >http://sourceforge.net/projects/cracklib</A >. </P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="crack.installation" >安装</A ></H1 ><P > 本 <A HREF="http://pecl.php.net" TARGET="_top" >PECL</A > 扩展未绑定于 PHP 中。 安装此 PECL 扩展库的信息可在手册中标题为 <A HREF="install.pecl.html" >PECL 扩展库安装</A >的一章中找到。 更多信息如新版本,下载,源文件,维护者信息以及更新日志等可以在这里找到: <A HREF="http://pecl.php.net/package/crack" TARGET="_top" >http://pecl.php.net/package/crack</A >. </P ><P > 在 PHP 4 中本 <ACRONYM CLASS="acronym" >PECL</ACRONYM > 扩展的源程序位于 PHP 源程序中的 <TT CLASS="filename" >ext/</TT > 目录下或者在上面的 <ACRONYM CLASS="acronym" >PECL</ACRONYM > 连接中。 In order to use these functions you must compile PHP with Crack support by using the <CODE CLASS="option" >--with-crack[=DIR]</CODE > configuration option. </P ><P > Windows users will enable <TT CLASS="filename" >php_crack.dll</TT > inside of <TT CLASS="filename" >php.ini</TT > in order to use these functions. 在 PHP 4 中本 <ACRONYM CLASS="acronym" >DLL</ACRONYM > 位于 PHP Windows 执行包中的 <TT CLASS="filename" >extensions/</TT > 目录下。 可以从 <A HREF="http://www.php.net/downloads.php" TARGET="_top" >PHP 下载页面</A >或者 <A HREF="http://snaps.php.net/" TARGET="_top" >http://snaps.php.net/</A > 下载此 <ACRONYM CLASS="acronym" >PECL</ACRONYM > 扩展的 <ACRONYM CLASS="acronym" >DLL</ACRONYM > 文件。 </P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="crack.configuration" >运行时配置</A ></H1 ><P >这些函数的行为受 <TT CLASS="filename" >php.ini</TT > 的影响。</P ><P > <DIV CLASS="table" ><A NAME="AEN23477" ></A ><P ><B >表 1. Crack configuration options</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><COL><COL><THEAD ><TR ><TH >Name</TH ><TH >Default</TH ><TH >Changeable</TH ><TH >Changelog</TH ></TR ></THEAD ><TBODY ><TR ><TD >crack.default_dictionary</TD ><TD >NULL</TD ><TD >PHP_INI_PERDIR</TD ><TD >Available since PHP 4.0.5.</TD ></TR ></TBODY ></TABLE ></DIV > 有关 PHP_INI_* 常量进一步的细节与定义参见<A HREF="ini.html" >附录 H</A >。 </P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="crack.resources" >资源类型</A ></H1 ><P > The CrackLib extension defines a dictionary resource identifier returned by <A HREF="function.crack-opendict.html" ><B CLASS="function" >crack_opendict()</B ></A >. </P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="crack.constants" >预定义常量</A ></H1 ><P >本扩展模块未定义任何常量。</P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="crack.examples" >范例</A ></H1 ><P > This example shows how to open a CrackLib dictionary, test a given password, retrieve any diagnostic messages, and close the dictionary. <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN23503" ></A ><P ><B >例 1. CrackLib example</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><code><font color="#000000"> <font color="#0000BB"><?php<br /></font><font color="#FF8000">// Open CrackLib Dictionary<br /></font><font color="#0000BB">$dictionary </font><font color="#007700">= </font><font color="#0000BB">crack_opendict</font><font color="#007700">(</font><font color="#DD0000">'/usr/local/lib/pw_dict'</font><font color="#007700">)<br /> or die(</font><font color="#DD0000">'Unable to open CrackLib dictionary'</font><font color="#007700">);<br /><br /></font><font color="#FF8000">// Perform password check<br /></font><font color="#0000BB">$check </font><font color="#007700">= </font><font color="#0000BB">crack_check</font><font color="#007700">(</font><font color="#0000BB">$dictionary</font><font color="#007700">, </font><font color="#DD0000">'gx9A2s0x'</font><font color="#007700">);<br /><br /></font><font color="#FF8000">// Retrieve messages<br /></font><font color="#0000BB">$diag </font><font color="#007700">= </font><font color="#0000BB">crack_getlastmessage</font><font color="#007700">();<br />echo </font><font color="#0000BB">$diag</font><font color="#007700">; </font><font color="#FF8000">// 'strong password'<br /><br />// Close dictionary<br /></font><font color="#0000BB">crack_closedict</font><font color="#007700">(</font><font color="#0000BB">$dictionary</font><font color="#007700">);<br /></font><font color="#0000BB">?></font> </font> </code></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >注意: </B > If <A HREF="function.crack-check.html" ><B CLASS="function" >crack_check()</B ></A > returns <TT CLASS="constant" ><B >TRUE</B ></TT >, <A HREF="function.crack-getlastmessage.html" ><B CLASS="function" >crack_getlastmessage()</B ></A > will return 'strong password'. </P ></BLOCKQUOTE ></DIV ></DIV ></DIV ><DIV CLASS="TOC" ><DL ><DT ><B >目录</B ></DT ><DT ><A HREF="function.crack-check.html" >crack_check</A > -- Performs an obscure check with the given password</DT ><DT ><A HREF="function.crack-closedict.html" >crack_closedict</A > -- Closes an open CrackLib dictionary </DT ><DT ><A HREF="function.crack-getlastmessage.html" >crack_getlastmessage</A > -- Returns the message from the last obscure check</DT ><DT ><A HREF="function.crack-opendict.html" >crack_opendict</A > -- Opens a new CrackLib dictionary</DT ></DL ></DIV ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.variant-xor.html" ACCESSKEY="P" >上一页</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >起始页</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.crack-check.html" ACCESSKEY="N" >下一页</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >variant_xor</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="funcref.html" ACCESSKEY="U" >上一级</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >crack_check</TD ></TR ></TABLE ></DIV ></BODY ></HTML >