3
編程方式登錄的用戶,我試圖登錄用戶爲表單提交的一部分,但爲什麼下面不工作:的Drupal 6
$user = db_fetch_object(db_query("SELECT * FROM users WHERE mail = '%s' AND pass = '%s'", $mail, md5($pass)));
if ($user) {
// Authenticate user and log in
$params = array(
'name' => $user->name,
'pass' => trim($user->pass)
);
// Authenticate user
$account = user_authenticate($params);
}
如果我傾倒$用戶,我可以看到正確的值,但如果我轉儲帳戶是空的。