-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathfb_deauthorize.php
42 lines (36 loc) · 1.09 KB
/
fb_deauthorize.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
<?php
include("header.php");
$dotrace = true;
$fb_userid = $_POST['fb_sig_user'];
$info = fb_getuserdetails($fb_userid);
set_trace("Deauthorizing Facebook account for user: $fb_userid", $dotrace);
$verified = fb_verify_ping($facebook_secret);
if ($verified)
{
if ($_POST['fb_sig_uninstall'] == 1)
{ // The user has deauthorized Vilfredo
set_trace("Request verified", $dotrace);
if (empty($info['password']))
{ // Delete Facebook-only account
set_trace("Deleting Facebook-only account", $dotrace);
//$sql = "DELETE FROM users WHERE fb_userid = $fb_userid";
$sql = "UPDATE users SET active = 0 WHERE fb_userid = $fb_userid";
}
else
{ // Unconnect accounts
set_trace("Unconnecting account", $dotrace);
$sql = "UPDATE users SET fb_userid = '' WHERE fb_userid = $fb_userid";
}
$ret = mysql_query($sql);
if (!$ret)
{
set_trace("Could not delete/disconnect Facebook account", $dotrace);
}
}
}
else
{
// Log the IP and request for future reference?
set_trace("Request Unverified: Sigs didn't match!", $dotrace);
}
?>