Help to understand Facebook oauth code better

RinaS

New Member
I am a novice in Facebook development and PHP. I just started today and I would like to know what the following code snippet does,\[code\]<?phpdefine('FACEBOOK_APP_ID', '123423'); define('FACEBOOK_SECRET', '3eesewee3e'); function get_facebook_cookie($app_id, $application_secret) { $args = array(); parse_str(trim($_COOKIE['fbs_' . $app_id], '\\"'), $args); //Why?? ksort($args); $payload = ''; foreach ($args as $key => $value) { if ($key != 'sig') {//Why checking not equals to 'sig' $payload .= $key . '=' . $value; } } if (md5($payload . $application_secret) != $args['sig']) {//why is this checking return null; } return $args; } $cookie = get_facebook_cookie(FACEBOOK_APP_ID, FACEBOOK_SECRET); ?>\[/code\]I kind of understood the PHP functions and their usage. I would like to know why is it done this way?I would like to know the explanations for the lines with comments //why. I am kind of not so sure whats going to and fro during this communication and why are we doing these kind of checking etc.Thanks for your time.Regards,Abhishek
 
Back
Top