Revision: 59534
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at September 15, 2012 03:04 by mavrikicecool
Initial Code
<?php function Authlin($authcheckin){ $app_id = "YOUR_APP_ID"; $app_secret = "YOUR_APP_SECRET"; $my_url = "YOUR_URL"; session_start(); $code = $authcheckin; if(empty($code)) { $_SESSION['state'] = md5(uniqid(rand(), TRUE)); $dialog_url = "http://yourcodeurl.com/dialog/oauth?client_id=" . $app_id . "&redirect_uri=" . urlencode($my_url) . "&state=" . $_SESSION['state']; echo("<script> top.location.href='" . $dialog_url . "'</script>"); } if($_REQUEST['state'] == $_SESSION['state']) { $token_url = "https://yourcodeurl.com/oauth/access_token?" . "client_id=" . $app_id . "&redirect_uri=" . urlencode($my_url) . "&client_secret=" . $app_secret . "&code=" . $code; $response = @file_get_contents($token_url); $params = null; parse_str($response, $params); $graph_url = "https://yourcodeurl.com/me?access_token=" . $params['access_token']; $user = json_decode(file_get_contents($graph_url)); echo("Hello " . $user->name); } else { echo("The state does not match.Access Denied."); } } ?>
Initial URL
Initial Description
Bind this particular custom function to a button and name that button as generate your link or any anchor does work, better pass it with a JavaScript's through the action and send the variable or make a ajax call and send it.....or in the action assign it to the php page and call that function then rest u can read from the below code....formatted....
Initial Title
Generate dynamic link for a specific download authentication......
Initial Tags
Initial Language
PHP