if( $qr_num > 0 )
{ // 找到帳號
$row = mysql_fetch_array($qr_ret);
if (trim($row[mbr_pwd]) == crypt(trim($password),"zzzzzzzzzz"))  //这里是直接加密的密码吗???? 怎么个加密过程??
{ //  密碼正確
// Check active
if ( $row[mbr_enable] == "Y" )
{
// passed

解决方案 »

  1.   

    注册用户时用crypt(trim($password),"zzzzzzzzzz")写到数据库的。登录同样这样判断咯。相同的话就说明密码正确 0_0
      

  2.   

    定义和用法The crypt() function returns a string encrypted using DES, Blowfish, or MD5 algorithms.
    crypt()函数的作用是:使用DES、Blowfish或MD5返回一个不可逆加密(散列)。This function behaves different on different operating systems, some operating systems supports more than one type of encryption. PHP checks what algorithms are available and what algorithms to use when it is installed.
    这个函数的属性是随着操作系统的不同而不同的。有些操作系统支持多于一中的加密方法。PHP将确认什么运算法则是有效的以及到底该使用什么运算法则。The exact algorithm depends on the format and length of the salt parameter. Salts help make the encryption more secure by increasing the number of encrypted strings that can be generated for one specific string with one specific encryption method.
    精确的运算法则取决于salt参数的格式和长度。Salts可以通过增加加密字符串的数量保证加密更加安全(这些额外增加的字符将通过一种指定的加密运算方法产生)。There are some constants that are used together with the crypt() function. The value of these constants are set by PHP when it is installed.
    下面列举了一系列常量,它们是与crypt()函数一起使用的。当PHP安装完毕后,这些常量将自动被设置好。Constants:
    常量:    [CRYPT_SALT_LENGTH] - The length of the default encryption. With standard DES encryption, the length is 2
        [CRYPT_SALT_LENGTH] –默认的加密长度。标准的DES长度为2
        [CRYPT_STD_DES] - Value is 1 if the standard DES algorithm is supported, 0 otherwise. The Standard DES-based encryption has a two character salt
        [CRYPT_STD_DES] –如果支持标准的DES运算法则,那么值为1;如果不支持,值为0。标准的基于DES的加密方法包含两个字符salt
        [CRYPT_EXT_DES] - Value is1 if the extended DES algorithm is supported, 0 otherwise. The Extended DES encryption has a nine character salt
        [CRYPT_EXT_DES] -如果支持标准的DES运算法则,那么值为1;如果不支持,值为0。标准的基于DES的加密方法包含九个字符salt
        [CRYPT_MD5] - Value is 1 if the MD5 algorithm is supported, 0 otherwise. The MD5 encryption has a 12 character salt starting with $1$
        [CRYPT_MD5] -如果支持标准的DES运算法则,那么值为1;如果不支持,值为0。MD5加密方法包含12个字符salt,起始字符为“$1$”
        [CRYPT_BLOWFISH] - Value is 1 if the Blowfish algorithm is supported, 0 otherwise. The Blowfish encryption has a 16 character salt starting with $2$ or $2a$
        [CRYPT_BLOWFISH] -如果支持标准的DES运算法则,那么值为1;如果不支持,值为0。Blowfish加密方法包含16个字符salt,起始字符为“$2$”和“$2a$”
      

  3.   

    crypt 直接加密的
    然后直接对比验证的吧?
      

  4.   


    crypt 直接加密的 是吗? 密钥是zzzzzzzzzz
      

  5.   

    crypt 直接加密的 是吗? 密钥是zzzzzzzzzz
      

  6.   

    使用 DES、Blowfish 或 MD5 加密的字符串。,取决于操作系统的差异,并且是单向的,不存在解密算法。