if(!empty($ec_salt)) { /* 检查密码是否正确 */ $sql = "SELECT user_id, user_name, password, last_login, action_list, last_login,suppliers_id,ec_salt". " FROM " . $ecs->table('admin_user') . " WHERE user_name = '" . $_POST['username']. "' AND password = '" . md5(md5($_POST['password']).$ec_salt) . "'"; } else { /* 检查密码是否正确 */ $sql = "SELECT user_id, user_name, password, last_login, action_list, last_login,suppliers_id,ec_salt". " FROM " . $ecs->table('admin_user') . " WHERE user_name = '" . $_POST['username']. "' AND password = '" . md5($_POST['password']) . "'"; }
首先检查admin_user表中ec_salt字段是否为空,不为空则这样加密:md5(md5(明文密码).$ec_salt);为空则md5(明文密码)。
比如要想重置admin的密码(admin的ec_salt字段好像都不为空,$ec_salt即为ec_salt字段的值),则将password字段的值设为:md5(md5('admin').$ec_salt)=374c3361928ab9ca42794299a48e83a1