当前位置: 首页>>代码示例>>PHP>>正文


PHP Facebook::destroySession方法代码示例

本文整理汇总了PHP中Facebook::destroySession方法的典型用法代码示例。如果您正苦于以下问题:PHP Facebook::destroySession方法的具体用法?PHP Facebook::destroySession怎么用?PHP Facebook::destroySession使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Facebook的用法示例。


在下文中一共展示了Facebook::destroySession方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: logout

 /**
  * @param string $logoutUrl
  */
 public function logout($logoutUrl = '')
 {
     if (empty($logoutUrl)) {
         $logoutUrl = self::$object->getLogoutUrl(array('next' => self::getRedirectUrl() . '#postJobs'));
     }
     self::$object->setAccessToken('');
     self::$object->destroySession();
     SJB_HelperFunctions::redirect($logoutUrl);
 }
开发者ID:Maxlander,项目名称:shixi,代码行数:12,代码来源:FacebookSocialMedia.php

示例2: logout

 public function logout()
 {
     $this->session->sess_destroy();
     include dirname(dirname(dirname(__FILE__))) . '/fb/src/facebook.php';
     $facebook = new Facebook(array('appId' => appId, 'secret' => secret));
     $fb_users = $facebook->getUser();
     $facebook->destroySession();
     redirect('/');
 }
开发者ID:beyondkeysystem,项目名称:testone,代码行数:9,代码来源:users.php

示例3: mylogout

 /**
  * Soft logout, delete everything links to the customer
  * but leave there affiliate's informations
  *
  * @since 1.5.0
  */
 public function mylogout()
 {
     if (file_exists(_PS_ROOT_DIR_ . '/modules/fbconnect_psb/fb_sdk/facebook.php')) {
         include _PS_ROOT_DIR_ . '/modules/fbconnect_psb/fb_sdk/facebook.php';
         $facebook = new Facebook(array('appId' => Configuration::get('FB_CONNECT_APPID'), 'secret' => Configuration::get('FB_CONNECT_APPKEY')));
         $facebook->destroySession();
     }
     parent::mylogout();
 }
开发者ID:codingang,项目名称:PrestaShop-modules-fbConnect_psb,代码行数:15,代码来源:Customer.php

示例4: startFacebookSession

 public function startFacebookSession($params = array('scope' => ''))
 {
     //I need to make sure the session is started before facebook does it's thing
     $this->Session->check("FacebookID");
     //This just makes sure the session is started
     // Create an application instance with Younique's App ID and Secret (can be found or reset in the App settings on developer.facebook.com)
     $this->set("facebookloginurl", Router::url(["controller" => "account", "action" => "signin"], true));
     $this->facebookuser = $this->facebook->getUser();
     if ($this->facebookuser) {
         try {
             $this->facebookprofile = $this->facebook->api('/me');
             return $this->facebookuser;
         } catch (FacebookApiException $e) {
             error_log($e);
             $this->facebook->destroySession();
             $this->facebookuser = null;
             $this->facebookprofile = null;
         }
     }
     return null;
 }
开发者ID:kameshwariv,项目名称:testexample,代码行数:21,代码来源:AppController.php

示例5: nextend_api_auth_flow

function nextend_api_auth_flow()
{
    $api_key = NextendRequest::getVar('api_key');
    $api_secret = NextendRequest::getVar('api_secret');
    $redirect_uri = NextendRequest::getVar('redirect_uri');
    if (session_id() == "") {
        @session_start();
    }
    if (!$api_key || !$api_secret || !$redirect_uri) {
        $api_key = isset($_SESSION['api_key']) ? $_SESSION['api_key'] : null;
        $api_secret = isset($_SESSION['api_secret']) ? $_SESSION['api_secret'] : null;
        $redirect_uri = isset($_SESSION['redirect_uri']) ? $_SESSION['redirect_uri'] : null;
    } else {
        $_SESSION['api_key'] = $api_key;
        $_SESSION['api_secret'] = $api_secret;
        $_SESSION['redirect_uri'] = $redirect_uri;
    }
    if ($api_key && $api_secret) {
        require_once dirname(__FILE__) . "/api/facebook.php";
        $facebook = new Facebook(array('appId' => $api_key, 'secret' => $api_secret));
        $user = $facebook->getUser();
        if (!$user) {
            header('Location: ' . $facebook->getLoginUrl(array('redirect_uri' => $redirect_uri, 'scope' => 'user_photos')));
            exit;
        } else {
            $facebook->setExtendedAccessToken();
            $accessToken = $facebook->getAccessToken();
            $facebook->destroySession();
            unset($_SESSION['api_key']);
            unset($_SESSION['api_secret']);
            unset($_SESSION['redirect_uri']);
            echo '<script type="text/javascript">';
            echo 'window.opener.setToken("' . $accessToken . '");';
            echo '</script>';
        }
    }
}
开发者ID:AndyHuntDesign,项目名称:andyhuntdesign,代码行数:37,代码来源:auth.php

示例6: distroy_fb_session

 public static function distroy_fb_session()
 {
     $myparams = JComponentHelper::getParams('com_fbconnct');
     $mainframe = JFactory::getApplication();
     $getappid = $myparams->get('appid');
     $getappsec = $myparams->get('appsecret');
     $facebook = new Facebook(array('appId' => $getappid, 'secret' => $getappsec));
     $fbuser = $facebook->getUser();
     $loginUser_url = JRoute::_('index.php?task=login&option=com_fbconnct&format=raw');
     if ($fbuser) {
         $facebook->destroySession();
         $mainframe->redirect($loginUser_url);
     }
 }
开发者ID:educakanchay,项目名称:educared,代码行数:14,代码来源:controller.php

示例7: logout

 /**
  * {@inheritdoc}
  */
 function logout()
 {
     $this->api->destroySession();
     parent::logout();
 }
开发者ID:huynp,项目名称:Critical,代码行数:8,代码来源:Facebook.php

示例8: trim

    $loginUrl = $facebook->getLoginUrl();
}
include "connectdb.php";
// Save to mysql
if ($user) {
    if ($_GET["code"] != "") {
        $strSQL = "  INSERT INTO  tb_facebook (FACEBOOK_ID,NAME,LINK,CREATE_DATE) \n\t\t\t\t\tVALUES\n\t\t\t\t\t('" . trim($user_profile["id"]) . "',\n\t\t\t\t\t'" . trim($user_profile["name"]) . "',\n\t\t\t\t\t'" . trim($user_profile["link"]) . "',\n\t\t\t\t\t'" . trim(date("Y-m-d H:i:s")) . "')";
        $objQuery = mysql_query($strSQL);
        mysql_close();
        header("location:indexfb.php");
        exit;
    }
}
// Logout
if ($_GET["Action"] == "Logout") {
    $facebook->destroySession();
    header("location:index.php");
    exit;
}
?>
<!doctype html>
<html xmlns:fb="http://www.facebook.com/2008/fbml">
  <head>
    <title>php-sdk</title>
    <style>
      body {
        font-family: 'Lucida Grande', Verdana, Arial, sans-serif;
      }
      h1 a {
        text-decoration: none;
        color: #3b5998;
开发者ID:kedpinted,项目名称:appac,代码行数:31,代码来源:indexfb.php

示例9: endOutput

<?php

define("FACEBOOK_ROOT", dirname(__FILE__) . "/..");
require_once FACEBOOK_ROOT . "/common.php";
// yes, this is messy. no, I don't care.
function endOutput($html = "", $exit = true)
{
    echo $html . "\n</body>\n</html>\n";
    if ($exit) {
        exit;
    }
}
// we're not going to be uploading content to Facebook, so fileUpload can be false
$fb = new Facebook(array("appId" => FACEBOOK_APP_ID, "secret" => FACEBOOK_APP_SECRET, "fileUpload" => false, "allowSignedRequest" => false));
if (isset($_GET["logout"])) {
    $fb->destroySession();
    header("Location: {$_SERVER['PHP_SELF']}");
    exit;
}
if (isset($_POST["gid"])) {
    $gid = $_POST["gid"];
    if ($gid + 0 == $gid && is_int($gid + 0)) {
        // TODO: completely refactor this into a sustainable [i.e. offline] form
        $db = mysqli_connect(FACEBOOK_DB_SERVER, FACEBOOK_DB_USERNAME, FACEBOOK_DB_PASSWORD, FACEBOOK_DB_NAME);
        mysqli_set_charset($db, "utf8mb4");
        if (mysqli_connect_error()) {
            endOutput('<p class="error">Unable to connect to the database. Please check the connection settings and try again.</p>');
        }
        $dbPost = mysqli_prepare($db, "insert into posts (gid, post_id, user_id, created_time, updated_time, message, permalink, last_fetched) values (?, ?, ?, ?, ?, ?, ?, utc_timestamp()) on duplicate key update last_fetched = utc_timestamp(), fetch_count = fetch_count + 1, updated_time = values(updated_time), message = values(message), permalink = values(permalink)");
        $dbComment = mysqli_prepare($db, "insert into comments (gid, comment_id, attached_to, attached_type, parent_id, user_id, created_time, message, last_fetched) values (?, ?, ?, ?, ?, ?, ?, ?, utc_timestamp()) on duplicate key update last_fetched = utc_timestamp(), fetch_count = fetch_count + 1, message = values(message)");
        $dbPhoto = mysqli_prepare($db, "insert into photos (gid, photo_id, attached_to, attached_type, album_id, owner_id, height, width, src, src_ext, src_big, src_big_ext, caption, permalink) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) on duplicate key update last_fetched = utc_timestamp(), fetch_count = fetch_count + 1, album_id = values(album_id), height = values(height), width = values(width), src = values(src), src_ext = values(src_ext), src_big = values(src_big), src_big_ext = values(src_big_ext), caption = values(caption), permalink = values(permalink)");
开发者ID:eduridden,项目名称:extensions,代码行数:31,代码来源:getGroupArchive.php

示例10: fbLogin

 /**
  * Function to login with Facebook and store Oauth tokens
  * @author Rohan Julka 
  * */
 public function fbLogin($userIdApp = null)
 {
     $userId = !empty($userIdApp) ? $userIdApp : $this->Session->read('Auth.Front.id');
     $userIsConnected = $this->User->find('first', array('conditions' => array('User.id' => array($this->Encryption->decode($userId))), 'fields' => array('User.fb_connected')));
     if (!empty($userIsConnected['User']['fb_connected'])) {
         $this->Session->setFlash('Your Facebook account has already been linked', 'Front/flash_good');
         if (!empty($userIdApp)) {
             $this->redirect('foxhoprapplication://alreadyfacebook');
         } else {
             return $this->redirect(array('controller' => 'businessOwners', 'action' => 'social', 'facebook'));
         }
     }
     if (!empty($userIdApp)) {
         $this->Session->write('Auth.Front.id', $userIdApp);
         $this->Session->write('AccessedBy', 'WebService');
     }
     //Call Facebook API
     $facebook = new Facebook(array('appId' => Configure::read('appId'), 'secret' => Configure::read('appSecret')));
     $fbuser = $facebook->getUser();
     if ($fbuser) {
         try {
             $accessToken = $facebook->getAccessToken();
             $loginUserId = $this->Encryption->decode($this->Session->read('Auth.Front.id'));
             $this->User->id = $loginUserId;
             $this->User->save(array('User' => array('fb_connected' => 1, 'fb_access_token' => "{$accessToken}")));
             $buisnessOwndata = $this->BusinessOwner->find('first', array('conditions' => array('User.id' => $loginUserId)));
             if (!empty($buisnessOwndata)) {
                 $fbData = $buisnessOwndata['BusinessOwner']['notifications_enabled'];
                 $fbData .= ',fbReferralSend,fbMessageSend,fbInviteSend';
                 $this->BusinessOwner->id = $this->Encryption->decode($buisnessOwndata['BusinessOwner']['id']);
                 $this->BusinessOwner->saveField('notifications_enabled', $fbData);
             }
             $this->Session->setFlash('Your Facebook account has been successfully linked', 'Front/flash_good');
             $facebook->destroySession();
             $checkAccessSession = $this->Session->read('AccessedBy');
             if (!empty($checkAccessSession)) {
                 $this->Session->delete('AccessedBy');
                 $this->Session->delete('Auth.Front.id');
                 $this->redirect('foxhoprapplication://facebook');
             }
             $this->redirect(array('controller' => 'businessOwners', 'action' => 'social', 'facebook'));
         } catch (FacebookApiException $e) {
             echo $e->getMessage();
             $fbuser = null;
         }
     } else {
         //Show login button for guest users
         $loginUrl = $facebook->getLoginUrl(array('redirect_uri' => Configure::read('SITE_URL') . 'businessOwners/fbLogin', 'scope' => Configure::read('fbPermissions')));
         $fbuser = null;
         // Reditrect to facebook to login
         $this->redirect($loginUrl);
     }
     exit;
 }
开发者ID:yogesha3,项目名称:yogesh-test,代码行数:58,代码来源:BusinessOwnersController.php

示例11: ajax_set_google_vote


//.........这里部分代码省略.........
                                $facebook_user_details = yop_poll_base64_encode(json_encode($return_data));
                                $permissions = $facebook->api("/me/permissions");
                                if ($permissions[0]['publish_stream']) {
                                    $publish = true;
                                }
                            } catch (FacebookApiException $e) {
                                echo "access token not available";
                                $error = $e;
                            }
                        } else {
                            $error = __yop_poll("Please log in to cast your vote");
                        }
                    } else {
                        $error = __yop_poll('Request Failed');
                    }
                } else {
                    $error = __yop_poll('Request Failed');
                }
            } else {
                $error = __yop_poll('Request Failed');
            }
            $public_config = array('poll_options' => array('share_after_vote' => $yop_poll_model->share_after_vote, 'share_name' => html_entity_decode((string) $yop_poll_model->share_name, ENT_QUOTES, 'UTF-8'), 'share_caption' => html_entity_decode((string) $yop_poll_model->share_caption, ENT_QUOTES, 'UTF-8'), 'share_description' => html_entity_decode((string) $yop_poll_model->share_description, ENT_QUOTES, 'UTF-8'), 'share_picture' => html_entity_decode((string) $yop_poll_model->share_picture, ENT_QUOTES, 'UTF-8'), 'share_poll_name' => html_entity_decode((string) $yop_poll_model->title, ENT_QUOTES, 'UTF-8'), 'share_link' => $yop_poll_model->poll_options['poll_page_url'] == '' ? site_url() : $yop_poll_model->poll_page_url, 'redirect_after_vote' => html_entity_decode((string) $yop_poll_model->redirect_after_vote, ENT_QUOTES, 'UTF-8'), 'redirect_after_vote_url' => html_entity_decode((string) $yop_poll_model->redirect_after_vote_url, ENT_QUOTES, 'UTF-8')));
        }
        ?>
        <!DOCTYPE html>
        <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
            <script type="text/javascript">
                function close_window() {
                    var yop_poll_various_config = new Object();
                    yop_poll_various_config.poll_id = '<?php 
        echo yop_poll_base64_decode($_GET['poll_id']);
        ?>
';
                    yop_poll_various_config.unique_id = '<?php 
        echo yop_poll_base64_decode($_GET['unique_id']);
        ?>
';
                    yop_poll_various_config.poll_location = '<?php 
        echo yop_poll_base64_decode($_GET['poll_location']);
        ?>
';
                    yop_poll_various_config.is_modal =  <?php 
        echo yop_poll_base64_decode($_GET['is_modal']) == 'true' ? 'true' : 'false';
        ?>
;
                    yop_poll_various_config.vote_loading_image_target = '<?php 
        echo yop_poll_base64_decode($_GET['vote_loading_image_target']);
        ?>
';
                    yop_poll_various_config.vote_loading_image_id = '<?php 
        echo yop_poll_base64_decode($_GET['vote_loading_image_id']);
        ?>
';
                    yop_poll_various_config.vote_type = '<?php 
        echo yop_poll_base64_decode($_GET['vote_type']);
        ?>
';
                    yop_poll_various_config.facebook_user_details = '<?php 
        echo $facebook_user_details;
        ?>
';
                    yop_poll_various_config.facebook_error = '<?php 
        echo $error;
        ?>
';
                    yop_poll_various_config.public_config =  <?php 
        echo json_encode($public_config);
        ?>
;
                    window.opener.jQuery( '#yop-poll-nonce-' + yop_poll_various_config.poll_id +
                        yop_poll_various_config.unique_id ).val( '<?php 
        echo wp_create_nonce('yop_poll-' . $poll_id . $unique_id . '-user-actions');
        ?>
' );
                    result = window.opener.yop_poll_do_vote( yop_poll_various_config );
                    if( result ) {
                        window.close();
                    }
                }
            </script>
        </head>
        <body onload="close_window()">
        <div style="margin:auto; width: 100px; height: 100px; text-align: center;">
            <img src="<?php 
        echo YOP_POLL_URL;
        ?>
images/loading100x100.gif"
                 alt="<?php 
        _e('Loading', 'yop_poll');
        ?>
"/><br>
        </div>
        </body>
        </html>
        <?php 
        $facebook->destroySession();
        die;
    }
开发者ID:kosir,项目名称:thatcamp-org,代码行数:101,代码来源:admin.php

示例12: user_user_logout

/**

	jika user tutup browser tanpa login, maka time_end yg tersimpan adl time last request
	
	saat user login, cek apakah ada data di table session utk user_id dia
	jika ada, pindahkan dulu datanya ke table SessionLog (user_id, session_id, time_start, time_end), baru kemudian data di Session dihapus
	
	table SessionLog ini yg digunakan utk menghitung achievement 'online_time'
*/
function user_user_logout()
{
    // hapus session terkait login
    // mengeset field time_end di table Session
    $lilo_mongo = new LiloMongo();
    $lilo_mongo->selectDB('Users');
    if (isset($_SESSION['session_id'])) {
        $session_id = $_SESSION['session_id'];
        $lilo_mongo->selectCollection('Session');
        $array_criteria = array('session_id' => $session_id);
        // sementara hapus dulu data di Session
        // informasi tentang time_start dan time_end nantinya disimpan di table lain
        $session_data = $lilo_mongo->findOne($array_criteria);
        //		$cur_date = date("Y-m-d H:i:s");
        //		$array_newobj = array('$set' => array('time_end' => $cur_date));
        //		$array_options = array('upsert' => true);
        //
        //		$lilo_mongo->update($array_criteria, $array_newobj, $array_options);
        $array_criteria = array('user_id' => $_SESSION['user_id']);
        $lilo_mongo->delete($array_criteria);
        $lilo_mongo->selectCollection('SessionLog');
        $lilo_mongo->insert($session_data);
    }
    // die("<pre>" . print_r($_SESSION, true) . "<pre>");
    unset($_SESSION['session_id']);
    unset($_SESSION['username']);
    unset($_SESSION['user_id']);
    $redirect_to_fb_logout = 0;
    if (isset($_SESSION['fb_id'])) {
        $redirect_to_fb_logout = 1;
    }
    unset($_SESSION['fb_me']);
    unset($_SESSION['fb_id']);
    unset($_SESSION['signed_request']);
    $basepath = $_SESSION['basepath'];
    $config = array();
    $config['appId'] = '353789864649141';
    $config['secret'] = '9e066419bed7d9ff07f4475f26318aa8';
    $config['fileUpload'] = false;
    // optional
    $facebook = new Facebook($config);
    $fb_logoutUrl = $facebook->getLogoutUrl();
    $facebook->destroySession();
    session_start();
    session_unset();
    session_destroy();
    session_write_close();
    setcookie(session_name(), '', 0, '/');
    session_regenerate_id(true);
    //	ob_start();
    //	session_start();
    /*$_SESSION['just_logout'] = 1;*/
    //	die("<pre>" . print_r($_SESSION, true) . "</pre>");
    if ($redirect_to_fb_logout) {
        //		header("Location: " . $_SESSION['fb_logoutUrl']);
        write_log(array('log_text' => time() . ": Redirect ke logouturl: " . $fb_logoutUrl));
        header("Location: " . $fb_logoutUrl);
        //		header("Location: " . $_SESSION['fb_logoutUrl']);
        exit;
    }
    //	header("Location: " . $_SESSION['basepath']);
    header("Location: " . $basepath);
    exit;
    $html = "<script>\r\n\t\tvar oauth_url = '" . $basepath . "';\r\n\t\twindow.top.location = oauth_url;\r\n\t\t\r\n\t</script>";
    write_log(array('log_text' => time() . ": Redirect dgn html: " . $html));
    print $html;
    exit;
    //	return "1";
}
开发者ID:azanium,项目名称:PopBloop-Web,代码行数:78,代码来源:user.php

示例13: logout

 public function logout()
 {
     require ROOT . '/config/fbApi/facebook.php';
     $facebook = new Facebook(array('appId' => '1681772598704166', 'secret' => '4b6804fc91280077edf58ebb3a55a4e2'));
     $facebook->destroySession();
     echo "<script>window.location.href='" . BASE . "'</script>";
     die;
 }
开发者ID:stevenyeahhh,项目名称:distrapp,代码行数:8,代码来源:IndexController.php

示例14: fbLogout

 function fbLogout()
 {
     $facebook = new Facebook(array('appId' => '1458199551164642', 'secret' => 'c85e0bc13252f28f0f27a8b0e88e7dc2'));
     $facebook->destroySession();
     echo "<script>window.location.href ='" . base_url() . "';</script>";
 }
开发者ID:naykaitoon,项目名称:sharonshoes,代码行数:6,代码来源:site.php

示例15: getLogout

 /**
  * Log the user out of the application.
  *
  * @return \Illuminate\Http\Response
  */
 public function getLogout()
 {
     $facebook = new \Facebook(\Config::get('facebook'));
     $this->auth->logout();
     $uid = $facebook->getUser();
     if ($uid != 0) {
         $params = array('next' => url('/facebook/callback'));
         $facebookLogoutUrl = $facebook->getLogoutUrl($params);
         $facebook->destroySession();
         return redirect($facebookLogoutUrl);
     }
     return redirect('/');
 }
开发者ID:arminnh,项目名称:website-learn-to-program,代码行数:18,代码来源:AuthController.php


注:本文中的Facebook::destroySession方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。