How can I auto-login a user in Joomla 1.5. I am using this code:
global $mainframe;
$db =& JFactory::getDBO();
$query = ‘SELECT `id`, `password`, `gid`’. ‘ FROM `#__users`’. ‘ WHERE username=’ . $db->Quote( JRequest::getVar(‘username’, null) ). ‘ AND password=’ . `enter code here` $db->Quote( JRequest::getVar(‘passw’, null) );
$db->setQuery( $query );
$result = $db->loadObject();
if($result) {
JPluginHelper::importPlugin(‘user’);
$response->username = JRequest::getVar(‘username’, null);
$result = $mainframe->triggerEvent(‘onLoginUser’, array((array)$response, $options));
}
$mainframe->redirect(‘XXXXXXXXXXXX’);
Where did I go wrong?
add this top of the code, it will solve the issue