페이스북 적용중
This commit is contained in:
@ -22,20 +22,44 @@ $g4['title'] = '페이스북 콜백';
|
||||
include_once(G4_PATH.'/head.sub.php');
|
||||
|
||||
if ($user) {
|
||||
|
||||
$access_token = $facebook->getAccessToken();
|
||||
|
||||
$appid = $config['cf_facebook_appid'];
|
||||
|
||||
setcookie('fbs_'.$appid, 1, G4_SERVER_TIME + 86400 * 31, '/', G4_COOKIE_DOMAIN);
|
||||
setcookie('fbs_'.$appid.'_code', $_SESSION['fb_'.$appid.'_code'], G4_SERVER_TIME + 86400 * 31, '/', G4_COOKIE_DOMAIN);
|
||||
setcookie('fbs_'.$appid.'_access_token', $_SESSION['fb_'.$appid.'_access_token'], G4_SERVER_TIME + 86400 * 31, '/', G4_COOKIE_DOMAIN);
|
||||
setcookie('fbs_'.$appid.'_user_id', $_SESSION['fb_'.$appid.'_user_id'], G4_SERVER_TIME + 86400 * 31, '/', G4_COOKIE_DOMAIN);
|
||||
|
||||
sql_query(" update {$g4['member_table']} set mb_facebook_token = '{$access_token}' where mb_id = '{$member['mb_id']}' ", true);
|
||||
|
||||
$g4_sns_url = G4_SNS_URL;
|
||||
|
||||
echo <<<EOT
|
||||
<script>
|
||||
$(function() {
|
||||
var opener = window.opener;
|
||||
opener.$("#facebook_icon").attr("src", "{$g4_sns_url}/icon/facebook_on.png");
|
||||
opener.$("#facebook_checked").attr("disabled", false);
|
||||
opener.$("#facebook_checked").attr("checked", true);
|
||||
//alert("페이스북 승인이 되었습니다.");
|
||||
window.close();
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
$(function() {
|
||||
var opener = window.opener;
|
||||
opener.$("#facebook_icon").attr("src", "{$g4_sns_url}/icon/facebook_on.png");
|
||||
opener.$("#facebook_checked").attr("disabled", false);
|
||||
opener.$("#facebook_checked").attr("checked", true);
|
||||
//alert("페이스북 승인이 되었습니다.");
|
||||
window.close();
|
||||
});
|
||||
</script>
|
||||
EOT;
|
||||
|
||||
} else {
|
||||
|
||||
echo <<<EOT
|
||||
<script>
|
||||
$(function() {
|
||||
alert("페이스북 승인이 되지 않았습니다.");
|
||||
window.close();
|
||||
});
|
||||
</script>
|
||||
EOT;
|
||||
|
||||
}
|
||||
|
||||
include_once(G4_PATH.'/tail.sub.php');
|
||||
|
||||
@ -20,7 +20,7 @@ require '../src/facebook.php';
|
||||
// Create our Application instance (replace this with your appId and secret).
|
||||
$facebook = new Facebook(array(
|
||||
'appId' => '119146498278078',
|
||||
'secret' => '311e0d6ff8ff43cfe0e75fe82d71777c',
|
||||
'secret' => '6ffd7e325e2b4fbd83a2eebf9c6f33f9',
|
||||
));
|
||||
|
||||
// Get User ID
|
||||
@ -82,6 +82,9 @@ $naitik = $facebook->api('/naitik');
|
||||
</div>
|
||||
<?php endif ?>
|
||||
|
||||
<h3>PHP Cookie</h3>
|
||||
<pre><?php print_r($_COOKIE); ?></pre>
|
||||
|
||||
<h3>PHP Session</h3>
|
||||
<pre><?php print_r($_SESSION); ?></pre>
|
||||
|
||||
|
||||
@ -3,8 +3,8 @@
|
||||
require '../src/facebook.php';
|
||||
|
||||
$facebook = new Facebook(array(
|
||||
'appId' => '344617158898614',
|
||||
'secret' => '6dc8ac871858b34798bc2488200e503d',
|
||||
'appId' => '119146498278078',
|
||||
'secret' => '6ffd7e325e2b4fbd83a2eebf9c6f33f9',
|
||||
));
|
||||
|
||||
// See if there is a user from a cookie
|
||||
@ -24,6 +24,9 @@ if ($user) {
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:fb="http://www.facebook.com/2008/fbml">
|
||||
<body>
|
||||
<h3>PHP Cookie</h3>
|
||||
<pre><?php print_r($_COOKIE); ?></pre>
|
||||
|
||||
<?php if ($user) { ?>
|
||||
Your user profile is
|
||||
<pre>
|
||||
|
||||
Reference in New Issue
Block a user