$account['username'], 'secret' => $account['password'], 'master_domain' => $my_chamilo_server, 'master_auth_uri' => $master_auth_uri, 'lifetime' => time() + 3600, 'target' => filter_xss($_GET['sso_target']), ); $cookie = base64_encode(serialize($sso)); $url = chamilo_sso_protocol() . $master_auth_uri; $params = 'sso_referer='. urlencode($url) .'&sso_cookie='. urlencode($cookie); $final_url = filter_xss($_GET['sso_referer']) .'?'. $params; //If your user exists redirect to chamilo and set the account in a session to check it later $_SESSION['my_server_user_session'] = $account; //3. After validating the user in the server and getting and setting the user data of chamilo in the sso_cookie variable: // Redirect to this URL header('Location: '.$final_url); exit; } else { echo '