HTML and CSS Reference
In-Depth Information
header("Location: ./");
exit;
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf8" />
<title>Please Log In</title>
</head>
<body>
<h2>Please Log In</h2>
<p>
Before you can use this sweet app, you have to log in.
</p>
<p>
<a href="<?php echo $facebook->get_login_uri(); ?>">
Log In with Facebook
</a>
</p>
</body>
</html>
this file starts by setting error reporting as high as possible to make sure the code is squeaky clean and then
includes both OAuth classes and the Facebook config file.
With the necessary files loaded, a new RWA_Facebook object is instantiated and stored in $facebook . the script
then checks if the user is logged in by running the is_logged_in() method and redirects to the home page if so.
For a logged-out user, a simple htML page is displayed asking the user to log in. A login uRi is generated using
the get_login_uri() method.
Step 6: Create the App's Home page
the last file to create is the app's home page. Create a file called index.php in web root and then add the
following code:
<?php
// Set error reporting to keep the code clean
error_reporting(E_ALL^E_STRICT);
ini_set('display_errors', 1);
// Loads the Facebook class
require_once 'includes/class.rwa_oauth.inc.php';
require_once 'includes/class.rwa_facebook.inc.php';
// Loads the $fb_config array
require_once 'includes/fb_config.inc.php';
 
Search WWH ::




Custom Search