I made a website using the password encryption method in the echsop users table, but I want to access the ecshop users table for logon. However, the ecshop users password is encrypted, after checking the compile_password method of ecshop, I still don't know how to use the encryption method. & Lt ;? Phpfunct echsop users table password encryption method
I made a website myself, but I want to access the ecshop users table for logon. However, the ecshop users password is encrypted and the ecshop compile_password method is viewed, I still don't know how to use encryption.
Function compile_password ($ cfg)
{
// Var_dump ($ cfg );
If (isset ($ cfg ['password'])
{
$ Cfg ['md5password'] = md5 ($ cfg ['password']);
}
If (empty ($ cfg ['type'])
{
$ Cfg ['type'] = PWD_MD5;
}
Switch ($ cfg ['type'])
{
Case PWD_MD5:
If (! Empty ($ cfg ['EC _ salt '])
{
Return md5 ($ cfg ['md5password']. $ cfg ['EC _ salt ']);
}
Else
{
Return $ cfg ['md5password'];
}
Case PWD_PRE_SALT:
If (empty ($ cfg ['Salt'])
{
$ Cfg ['Salt'] = '';
}
Return md5 ($ cfg ['Salt']. $ cfg ['md5password']);
Case PWD_SUF_SALT:
If (empty ($ cfg ['Salt'])
{
$ Cfg ['Salt'] = '';
}
Return md5 ($ cfg ['md5password']. $ cfg ['Salt']);
Default:
Return '';
}
}
$ Con = mysql_connect ("localhost", "admin ","");
If (! $ Con ){
Die ('could not connect: '. mysql_error ());
}
$ Command = mysql_select_db ("yihaichao", $ con );
Mysql_query ('set NAMES gbk ');
If (! $ Command ){
Exit ('database connection failed ');
}
If (! Isset ($ _ POST ['submit ']) {
Exit ('failed to pass the value ');
}
$ Passowrd =$ _ POST ['password'];
$ Username = $ _ POST ['username'];
$ Passowrd = md5 ($ password );
Echo $ passowrd;
If ($ username & $ passowrd ){