forked from tasic/FacebookAutoPoster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
146 lines (115 loc) · 4.29 KB
/
index.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<?php
/**
* Created by PhpStorm.
* User: Milos
* Date: 12.3.2015
* Time: 12:24
*/
session_start();
if (isset($_REQUEST['logout'])) {
unset($_SESSION['fb_token']);
}
if (@$_SESSION['fb_token']) { //error supressor stavljen
header('Location: http://autofacebookgroupposter.com/autoposter.php');
exit;
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Free facebook group poster | Automate your groups postings on facebook</title>
<meta name="description" content="Post FREE to UNLIMITED facebook groups with a click!">
<meta name="keywords" content="free facebook group poster, fb group poster, facebook group poster, post to facebook groups, facebook auto poster, facebook autoposter, fb autoposter, facebook group autoposter, fb group autoposter">
<meta name="robots" content="index, follow">
<meta name="googlebot" content="index, follow">
<meta name="copyright" content="Copyright © 2015 Autofacebookgroupposter.com">
<meta name="rating" content="general">
<meta name="distribution" content="Global">
<meta name="revisit-after" content="30 days">
<meta name=viewport content="width=device-width">
<link rel="SHORTCUT ICON" href="img/favicon.ico">
<meta http-equiv="pragma" content="no-cache" />
<link rel="stylesheet" type="text/css" href="css/main.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="css/font-awesome.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap-social.css";>
</head>
<body>
<?php
/* INCLUSION OF LIBRARY FILES*/
require_once('lib/Facebook/FacebookSession.php');
require_once('lib/Facebook/FacebookRequest.php');
require_once('lib/Facebook/FacebookResponse.php');
require_once('lib/Facebook/FacebookSDKException.php');
require_once('lib/Facebook/FacebookRequestException.php');
require_once('lib/Facebook/FacebookRedirectLoginHelper.php');
require_once('lib/Facebook/FacebookAuthorizationException.php');
require_once('lib/Facebook/GraphObject.php');
require_once('lib/Facebook/GraphUser.php');
require_once('lib/Facebook/Entities/AccessToken.php');
require_once('lib/Facebook/HttpClients/FacebookCurl.php');
require_once('lib/Facebook/HttpClients/FacebookHttpable.php');
require_once('lib/Facebook/HttpClients/FacebookCurlHttpClient.php');
/* USE NAMESPACES */
use Facebook\FacebookSession;
use Facebook\FacebookRedirectLoginHelper;
use Facebook\FacebookRequest;
use Facebook\FacebookResponse;
use Facebook\FacebookSDKException;
use Facebook\FacebookRequestException;
use Facebook\FacebookAuthorizationException;
use Facebook\GraphObject;
use Facebook\GraphUser;
use Facebook\GraphSessionInfo;
use Facebook\FacebookCurlHttpClient;
use Facebook\FacebookCurl;
/* PROCESS */
$app_id = '779159068832924';
$app_secret = '0aa761cdb946f6234018d70ead21cb7d';
$redirect_url = 'http://autofacebookgroupposter.com/';
FacebookSession::setDefaultApplication($app_id,$app_secret);
$helper = new FacebookRedirectLoginHelper($redirect_url);
$logout = 'http://autofacebookgroupposter.com/index.php?fblogin&logout=true';
try {
$sess = $helper->getSessionFromRedirect();
}
catch (FacebookRequestException $ex) {
}
catch (Exception $ex) {
}
if(isset($_SESSION['fb_token'])){
$sess = new FacebookSession($_SESSION['fb_token']);
}
if (isset($sess)) {
$request = new FacebookRequest($sess,'GET','/me');
$response = $request->execute();
$graph = $response->getGraphObject((GraphUser::className()));
$name = $graph->getName();
$_SESSION['fb_token'] = $sess->getToken();
echo "Hi $name";
echo " <a href='".$logout."'><buttton>Logoout</button></a><br>";
echo "<a href='autoposter.php'><p>Go to AutoPoster</p></a>";
}
?>
<div id="main">
<div id="center">
<div id="text">
<h1>Auto Facebook Group Poster</h1>
<h3>Automate your groups postings on Facebook</h3><br><br>
<h3>Post to unlimited groups for free!<h3>
</div>
<div id="fb_button">
<?php
if (!isset($sess)) {
echo '<a class="btn btn-block btn-social btn-facebook" href="'.$helper->getLoginUrl( array( 'email','user_status','publish_actions','manage_pages','user_groups' ) ).'" > <i class="fa fa-facebook"></i> Sign in with Facebook</a>';
}
?>
</div>
<div id="footer">
<strong>© 2015 Autofacebookgroupposter.com</strong>
</div>
</div>
</div>
</body>
</html>