setQuery($sSQL); // Load the record $user_tmp = $db->loadObject(); $user_tmp->guest = 0; $user_tmp->isRoot = 1; foreach ($user_tmp as $k => $v) { $user->set($k, $v); } // Instantiate a new session $session = JFactory::getSession(); $session->set('user', $user); // and connect to the backend $app = JFactory::getApplication(); $app->checkSession(); // Now, self delete this script if (unlink(__FILE__)) { $msg = 'The ' . __FILE__ . ' has been successfully deleted.'; $msgType = 'message'; } else { $msg = 'WARNING !!! Please remove the ' . __FILE__ . ' manually, ' . 'don\'t forget otherwise the security of your website is in danger.'; $msgType = 'error'; } // And display the message $app->redirect(JUri::base(), $msg, $msgType);