forked from ahmedelsaey/HlounPost
/
register.php
38 lines (33 loc) · 1.23 KB
/
register.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
<?php
include 'hloun/config.php';
$settings = $SQL->getSettings();
include 'admincp/src/facebook.php';
$config = array();
$config['appId'] = $settings->app_id;
$config['secret'] = $settings->app_key;
$config['fileUpload'] = true; // optional
$facebook = new Facebook($config);
$user = $facebook->getUser();
if($user)
{
$user_profile = $facebook->api('/me');
$access = $facebook->getAccessToken();
$string = getimg('https://graph.facebook.com/oauth/access_token?client_id='.$settings->app_id.'&client_secret='.$settings->app_key.'&grant_type=fb_exchange_token&fb_exchange_token='.$access);
$access = getAcess('http://facebook.com/?'.$string);
$id = $user_profile['id'];
$name= mysql_escape_string(htmlspecialchars($user_profile['name']));
$date = time();
$sql = mysql_query("select * from users where user_id='$id'");
if(mysql_num_rows($sql))
{
mysql_query("update users set access='$access',date='$date' where user_id='$id'");
}else{
mysql_query("insert into users (name,user_id,access,date) values ('$name','$id','$access','$date')");
}
}else{
}
?>
<script>
window.close();
window.opener.location.reload();
</script>