-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathfb_connect.php
68 lines (63 loc) · 1.86 KB
/
fb_connect.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
include('header.php');
if(!$FACEBOOK_ID)
{
header("Location: login.php");
}
else
{
$error_message = "";
$connected = false;
//This code runs if the form has been submitted
if (isset($_POST['submit']))
{
if ($_POST['submit'] == "Cancel")
{
//$fb->api_client->auth_revokeAuthorization($FACEBOOK_ID);
//$fb->api("/me", "DELETE"); // ???
$fb->api("/$FACEBOOK_ID?method=delete");
$FACEBOOK_ID = null;
header("Location: login.php");
exit;
}
else
{
$connected = fb_connect_user();
$error_message = get_message_string();
clear_messages();
}
}
if ($connected)
{
$location = getpostloginredirectlink();
?>
<h2><?=$VGA_CONTENT['connected_ok_txt']?></h2>
<p><a href="<?php echo $location; ?>"><?=$VGA_CONTENT['click_cont_txt']?></a></p>
<?php
}
else {
?>
<!-- Greet the currently logged-in user! -->
<?php echo facebook_profile_pic(); ?>
<p><?=$VGA_CONTENT['greeting_txt']?> <?php echo facebook_username(); ?>!</p>
<p><?=$VGA_CONTENT['link_or_connect_txt']?> <a href="fb_register.php"><?=$VGA_CONTENT['new_account_via_facebook_link']?></a></p>
<br/>
<?=$VGA_CONTENT['link_account_txt']?>
<p><span class="errorMessage"><?php echo $error_message; ?></span></p>
<div class = "login_fields">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<fieldset>
<label for="username"><?=$VGA_CONTENT['username_label']?></label>
<input class="text ui-widget-content ui-corner-all" type="text" id="username" name="username"><br />
<label for="pass"><?=$VGA_CONTENT['password_label']?></label>
<input type="password" name="pass"><br />
<input type="submit" name="submit" value="<?=$VGA_CONTENT['cancel_button']?>">
<input type="submit" value="<?=$VGA_CONTENT['connect_button']?>" name="submit">
</fieldset>
</form>
<div>
<?php
}
}
include('footer.php');
?>