LLMS_Session::get_cookie()
Retrieve an validate the session cookie
Return Return
(false|mixed[])
Source Source
File: includes/class.llms.session.php
protected function get_cookie() { $value = isset( $_COOKIE[ $this->cookie ] ) ? sanitize_text_field( wp_unslash( $_COOKIE[ $this->cookie ] ) ) : false; if ( empty( $value ) || ! is_string( $value ) ) { return false; } /** * Explode the cookie into it's parts. * * @param string|int $0 User ID. * @param int $1 Expiration timestamp. * @param int $2 Expiration variance timestamp. * @param string $3 Cookie hash. */ $parts = explode( '||', $value ); if ( empty( $parts[0] ) || empty( $parts[3] ) ) { return false; } $hash_str = sprintf( '%1$s|%2$s', $parts[0], $parts[1] ); $expected = hash_hmac( 'md5', $hash_str, wp_hash( $hash_str ) ); if ( ! hash_equals( $expected, $parts[3] ) ) { return false; } return $parts; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
4.0.0 | Introduced. |