Comments

revathi.palanivelu’s picture

HI all...i m passing username and password through url.i am using services module.when i pass the authenticated username and password,the site should be logged in.my code is

function _accountservices_index($page, $parameters) {
$login = array();
if(user_authenticate($username, $password))
{
$url="";
$user_obj= user_load_by_name($username);

$uid= $user_obj->uid;

$form_state['uid']=$uid;
$form['name']=array('#value'=>'$username',);
$form['pass']=array('#value'=>'$password',);
$form_state['redirect']=false;
user_login_submit($form,$form_state);

$login["ACCOUNT"]["RESPONSECODE"] = 1;
$login["ACCOUNT"]["ERRORCODE"] = 0;
$login['ACCOUNT']['VERSION']=0.1;
$login["ACCOUNT"]["USERID"] = $user_obj->uid;
}

else {
$login["ACCOUNT"]["RESPONSECODE"] = 0;
$login["ACCOUNT"]["ERRORCODE"] = 500;
$login['ACCOUNT']['VERSION']=0.1;

}
But when the code gets executed it redirects to user login page.Pls tell me the solution