-
Notifications
You must be signed in to change notification settings - Fork 0
/
2.6-login-session.php
29 lines (27 loc) · 1.04 KB
/
2.6-login-session.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?
// Facebook Programmierung - Galileo Verlag, Michael Kamleitner
// Weitere Informationen sowie Aktualisierungen zu diesem Code-Beispiel finden Sie unter http://book.socialisten.at
include_once('tools.php');
define('APP_ID', '214728715257742');
define('APP_SECRET', '********************************');
define('SITE_URL', 'http://apps.mycompany.com');
$login_url = "http://www.facebook.com/dialog/oauth". "?client_id=".APP_ID. "&redirect_uri=".SITE_URL."/2.5-login-session-callback.php";
session_start();
?>
<DOCTYPE html>
<html lang="de-de" xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<meta charset="utf-8">
<title>Hello Facebook!</title>
</head>
<body>
<? if (@$_SESSION["access_token"]) { ?>
Sie sind angemeldet als <?= @$_SESSION["me"]->name ?>! <a href="./2.7-logout-session.php">Logout</a>.
<pre><? print_r($_SESSION); ?></pre>
<? } else { ?>
Sie sind nicht angemeldet!
<a href="<?= $login_url ?>">Login mit Facebook</a>.
<pre><? print_r($_SESSION); ?></pre>
<? } ?>
</body>
</html>