function s_cookie_set($key, $val, $exp, $path) { if (s_bad_string($key)) { return false; } return setrawcookie($key, $val); }
/** * Retrieve a user by the given credentials. * * @param array $credentials * @return $userModel|null */ public function retrieveByCredentials(array $credentials = array()) { if (empty($credentials)) { if ($this->isTokenValid($this->tokenId)) { $this->setUser($this->tokenId); return $this->userModel; } else { return null; } } $authenticateUri = "/openam/json/authenticate"; if (!is_null($this->realm)) { $authenticateUri = "/openam/json/" . $this->realm . "/authenticate"; } $ch = curl_init($this->serverAddress . $authenticateUri); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-OpenAM-Username: '******'username'], 'X-OpenAM-Password: '******'password'], 'Content-Type: application/json')); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, false); $output = curl_exec($ch); if ($output === false) { $curlError = curl_error($ch); curl_close($ch); throw new Exception('Curl error: ' . $curlError); } else { $json = json_decode($output); $this->tokenId = $json->tokenId; $this->setUser($this->tokenId); curl_close($ch); setrawcookie($this->cookieName, $this->tokenId, 0, $this->cookiePath, $this->cookieDomain); return $this->userModel; } }
/** * process form data for submission to your Act-On external form URL * @param string $extPostUrl your external post (Proxy URL) for your Act-On "proxy" form */ public function processConnection($extPostUrl) { $this->setPostItems('_ipaddr', $this->getUserIP()); // Act-On accepts manually defined IPs if using field name '_ipaddr' $fields = http_build_query($this->getPostItems()); // encode post items into query-string $handle = curl_init(); curl_setopt($handle, CURLOPT_POST, 1); curl_setopt($handle, CURLOPT_URL, "{$extPostUrl}"); curl_setopt($handle, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); curl_setopt($handle, CURLOPT_HEADER, 1); curl_setopt($handle, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($handle, CURLOPT_RETURNTRANSFER, 1); curl_setopt($handle, CURLOPT_POSTFIELDS, $fields); $response = curl_exec($handle); if ($response === FALSE) { $response = "cURL Error: " . curl_error($handle); } else { preg_match_all('/^Set-Cookie:\\040wp\\s*([^;]*)/mi', $response, $ra); // pull response "set-cookie" values from cURL response header parse_str($ra[1][0], $cookie); // select the "set-cookie" for visitor conversion and store to array $cookie // set updated website visitor tracking cookie with processed "set-cookie" content from curl setrawcookie('wp' . key($cookie), implode(",", $cookie), time() + 86400 * 365, "/", $this->getDomain($extPostUrl)); // set cookie expiry date to 1 year } curl_close($handle); }
/** * @return string */ public function testHeaderSentCookies() { $_COOKIE['test0'] = 'test0'; // Create cookies : setcookie('test1', 'test1'); setcookie('test2', 'test2'); setrawcookie('test3', 'test3'); setrawcookie('test4', 'test4'); // Delete, created cookies (with false) : setcookie('test1', false); setrawcookie('test2', false); // Delete, created cookies (with null) : setcookie('test3', null); setrawcookie('test4', null); // Delete others cookies : setcookie('testDeleteOther0', null); setrawcookie('testDeleteOther1', null); // Not send REQUEST_TIME + 0 : setrawcookie('testKeyNotSend', 'testValueNotSend', REQUEST_TIME + 0); $listOfHeaders = headers_list(); ob_start(); print_r($listOfHeaders); $result = ob_get_clean(); $lines = $this->outputTestLineLayout($this->highlightPhp("\$_COOKIE['test0'] = 'test0';\n\n// Create cookies :\nsetcookie('test1', 'test1');\nsetcookie('test2', 'test2');\nsetrawcookie('test3', 'test3');\nsetrawcookie('test4', 'test4');\n\n// Delete, created cookies (with false) :\nsetcookie('test1', false);\nsetrawcookie('test2', false);\n\n// Delete, created cookies (with null) :\nsetcookie('test3', null);\nsetrawcookie('test4', null);\n\n// Delete others cookies :\nsetcookie('testDeleteOther0', null);\nsetrawcookie('testDeleteOther1', null);\n\n// Not send REQUEST_TIME + 0 :\nsetrawcookie('testKeyNotSend', 'testValueNotSend', REQUEST_TIME + 0);"), $this->getDefaultTestLineTitle()); $lines .= $this->outputTestLineLayout($this->highlightPhp($result, false), self::getDefaultTestResultTitle()); return $this->outputTestLayout($lines, 'Headers - Create cookies, sent cookies and print headers sent'); }
function iflychat_get_current_guest_id() { if (isset($_SESSION) && isset($_SESSION['iflychat_guest_id'])) { //if(!isset($_COOKIE) || !isset($_COOKIE['drupalchat_guest_id'])) { setrawcookie('iflychat_guest_id', rawurlencode($_SESSION['iflychat_guest_id']), time() + 60 * 60 * 24 * 365); setrawcookie('iflychat_guest_session', rawurlencode($_SESSION['iflychat_guest_session']), time() + 60 * 60 * 24 * 365); //} } else { if (isset($_COOKIE) && isset($_COOKIE['iflychat_guest_id']) && isset($_COOKIE['iflychat_guest_session']) && $_COOKIE['iflychat_guest_session'] == iflychat_compute_guest_session($_COOKIE['iflychat_guest_id'])) { $_SESSION['iflychat_guest_id'] = check_plain($_COOKIE['iflychat_guest_id']); $_SESSION['iflychat_guest_session'] = check_plain($_COOKIE['iflychat_guest_session']); } else { $characters = 'abcdefghijklmnopqrstuvwxyz0123456789'; $iflychatId = time(); for ($i = 0; $i < 5; $i++) { $iflychatId .= $characters[rand(0, strlen($characters) - 1)]; } $_SESSION['iflychat_guest_id'] = $iflychatId; $_SESSION['iflychat_guest_session'] = iflychat_compute_guest_session($_SESSION['iflychat_guest_id']); setrawcookie('iflychat_guest_id', rawurlencode($_SESSION['iflychat_guest_id']), time() + 60 * 60 * 24 * 365); setrawcookie('iflychat_guest_session', rawurlencode($_SESSION['iflychat_guest_session']), time() + 60 * 60 * 24 * 365); } } return $_SESSION['iflychat_guest_id']; }
function setLocalCookie($header) { $header_arr = explode("\n", $header); foreach ($header_arr as $header_each) { if (strpos($header_each, 'Set-Cookie') !== false) { $p1 = strpos($header_each, "="); $p2 = strpos($header_each, ";"); $name = substr($header_each, 12, $p1 - 12); $value = substr($header_each, $p1 + 1, $p2 - $p1 - 1); $expires = null; switch ($name) { case "cap_id": case "_xsrf": // 30 days $expires = time() + 60 * 60 * 24 * 30; break; case "q_c1": case "_za": case "z_c0": // 3 years $expires = time() + 60 * 60 * 24 * 365 * 3; break; case "unlock_ticket": // 4 hours $expires = time() + 60 * 60 * 4; break; } setrawcookie($name, $value, $expires, "/"); } } }
public function set($key, $value) { // raw url encode and set raw cookie used here to prevent issues with spaces encoded as '+' $value = rawurlencode(json_encode($value)); setrawcookie($this->cookie_prefix . $key, $value, time() + $this->app['config']['cookie_lifetime'], '/'); $_COOKIE[$this->cookie_prefix . $key] = $value; }
/** * Adds a setting to the frame events * @param type $data * @return type */ function add_event($data) { $id = md5(serialize($data)); $data['context'] = $this->object->context; setrawcookie($this->object->setting_name . '_' . $id, $this->object->_encode($data)); return $data; }
public function setRaw($name, $value = "", $expire = 0, $path = null, $domain = null, $secure = false, $httponly = false) { if (!setrawcookie($name, $value, $expire, $path, $domain, $secure, $httponly)) { throw new Exception("Cookie could not be set."); } return $this; }
public static function setrawcookie($key, $value = '', $expire = 0, $path = '/', $domain = '', $secure = false, $httponly = false) { if (self::$_response) { self::$_response->rawcookie($key, $value, $expire, $path, $domain, $secure, $httponly); } \setrawcookie($key, $value, $expire, $path, $domain, $secure, $httponly); }
/** * @see ExpressoLite\Backend\Request\LiteRequest::execute */ public function execute() { if (!$this->isParamSet('user') || !$this->isParamSet('pwd')) { $this->httpError(400, 'É necessário informar login e senha.'); } try { $this->resetTineSession(); $result = $this->tineSession->login($this->param('user'), $this->param('pwd'), $this->isParamSet('captcha') ? $this->param('captcha') : null); } catch (PasswordExpiredException $pe) { return (object) array('success' => false, 'expired' => true); } catch (CaptchaRequiredException $cre) { return (object) array('success' => false, 'captcha' => $cre->getCaptcha()); } if ($result) { $cookiePath = str_replace('accessible/', '', $_SERVER['REQUEST_URI']); //we remove 'accessible/' suffix from current path. //This way, the cookie will always be set to all modules, //even if it was started by the accessible module setrawcookie('user', $this->param('user'), time() + 60 * 60 * 24 * 30, $cookiePath); $_COOKIE['user'] = $this->param('user'); //setrawcookie() does not update the $_COOKIE array with the new cookie. //So, we do this manually to avoid problems with checkIfSessionUserIsValid //later on } $this->checkIfSessionUserIsValid(); // Its better to check if the tine user matches Expresso Lite user // right away return (object) array('success' => $result, 'userInfo' => (object) array('mailAddress' => $this->tineSession->getAttribute('Expressomail.email'), 'mailSignature' => $this->tineSession->getAttribute('Expressomail.signature'), 'mailBatch' => MAIL_BATCH)); }
function clearcookie() { if (is_array($_COOKIE)) { foreach ($_COOKIE as $key => $val) { setrawcookie($key, '', -86400 * 365, $GLOBALS['cookiecfg']['path'], $GLOBALS['cookiecfg']['domain'], $_SERVER['SERVER_PORT'] == 443 ? 1 : 0); } } }
public function set() { if ($this->raw) { setrawcookie($this->name, $this->value, $this->expire, $this->path, $this->domain, $this->secure, $this->httponly); } else { setcookie($this->name, $this->value, $this->expire, $this->path, $this->domain, $this->secure, $this->httponly); } }
public static function store_uid($uid = '') { if (!headers_sent()) { setrawcookie(self::COOKIE, $uid, time() + 60 * 60 * 24 * 30, COOKIEPATH, COOKIE_DOMAIN); do_action('edd_segment_uid_stored', $uid); } return $uid; }
function checkLogin() { print "Here"; if (!($connect = mysqli_connect("localhost", "root", "", "ita_project"))) { die("Error in connecting to the database"); } $username = $_POST['username']; $password = $_POST['password']; $query = "select * from student where uname = '" . $username . "' and password = '******'"; if (!($result = mysqli_query($connect, $query))) { die("Error in querying"); } $count = 0; while ($row = mysqli_fetch_array($result)) { $count++; } if ($count >= 1) { setrawcookie("CRG", $username, time() + 1800); //setrawcookie("CRG_SES" , time()); return 1; } $query = "select * from faculty where uname = '" . $username . "' and password = '******'"; if (!($result = mysqli_query($connect, $query))) { die("Error in querying"); } $count = 0; while ($row = mysqli_fetch_array($result)) { $count++; } if ($count >= 1) { //print("Login successful for faculty"); setrawcookie("CRG", $username, time() + 1800); //setrawcookie("CRG_SES" , time()); return 2; } $query = "select * from admin where uname = '" . $username . "' and password = '******'"; if (!($result = mysqli_query($connect, $query))) { die("Error in querying"); } $count = 0; while ($row = mysqli_fetch_array($result)) { $count++; } if ($count >= 1) { //print("Login successful for admin"); setrawcookie("CRG", $username, time() + 1800); //setrawcookie("CRG_SES" , time()); return 3; } if ($count == 0) { return 4; } }
/** * Adds a setting to the frame events * @param type $data * @return type */ function add_event($data) { $id = md5(serialize($data)); $data['context'] = $this->object->context; $write_cookie = TRUE; if (defined('XMLRPC_REQUEST')) { $write_cookie = XMLRPC_REQUEST == FALSE; } if ($write_cookie) { setrawcookie($this->object->setting_name . '_' . $id, $this->object->_encode($data)); } return $data; }
/** * Adds a setting to the frame events * @param type $data * @return type */ public function add_event($data) { $id = md5(serialize($data)); $data['context'] = $this->object->context; $write_cookie = TRUE; if (defined('XMLRPC_REQUEST')) { $write_cookie = XMLRPC_REQUEST == FALSE; } if ($write_cookie) { setrawcookie($this->object->setting_name . '_' . $id, $this->object->_encode($data), time() + 10800, '/', parse_url(site_url(), PHP_URL_HOST)); } return $data; }
public function create_SSO_token_cookie() { if (!isset($_SERVER["HTTP_HOST"])) { $domain = $_SERVER["SERVER_NAME"]; } else { $domain = $_SERVER["HTTP_HOST"]; } $exploded_domain = explode(".", $domain); $domain = implode(".", array_slice($exploded_domain, -2)); //error_log("domain is ".$domain." sso token is ".$this->ssotoken); $result = setrawcookie($this->params->get('sso_token_cookie_name'), $this->ssotoken, time() + 60 * 60 * 10, "/", $domain, True, True); return $result; }
/** * tell the browser to set a cookie * allow set multiple cookies at once * * @param mixed $cookies cookie arr * @param boolean $raw * @return void */ public function add($cookies, $raw = false) { if (!is_array($cookies)) { $cookies = array($cookies); } foreach ($cookies as $cookie) { if ($cookie instanceof CookieEntity) { $raw ? setrawcookie($cookie->name, $cookie->value, $cookie->expire, $cookie->path, $cookie->domain, $cookie->secure, $cookie->httpOnly) : setcookie($cookie->name, $cookie->value, $cookie->expire, $cookie->path, $cookie->domain, $cookie->secure, $cookie->httpOnly); } else { throw new InvalidArgumentException('Argument: $cookies must be Hydrogen\\Http\\Cookie\\Cookie instance or array of it'); } } }
/** * Sends HTTP headers, including cookies. */ public function sendHeaders() { if (!$this->headers->has('Content-Type')) { $this->headers->set('Content-Type', 'text/html'); } // status header(sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText)); // headers foreach ($this->headers->all() as $name => $value) { header($name . ': ' . $value); } // cookies foreach ($this->cookies as $cookie) { setrawcookie($cookie['name'], $cookie['value'], $cookie['expire'], $cookie['path'], $cookie['domain'], $cookie['secure'], $cookie['httpOnly']); } }
/** * Authenticates the user passed by the constructor, however in this case we * user the WRAP server variable "WRAP_USERID" to get this appropriate username. * * @return new Zend_Auth_Result object */ public function authenticate() { $username = getenv('WRAP_USERID') == '' ? getenv('REDIRECT_WRAP_USERID') : getenv('WRAP_USERID'); if ($username == '') { $username = getenv('REDIRECT_WRAP_USERID'); } if ($username == '') { setrawcookie('WRAP_REFERER', $this->_getUrl(), 0, '/', '.ncsu.edu'); header('location:https://webauth.ncsu.edu/wrap-bin/was16.cgi'); die; } if (strtolower($username) == 'guest') { $this->autoLogout(); return new Zend_Auth_Result(false, new stdClass(), array('Guest access is not allowed for this application')); } $class = new stdClass(); $class->username = $username; $class->realm = 'wrap'; return new Zend_Auth_Result(true, $class, array()); }
function getVisitorId() { // If there is a value in the cookie, don't change it. if (isset($_COOKIE[COOKIE_NAME])) { return $_COOKIE[COOKIE_NAME]; } $guid = ''; if (isset($_SERVER["HTTP_X_DCMGUID"])) { $guid = $_SERVER["HTTP_X_DCMGUID"]; } else { if (isset($_SERVER["HTTP_X_UP_SUBNO"])) { $guid = $_SERVER["HTTP_X_UP_SUBNO"]; } else { if (isset($_SERVER["HTTP_X_JPHONE_UID"])) { $guid = $_SERVER["HTTP_X_JPHONE_UID"]; } else { if (isset($_SERVER["HTTP_X_EM_UID"])) { $guid = $_SERVER["HTTP_X_EM_UID"]; } } } } $message = ""; if (!empty($guid)) { // Create the visitor id using the guid. $message = $guid . $_GET["utmac"]; } else { $userAgent = ''; if (isset($_SERVER["HTTP_USER_AGENT"])) { $userAgent = $_SERVER["HTTP_USER_AGENT"]; } // otherwise this is a new user, create a new random id. $message = $userAgent . uniqid(getRandomNumber(), true); } $md5String = md5($message); $VisitorId = "0x" . substr($md5String, 0, 16); setrawcookie(COOKIE_NAME, $VisitorId, time() + COOKIE_USER_PERSISTENCE, COOKIE_PATH); return $VisitorId; }
/** * Retrieve a user by the given credentials. * * @param array $credentials * @return $userModel|null */ public function retrieveByCredentials(array $credentials = array()) { $authenticateUri = "/amserver/identity/authenticate"; $ch = curl_init(); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, 'username='******'netid'] . '&password='******'password'] . '&uri=' . $this->realm); curl_setopt($ch, CURLOPT_URL, $this->serverAddress . $authenticateUri); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $output = curl_exec($ch); if (strpos($output, 'token.id') === false) { $curlError = curl_error($ch); curl_close($ch); throw new Exception('Curl error: ' . $curlError); } else { $tokenId = str_replace('token.id=', '', $output); $tokenId = substr($tokenId, 0, -1); $this->tokenId = $tokenId; $this->setUser($tokenId); curl_close($ch); setrawcookie($this->cookieName, $this->tokenId, 0, $this->cookiePath, $this->cookieDomain); return $this->userModel; } }
/** * Sends HTTP headers and cookies. Only the first invocation of this method will send the headers. * Subsequent invocations will silently do nothing. This allows certain actions to send headers early, * while still using the standard controller. */ public function sendHttpHeaders() { if (!$this->options['send_http_headers']) { return; } // status $status = $this->options['http_protocol'] . ' ' . $this->statusCode . ' ' . $this->statusText; header($status); if (substr(php_sapi_name(), 0, 3) == 'cgi') { // fastcgi servers cannot send this status information because it was sent by them already due to the HTT/1.0 line // so we can safely unset them. see ticket #3191 unset($this->headers['Status']); } if ($this->options['logging']) { $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Send status "%s"', $status)))); } // headers if (!$this->getHttpHeader('Content-Type')) { $this->setContentType($this->options['content_type']); } foreach ($this->headers as $name => $value) { header($name . ': ' . $value); if ($value != '' && $this->options['logging']) { $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Send header "%s: %s"', $name, $value)))); } } // cookies foreach ($this->cookies as $cookie) { setrawcookie($cookie['name'], $cookie['value'], $cookie['expire'], $cookie['path'], $cookie['domain'], $cookie['secure'], $cookie['httpOnly']); if ($this->options['logging']) { $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Send cookie "%s": "%s"', $cookie['name'], $cookie['value'])))); } } // prevent resending the headers $this->options['send_http_headers'] = false; }
public function sendHttpHeaders() { if (!$this->options['send_http_headers']) { return; } $status = $this->options['http_protocol'] . ' ' . $this->statusCode . ' ' . $this->statusText; header($status); if (substr(php_sapi_name(), 0, 3) == 'cgi') { unset($this->headers['Status']); } if ($this->options['logging']) { $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Send status "%s"', $status)))); } if (!$this->getHttpHeader('Content-Type')) { $this->setContentType($this->options['content_type']); } foreach ($this->headers as $name => $value) { header($name . ': ' . $value); if ($value != '' && $this->options['logging']) { $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Send header "%s: %s"', $name, $value)))); } } foreach ($this->cookies as $cookie) { setrawcookie($cookie['name'], $cookie['value'], $cookie['expire'], $cookie['path'], $cookie['domain'], $cookie['secure'], $cookie['httpOnly']); if ($this->options['logging']) { $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Send cookie "%s": "%s"', $cookie['name'], $cookie['value'])))); } } $this->options['send_http_headers'] = false; }
/** * Set a cookie. * * @param string $name The name of the session cookie. * @param string|NULL $value The value of the cookie. Set to NULL to delete the cookie. * @param array|NULL $params Cookie parameters. * @param bool $throw Whether to throw exception if setcookie fails. */ public static function setCookie($name, $value, array $params = NULL, $throw = TRUE) { assert('is_string($name)'); assert('is_string($value) || is_null($value)'); $default_params = array('lifetime' => 0, 'expire' => NULL, 'path' => '/', 'domain' => NULL, 'secure' => FALSE, 'httponly' => TRUE, 'raw' => FALSE); if ($params !== NULL) { $params = array_merge($default_params, $params); } else { $params = $default_params; } // Do not set secure cookie if not on HTTPS if ($params['secure'] && !self::isHTTPS()) { SimpleSAML_Logger::warning('Setting secure cookie on http not allowed.'); return; } if ($value === NULL) { $expire = time() - 365 * 24 * 60 * 60; } elseif (isset($params['expire'])) { $expire = $params['expire']; } elseif ($params['lifetime'] === 0) { $expire = 0; } else { $expire = time() + $params['lifetime']; } if ($params['raw']) { $success = setrawcookie($name, $value, $expire, $params['path'], $params['domain'], $params['secure'], $params['httponly']); } else { $success = setcookie($name, $value, $expire, $params['path'], $params['domain'], $params['secure'], $params['httponly']); } if (!$success) { if ($throw) { throw new SimpleSAML_Error_Exception('Error setting cookie - headers already sent.'); } else { SimpleSAML_Logger::warning('Error setting cookie - headers already sent.'); } } }
public function ProcessLogin() { $email = $this->post->email; $password = $this->post->password; if ($email == '' || $password == '') { $this->set('message', 'You must fill out both your username and password'); $this->render('login_form.tpl'); return false; } if (!Auth::ProcessLogin($email, $password)) { $this->set('message', Auth::$error_message); $this->render('login_form.tpl'); return false; } else { if (Auth::$pilot->confirmed == PILOT_PENDING) { $this->render('login_unconfirmed.tpl'); Auth::LogOut(); // show error } elseif (Auth::$pilot->confirmed == PILOT_REJECTED) { $this->render('login_rejected.tpl'); Auth::LogOut(); } else { $pilotid = Auth::$pilot->pilotid; $session_id = Auth::$session_id; # If they choose to be "remembered", then assign a cookie if ($this->post->remember == 'on') { $cookie = "{$session_id}|{$pilotid}|{$_SERVER['REMOTE_ADDR']}"; $res = setrawcookie(VMS_AUTH_COOKIE, $cookie, time() + Config::Get('SESSION_LOGIN_TIME'), '/'); } PilotData::updateLogin($pilotid); CodonEvent::Dispatch('login_success', 'Login'); $this->post->redir = str_replace('index.php/', '', $this->post->redir); header('Location: ' . url('/' . $this->post->redir)); } return; } }
/** * Send HTTP headers and cookies. * */ public function sendHttpHeaders() { if (coreConfig::get('sf_test')) { // return; } //DBG::printr($this->headers); // status $status = 'HTTP/1.1 ' . $this->statusCode . ' ' . $this->statusText; header($status); // headers foreach ($this->headers as $name => $value) { header($name . ': ' . $value); } // cookies foreach ($this->cookies as $cookie) { if (version_compare(phpversion(), '5.2', '>=')) { setrawcookie($cookie['name'], $cookie['value'], $cookie['expire'], $cookie['path'], $cookie['domain'], $cookie['secure'], $cookie['httpOnly']); } else { setrawcookie($cookie['name'], $cookie['value'], $cookie['expire'], $cookie['path'], $cookie['domain'], $cookie['secure']); } } }
function authenticateWithLegacyOpenAM($username, $password) { $authentication_url = OPENAM_BASE_URL . OPENAM_LEGACY_AUTHN_URI; openam_debug("authenticateWithLegacyOpenAM: AUTHN URL: " . $authentication_url); $uri_param = createLegacyAuthenticationURIParams(); $uri = "?username="******"&password="******"authenticateWithLegacyOpenAM: RAW AUTHN RESPONSE: " . print_r($response, TRUE)); if (empty($response->errors['http_request_failed'])) { if ($response['response']['code'] == 200) { $amResponse = json_decode($response['body'], true); $number_of_hours = 2; $expiration_date = time() + 60 * 60 * $number_of_hours; setrawcookie(OPENAM_COOKIE_NAME, $amResponse['tokenId'], $expiration_date, '/', DOMAIN); openam_debug("authenticateWithLegacyOpenAM: AUTHN RESPONSE: " . print_r($amResponse, TRUE)); return $amResponse['tokenId']; } return 0; } else { return 2; } }
public function rawset($key, $value, $options = array()) { $options = $this->createOptions($options); setrawcookie($key, $value, $options["expire"], $options["path"], $options["domain"], $options["secure"], $options["httpOnly"]); }