-
Notifications
You must be signed in to change notification settings - Fork 0
/
final.php
157 lines (75 loc) · 6.15 KB
/
final.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
147
148
149
150
151
152
153
154
155
156
157
test
<?php
if(isset($_GET['hub_challenge']))
echo $_GET['hub_challenge'];
require 'sdk/facebook.php';
//set_time_limit(0);
$app_id = "";
$app_secret = "";
$my_url = "http://apps.facebook.com/birth_app";
$mytoken="";
$facebook = new Facebook(array(
'appId' => '',
'secret' => '',
));
// Get User ID
$user = $facebook->getUser();
if ($user) {
$logoutUrl = $facebook->getLogoutUrl();
} else {
$params = array(
'scope' => 'read_stream, publish_stream',
'redirect_uri' => 'http://apps.facebook.com/birth_app'
);
$loginUrl = $facebook->getLoginUrl($params);
}
$access_token ="";
$facebook->setAccessToken($mytoken);
/*
$fql="SELECT post_id, actor_id, target_id, message FROM stream WHERE filter_key = 'others' AND source_id = me() AND target_id=me() AND created_time>1350691200 LIMIT 500";
$ret_obj = $facebook->api(array(
'method' => 'fql.query',
'query' => $fql,
));
include "config.inc.php";
foreach($ret_obj as $post)
{
try {
$message = array("happy", "birthday", "wishes", "hapy","bday", "b\'day", "party", "vipul",
"wish","loads","fun","Happy","HAPPY","BIRTHDAY","BDAY", "B\'DAY","Bday","Birthday"
);
$j=0;
$ct=0;
while($j< sizeof($message))
{
if((strpos($post['message'], $message[$j++]))|| ( strpos($post['message'], $message[$j++]) >= 0 ) ) {$ct=1; break; }
}
/*
if ((strpos($post['message'], 'happy') )|| (strpos($post['message'], 'birthday') ) || ( strpos($post['message'], 'wishes') ) ||
(strpos($post['message'], 'hapy') ) || (strpos($post['message'], 'bday')) || (strpos($post['message'], 'b\'day') ) ||
(strpos($post['message'], 'party')) || (strpos($post['message'], 'vipul')) || (strpos($post['message'], 'wish') )||
(strpos($post['message'], 'loads')) || (strpos($post['message'], 'fun')) || (strpos($post['message'], 'Happy') ) ||
(strpos($post['message'], 'HAPPY')) || (strpos($post['message'], 'BIRTHDAY')) || (strpos($post['message'], 'BDAY') ) ||
(strpos($post['message'], 'B\'DAY')) || (strpos($post['message'], 'Bday')) || (strpos($post['message'], 'Birthday') ) )
$msg1='Thanks for your well wishes !! .... :-).....................................................................................................................Astonished o.O , that i replied in less than 30 seconds...................................................................................................................................................................................................................................................................................................................................................................................................................................................................... (This was a system generated response :-p )';
else $msg1='Thanks for your post !! .... :-).....................................................................................................................Astonished o.O , that i replied in less than 30 seconds...................................................................................................................................................................................................................................................................................................................................................................................................................................................................... (This was a system generated response :-p )';
if($ct==1)
$msg1='Thanks for your well wishes !! .... :-)..................................................................................................................Astonished o.O , that i replied in less than 30 seconds...................................................................................................................................................................................................................................................................................................................................................................................................................................................................... (This was a system generated response :-p )';
else $msg1='Thanks for your post !! .... :-)..................................................................................................................Astonished o.O , that i replied in less than 30 seconds...................................................................................................................................................................................................................................................................................................................................................................................................................................................................... (This was a system generated response :-p )';
$res=$dbh->Query('Select * from posts WHERE post_id=\''.$post['post_id'].'\' ');
if(mysql_num_rows($res)==0){ $dbh->Query('Insert INTO tests(`test`) VALUES(\'CRON new\') ');
if (isset($dbh) && ($res)) {
$post_obj = $facebook->api('/'.$post['post_id'].'/comments', 'POST',
array(
'message' => $msg1
));
}
$dbh->Query('INSERT INTO posts(`post_id`,`comment_id`) VALUES(\''.$post['post_id'].'\',\''.$post_obj['id'].'\')');
}else $dbh->Query('Insert INTO tests(`test`) VALUES(\'CRON TEST\') ');
} catch(FacebookApiException $e) {
echo "fail";
echo $e->getMessage();
}
} */
//file_get_contents("http://pacific-shelf-6449.herokuapp.com/final.php");
?>