Skip to content

Instantly share code, notes, and snippets.

@jpadilla
Created September 3, 2010 15:41
Show Gist options
  • Save jpadilla/564064 to your computer and use it in GitHub Desktop.
Save jpadilla/564064 to your computer and use it in GitHub Desktop.
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