Skip to content

Commit

Permalink
removed the hard coded redirect url and made it a config
Browse files Browse the repository at this point in the history
  • Loading branch information
rampr committed Dec 25, 2011
1 parent 7b94f73 commit 12b806b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Utils.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php

function getUser($facebook) {
function getUser($facebook, $redirect_uri) {
$user=$facebook->getUser();
if($user) {
//$user_profile = $facebook->api('/me');
//echo "<pre>";print_r($user_profile);echo"</pre>";
return $user;
}
else {
$params = array("scope" => "email", "redirect_uri" => "http://apps.facebook.com/ram_test_run/");
$params = array("scope" => "email", "redirect_uri" => $redirect_uri);
$loginUrl = $facebook->getLoginUrl($params);
echo "<script> top.location.href='".$loginUrl."';</script>";
}
Expand Down
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require_once("Utils.php");
require_once("header.html");

$user = getUser($facebook);
$user = getUser($facebook,APPURL);

echo $user;
$email = runFql($facebook,"SELECT email from user where uid=$user");
Expand Down
2 changes: 1 addition & 1 deletion run.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require_once("Utils.php");
require_once("header.html");

$user = getUser($facebook);
$user = getUser($facebook,APPURL);
$friends = getFriends($facebook,$user);
//print_r($friends);
require_once("run.html");
Expand Down
1 change: 1 addition & 0 deletions sample_conf.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

define('APPID','Your APP ID');
define('APPSECRET','APP SECRET');
define('APPURL', 'Your APP URL'); //should be something like http://apps.facebook.com/my_app_name

$fb_sdk_path = __DIR__."/php-sdk/src";
set_include_path(get_include_path() . PATH_SEPARATOR . $fb_sdk_path);
Expand Down

0 comments on commit 12b806b

Please sign in to comment.