Created
September 3, 2010 15:41
-
-
Save jpadilla/564064 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get_facebook_cookie() { | |
$app_id = $this->config->item('facebook_api_key'); | |
$application_secret = $this->config->item('facebook_secret_key'); | |
if(isset($_COOKIE['fbs_' . $app_id])){ | |
$args = array(); | |
parse_str(trim($_COOKIE['fbs_' . $app_id], '\\"'), $args); | |
ksort($args); | |
$payload = ''; | |
foreach ($args as $key => $value) { | |
if ($key != 'sig') { | |
$payload .= $key . '=' . $value; | |
} | |
} | |
if (md5($payload . $application_secret) != $args['sig']) { | |
return null; | |
} | |
return $args; | |
} | |
else{ | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment