untung99.homes: PHP Facebook Login
Untung99 menawarkan beragam permainan yang menarik, termasuk slot online, poker, roulette, blackjack, dan taruhan olahraga langsung. Dengan koleksi permainan yang lengkap dan terus diperbarui, pemain memiliki banyak pilihan untuk menjaga kegembiraan mereka. Selain itu, Untung99 juga menyediakan bonus dan promosi menarik yang meningkatkan peluang kemenangan dan memberikan nilai tambah kepada pemain.
Berikut adalah artikel atau berita tentang Harian untung99.homes dengan judul untung99.homes: PHP Facebook Login yang telah tayang di untung99.homes terimakasih telah menyimak. Bila ada masukan atau komplain mengenai artikel berikut silahkan hubungi email kami di koresponden@untung99.homes, Terimakasih.
We can use Facebook login to allow the users to get access into the websites. This page will explain you about login with facebook PHP SDK.
Login With Facebook
-
Need to go https://developers.facebook.com/apps/ and click on add a new group button to make the app ID.
-
Choose Website
-
Give an app name and click on Create New Facebook App ID
-
Click on Create app ID
-
Click on Skip Quick Test
On Final stage, it will show as below shown image.
fbconfig.php file overview
-
Now open fbconfig.php file and add you app ID and app Secrete
FacebookSession::setDefaultApplication( 'your app ID','App Secrete ' ); // login helper with redirect_uri $helper = new FacebookRedirectLoginHelper('You web address' );
Finally fbconfig.php file as shown below −
getSessionFromRedirect(); }catch( FacebookRequestException $ex ) { // When Facebook returns an error }catch( Exception $ex ) { // When validation fails or other local issues } // see if we have a session if ( isset( $session ) ) { // graph api request for user data $request = new FacebookRequest( $session, 'GET', '/me' ); $response = $request->execute(); // get response $graphObject = $response->getGraphObject(); $fbid = $graphObject->getProperty('id'); // To Get Facebook ID $fbfullname = $graphObject->getProperty('name'); // To Get Facebook full name $femail = $graphObject->getProperty('email'); // To Get Facebook email ID /* ---- Session Variables -----*/ $_SESSION['FBID'] = $fbid; $_SESSION['FULLNAME'] = $fbfullname; $_SESSION['EMAIL'] = $femail; /* ---- header location after session ----*/ header("Location: index.php"); }else { $loginUrl = $helper->getLoginUrl(); header("Location: ".$loginUrl); } ?>
Login page Overview
Login page is used to login into FB
Index.php
Index page is as shown below.
Welcome to "facebook login" tutorial
It will produce the result. Before trying this example, please logout your face book account in your browser.
Logout Facebook
Below code is used to logout facebook.